5.15.222-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 121/752 RDMA/mlx5: Fix state and counter desync on loopback enable failure
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <[email protected]>
[ Upstream commit 0d32eabccbe4b2f8d45be3192c5f3c76c8af703d ]
In mlx5_ib_enable_lb(), dev->lb.enabled was unconditionally set to true even if mlx5_nic_vport_update_local_lb() failed.
Fix this by only setting dev->lb.enabled on success. On failure, roll back the reference counters and return the error.
--- drivers/infiniband/hw/mlx5/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/infiniband/hw/mlx5/main.c +11 -0
@@ -1721,6 +1721,9 @@ int mlx5_ib_enable_lb(struct mlx5_ib_dev *dev, bool td, bool qp) dev->lb.qps == 1) {if (!dev->lb.enabled) { err =mlx5_nic_vport_update_local_lb (dev->mdev, true); +if (err) + goto err_rollback; + dev->lb.enabled = true; } }
@@ -1728,6 +1731,14 @@ int mlx5_ib_enable_lb(struct mlx5_ib_dev *dev, bool td, bool qp)mutex_unlock (&dev->lb.mutex);return err; + +err_rollback: +if (td) + dev->lb.user_td--; +if (qp) + dev->lb.qps--; +mutex_unlock (&dev->lb.mutex); +return err; }void mlx5_ib_disable_lb (struct mlx5_ib_dev *dev,bool td,bool qp)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 122/752 bpf: NUL-terminate replaced sysctl value
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dawei Feng <[email protected]>
[ Upstream commit a66e3b5bacf38d6ab29fa05a9754f7a114485605 ]
When writing to sysctls, proc_sys_call_handler() guarantees that the buffer passed to proc handlers is NUL-terminated. If bpf_sysctl_set_new_value() replaces the pending sysctl value, it can hand a replacement buffer directly to proc handlers. However, the helper currently copies only buf_len bytes into that buffer without appending a NUL terminator, leaving downstream parsers vulnerable to out-of-bounds access.
Fix this by appending a '\0' after the replaced value to restore the expected sysctl semantics. Since the helper already rejects buf_len greater than PAGE_SIZE - 1, there is always room for the extra byte.
Reproduced in a QEMU x86_64 guest booted with KASAN while exercising the sysctl replacement path with a cgroup/sysctl BPF program. The reproducer targets /proc/sys/net/core/flow_limit_cpu_bitmap, fills the original user write buffer with non-zero bytes, and overrides the sysctl value so the replacement buffer lacks a terminating NUL. Under that setup, the pre-fix kernel reported:
BUG: KASAN: slab-out-of-bounds in strnchrnul+0x72/0x90 Read of size 1 at addr ffff88800de57000 by task repro_patch3/66 CPU: 0 UID: 0 PID: 66 Comm: repro_patch3 Not tainted 7.1.0-rc3-00269-g8370ca1f87cc #6 PREEMPT(lazy) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x68/0xa0 print_report+0xcb/0x5e0 ? __virt_addr_valid+0x21d/0x3f0 ? strnchrnul+0x72/0x90 ? strnchrnul+0x72/0x90 kasan_report+0xca/0x100 ? strnchrnul+0x72/0x90 strnchrnul+0x72/0x90 bitmap_parse+0x37/0x2e0 flow_limit_cpu_sysctl+0xc6/0x840 ? __pfx_flow_limit_cpu_sysctl+0x10/0x10 ? __kvmalloc_node_noprof+0x5ba/0x870 proc_sys_call_handler+0x31d/0x480 ? __pfx_proc_sys_call_handler+0x10/0x10 ? selinux_file_permission+0x39f/0x500 ? lock_is_held_type+0x9e/0x120 vfs_write+0x98e/0x1000 ... </TASK> The buggy address is located 0 bytes to the right of allocated 4096-byte region [ffff88800de56000, ffff88800de57000)
With this fix applied, rerunning the same sysctl-targeted path yields no corresponding KASAN reports.
--- kernel/bpf/cgroup.c | 1 + 1 file changed, 1 insertion(+)
kernel/bpf/cgroup.c +1 -0
@@ -1812,6 +1812,7 @@ BPF_CALL_3(bpf_sysctl_set_new_value, struct bpf_sysctl_kern *, ctx,return -E2BIG ;memcpy (ctx->new_val, buf, buf_len); + ((char *)ctx->new_val)[buf_len] ='\0' ; ctx->new_len = buf_len; ctx->new_updated =1 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 123/752 net: cpsw_new: unregister devlink on port registration failure
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <[email protected]>
[ Upstream commit b64f763b607426ac97e44b114f0b8844ac3b86dd ]
cpsw_probe() registers devlink before registering the CPSW ports.
If cpsw_register_ports() fails, the error path only unregisters the notifiers and then releases the lower level resources. It does not undo the successful cpsw_register_devlink() call, leaving the devlink instance and its parameters registered after probe has failed.
Add a devlink cleanup label for the path where devlink registration has already succeeded, and use it when port registration fails.
--- drivers/net/ethernet/ti/cpsw_new.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/ti/cpsw_new.c +3 -1
@@ -2030,7 +2030,7 @@ static int cpsw_probe(struct platform_device *pdev) ret =cpsw_register_ports (cpsw);if (ret) - goto clean_unregister_notifiers; + goto clean_unregister_devlink; dev_notice(dev, "initialized (regs %pa, pool size %d) hw_ver:%08X %d.%d (%d)\n", &ss_res->start, descs_pool_size,
@@ -2042,6 +2042,8 @@ static int cpsw_probe(struct platform_device *pdev)return 0 ; +clean_unregister_devlink: +cpsw_unregister_devlink (cpsw); clean_unregister_notifiers:cpsw_unregister_notifiers (cpsw); clean_cpts:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 124/752 hsr: broadcast netlink notifications in the devices net namespace
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maoyi Xie <[email protected]>
[ Upstream commit a762fabd7ef9a6cc07258684138f9c3f078d0326 ]
The HSR generic netlink family sets .netnsok = true. HSR devices can live in network namespaces other than init_net.
Two async notifiers broadcast events with genlmsg_multicast(). They are hsr_nl_ringerror() and hsr_nl_nodedown(). That helper delivers only on the default genl socket in init_net. So the events always land in init_net. The network namespace of the device does not matter.
This has two effects. A listener in the device's own namespace never sees its own ring error and node down events. A privileged listener in init_net receives events from HSR devices in other namespaces. The payload carries the peer node MAC (HSR_A_NODE_ADDR) and the slave port ifindex (HSR_A_IFINDEX).
Switch both callers to genlmsg_multicast_netns(). Other families with .netnsok = true already do this. Examples are gtp, ovpn, team, batman-adv, netdev-genl, ethtool and handshake.
hsr_nl_ringerror() already has the slave port. It uses dev_net(port->dev). hsr_nl_nodedown() takes the namespace from the master port via hsr_port_get_hsr().
--- net/hsr/hsr_netlink.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
net/hsr/hsr_netlink.c +7 -2
@@ -209,7 +209,8 @@ void hsr_nl_ringerror(struct hsr_priv *hsr, unsigned char addr[ETH_ALEN], goto nla_put_failure;genlmsg_end (skb, msg_head); -genlmsg_multicast (&hsr_genl_family, skb,0 ,0 ,GFP_ATOMIC ); +genlmsg_multicast_netns (&hsr_genl_family,dev_net (port->dev), + skb,0 ,0 ,GFP_ATOMIC );return ;
@@ -245,8 +246,12 @@ void hsr_nl_nodedown(struct hsr_priv *hsr, unsigned char addr[ETH_ALEN])if (res <0 ) goto nla_put_failure; +rcu_read_lock (); + master =hsr_port_get_hsr (hsr,HSR_PT_MASTER );genlmsg_end (skb, msg_head); -genlmsg_multicast (&hsr_genl_family, skb,0 ,0 ,GFP_ATOMIC ); +genlmsg_multicast_netns (&hsr_genl_family,dev_net (master->dev), + skb,0 ,0 ,GFP_ATOMIC ); +rcu_read_unlock ();return ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 125/752 ALSA: es18xx: check control allocation before private data setup
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruoyu Wang <[email protected]>
[ Upstream commit 422e42b7c2b882ba1d16d4afc8891bcea7c4de93 ]
snd_es18xx_mixer() creates controls with snd_ctl_new1() and then stores bookkeeping pointers or sets private_free before calling snd_ctl_add(). snd_ctl_new1() can return NULL on allocation failure, so those writes can dereference a NULL control pointer.
Check the returned control pointers before using them and return -ENOMEM on allocation failure.
--- sound/isa/es18xx.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/isa/es18xx.c +4 -0
@@ -1779,6 +1779,8 @@ static int snd_es18xx_mixer(struct snd_card *card)for (idx =0 ; idx <ARRAY_SIZE (snd_es18xx_base_controls); idx++) {struct snd_kcontrol *kctl; kctl =snd_ctl_new1 (&snd_es18xx_base_controls[idx], chip); +if (!kctl) +return -ENOMEM ;if (chip->caps &ES18XX_HWV ) {switch (idx) {case 0 :
@@ -1840,6 +1842,8 @@ static int snd_es18xx_mixer(struct snd_card *card)for (idx =0 ; idx <ARRAY_SIZE (snd_es18xx_hw_volume_controls); idx++) {struct snd_kcontrol *kctl; kctl =snd_ctl_new1 (&snd_es18xx_hw_volume_controls[idx], chip); +if (!kctl) +return -ENOMEM ;if (idx ==0 ) chip->hw_volume = kctl;else
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 126/752 netfilter: nf_conntrack: use get_unaligned_be32() in tcp_sack()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit d3bf9eae486490832bd08fd62ab0ac601f346bd4 ]
The timestamp-only fast path dereferences the option stream as *(__be32 *)ptr, which assumes 4-byte alignment that the TCP option stream does not guarantee. Use get_unaligned_be32() instead, which reads the value safely and already returns host byte order, so the htonl() on the comparison constant can be dropped.
This matches the existing get_unaligned_be32() use later in the same function.
--- net/netfilter/nf_conntrack_proto_tcp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/netfilter/nf_conntrack_proto_tcp.c +5 -5
@@ -399,11 +399,11 @@ static void tcp_sack(const struct sk_buff *skb, unsigned int dataoff,return ;/* Fast path for timestamp-only option */ -if (length ==TCPOLEN_TSTAMP_ALIGNED - && *(__be32 *)ptr ==htonl ((TCPOPT_NOP <<24 ) - | (TCPOPT_NOP <<16 ) - | (TCPOPT_TIMESTAMP <<8 ) - |TCPOLEN_TIMESTAMP )) +if (length ==TCPOLEN_TSTAMP_ALIGNED && +get_unaligned_be32 (ptr) == ((TCPOPT_NOP <<24 ) | + (TCPOPT_NOP <<16 ) | + (TCPOPT_TIMESTAMP <<8 ) | +TCPOLEN_TIMESTAMP ))return ;while (length >0 ) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 127/752 btrfs: balance: fix potential bg lookup failure in btrfs_may_alloc_data_chunk()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: ZhengYuan Huang <[email protected]>
[ Upstream commit 18d32b0013efba19f7ad3e5b08d7aee813d604a6 ]
[BUG]
Running btrfs balance can trigger a null-ptr-deref before relocating a data chunk when metadata corruption leaves a chunk in the chunk tree without a corresponding block group in the in-memory cache:
KASAN: null-ptr-deref in range [0x0000000000000088-0x000000000000008f]
RIP: 0010:btrfs_may_alloc_data_chunk+0x40/0x1c0 fs/btrfs/volumes.c:3601
Call Trace:
__btrfs_balance fs/btrfs/volumes.c:4217 [inline]
btrfs_balance+0x2516/0x42b0 fs/btrfs/volumes.c:4604
btrfs_ioctl_balance fs/btrfs/ioctl.c:3577 [inline]
btrfs_ioctl+0x25cf/0x5b90 fs/btrfs/ioctl.c:5313
...[CAUSE]__btrfs_balance() iterates the on-disk chunk tree and passes the chunk logical bytenr to btrfs_may_alloc_data_chunk() before relocating a data chunk. That helper then queries the in-memory block group cache:
cache = btrfs_lookup_block_group(fs_info, chunk_offset); chunk_type = cache->flags; /* cache may be NULL */
A corrupt image can contain a chunk item whose matching block group item is missing, so no block group is ever inserted into the cache. In that case btrfs_lookup_block_group() returns NULL.
The code only guards this with ASSERT(cache), which becomes a no-op when CONFIG_BTRFS_ASSERT is disabled. The subsequent dereference of cache->flags therefore crashes the kernel.
[FIX]
Add a NULL check after btrfs_lookup_block_group() in btrfs_may_alloc_data_chunk() and print and error message for clarity.
--- fs/btrfs/volumes.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/btrfs/volumes.c +5 -1
@@ -3476,7 +3476,11 @@ static int btrfs_may_alloc_data_chunk(struct btrfs_fs_info *fs_info,u64 chunk_type; cache =btrfs_lookup_block_group (fs_info, chunk_offset); -ASSERT (cache); +if (unlikely (!cache)) { +btrfs_err (fs_info,"balance: chunk at bytenr %llu has no corresponding block group" , + chunk_offset); +return -EUCLEAN ; + } chunk_type = cache->flags;btrfs_put_block_group (cache);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 128/752 RDMA/rtrs-srv: Fix integer underflow in process_read and process_write
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aurelien DESBRIERES <[email protected]>
[ Upstream commit 54bf38b27afc08a0eb6b732f9c14eb8a4bcb66b5 ]
usr_len is read from a network-supplied message field (le16_to_cpu) and used to compute data_len = off - usr_len without validating that usr_len <= off. A malicious RDMA client can send usr_len > off causing an integer underflow, resulting in data_len wrapping to a huge size_t value which is then passed to the rdma_ev callback as a memory length, leading to out-of-bounds memory access.
Fix by reading and validating usr_len <= off before rtrs_srv_get_ops_ids() in both process_read() and process_write(), ensuring the early return path acquires no reference and has no resource leak.
--- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/rtrs/rtrs-srv.c +10 -2
@@ -1047,6 +1047,11 @@ static void process_read(struct rtrs_srv_con *con, "Processing read request failed, invalid message\n");return ; } + usr_len =le16_to_cpu (msg->usr_len); +if (usr_len > off) { +pr_debug ("rtrs-srv: Invalid usr_len %zu > off %u\n" , usr_len, off); +return ; + }rtrs_srv_get_ops_ids (srv_path);rtrs_srv_update_rdma_stats (srv_path->stats, off,READ ); id = srv_path->ops_ids[buf_id];
@@ -1054,7 +1059,6 @@ static void process_read(struct rtrs_srv_con *con, id->dir =READ ; id->msg_id = buf_id; id->rd_msg = msg; - usr_len =le16_to_cpu (msg->usr_len); data_len = off - usr_len; data =page_address (srv->chunks[buf_id]); ret = ctx->ops.rdma_ev(srv->priv, id, READ, data, data_len,
@@ -1100,6 +1104,11 @@ static void process_write(struct rtrs_srv_con *con, rtrs_srv_state_str(srv_path->state));return ; } + usr_len =le16_to_cpu (req->usr_len); +if (usr_len > off) { +pr_debug ("rtrs-srv: Invalid usr_len %zu > off %u\n" , usr_len, off); +return ; + }rtrs_srv_get_ops_ids (srv_path);rtrs_srv_update_rdma_stats (srv_path->stats, off,WRITE ); id = srv_path->ops_ids[buf_id];
@@ -1107,7 +1116,6 @@ static void process_write(struct rtrs_srv_con *con, id->dir =WRITE ; id->msg_id = buf_id; - usr_len =le16_to_cpu (req->usr_len); data_len = off - usr_len; data =page_address (srv->chunks[buf_id]); ret = ctx->ops.rdma_ev(srv->priv, id, WRITE, data, data_len,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 129/752 xprtrdma: Add request-pool slack for delayed recycling
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit 64bf6892057b746c55bcc045b9492741b72d8d27 ]
After the previous patch gates req recycling on Send completion, a completed RPC's rpcrdma_req can remain pinned by the sendctx ring until the next signaled Send completion releases it. The transmitted-RPC ceiling is unchanged: xprt_request_get_cong() gates Sends against xprt->cwnd, the RPC/RDMA credit window fed by server-granted credits and capped at re_max_requests. The req pool, however, must exceed max_reqs by enough that this recycle delay does not stall a slot allocation that the credit window would admit.
The headroom is bounded. frwr_open() sets re_send_batch to re_max_requests >> 3 -- one in every eight Sends is signaled -- so at most re_send_batch unsignaled Sends can be outstanding before the next signaled completion releases them. That equals max_reqs / 8 reqs in the worst case, with a one-slot floor for small max_reqs values where the right-shift rounds to zero.
The sendctx ring and the hardware Send Queue are not enlarged to match. Both are sized in rpcrdma_sendctxs_create() and frwr_query_device() for re_max_requests in-flight Sends, which is the ceiling the credit window enforces. The pool slack does not raise that ceiling -- it only lets allocation keep pace with the credit window during the brief interval in which earlier reqs are pinned waiting for the next signaled completion. At any moment, at most re_send_batch sendctxes are held by unswept unsignaled Sends, leaving the rest of the ring available for newly admitted Sends.
Allocate max_reqs + DIV_ROUND_UP(max_reqs, 8) request objects and name the slack calculation at the allocation site so the 1/8 bound stays tied to the Send-signaling batch size.
--- net/sunrpc/xprtrdma/verbs.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
net/sunrpc/xprtrdma/verbs.c +20 -1
@@ -1076,6 +1076,22 @@ static void rpcrdma_reps_destroy(struct rpcrdma_buffer *buf)spin_unlock (&buf->rb_lock); } +static unsigned int rpcrdma_req_pool_slack (unsigned int max_reqs) +{ +/* The sendctx ring can hold up to one Send-signaling batch +* (re_send_batch, set by frwr_open() to re_max_requests >> 3) +* of unfinished Sends. Each pins its req until a signaled Send +* completion releases the sendctx. Size the pool above max_reqs +* by that batch so the recycle delay does not stall a slot +* allocation that the RPC/RDMA credit window would admit. +* +* Round up: re_max_requests >> 3 is zero when max_reqs < 8, but +* a single unsignaled Send is still enough to pin one req. One +* slack slot covers that case. +*/ +return DIV_ROUND_UP (max_reqs,8 ); +} +/** * rpcrdma_buffer_create - Create initial set of req/rep objects * @r_xprt: transport instance to (re)initialize
@@ -1085,6 +1101,7 @@ static void rpcrdma_reps_destroy(struct rpcrdma_buffer *buf)int rpcrdma_buffer_create (struct rpcrdma_xprt *r_xprt) {struct rpcrdma_buffer *buf = &r_xprt->rx_buf; +unsigned int max_reqs;int i, rc; buf->rb_bc_srv_max_requests =0 ;
@@ -1098,7 +1115,9 @@ int rpcrdma_buffer_create(struct rpcrdma_xprt *r_xprt)INIT_LIST_HEAD (&buf->rb_all_reps); rc = -ENOMEM ; -for (i =0 ; i < r_xprt->rx_xprt.max_reqs; i++) { + max_reqs = r_xprt->rx_xprt.max_reqs; + max_reqs +=rpcrdma_req_pool_slack (max_reqs); +for (i =0 ; i < max_reqs; i++) {struct rpcrdma_req *req; req = rpcrdma_req_create(r_xprt, RPCRDMA_V1_DEF_INLINE_SIZE * 2,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 130/752 configfs_depend_prep(): pass configfs_dirent instead of dentry
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit 764682e0118432260191d194edbdaff208260483 ]
Again, the only thing it uses dentry for is dentry->d_fsdata; for the recursive call the situation is the same as with configfs_detach_prep() and the same observation about ->s_dentry->d_fsdata applies.
--- fs/configfs/dir.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
fs/configfs/dir.c +4 -8
@@ -1060,15 +1060,12 @@ static int configfs_dump(struct configfs_dirent *sd, int level)* much on the stack, though, so folks that need this function - be careful * about your stack! Patches will be accepted to make it iterative. */ -static int configfs_depend_prep (struct dentry *origin, +static int configfs_depend_prep (struct configfs_dirent *sd,struct config_item *target) { -struct configfs_dirent *child_sd, *sd; +struct configfs_dirent *child_sd;int ret =0 ; -BUG_ON (!origin || !origin->d_fsdata); - sd = origin->d_fsdata; -if (sd->s_element == target)/* Boo-yah */ goto out;
@@ -1076,8 +1073,7 @@ static int configfs_depend_prep(struct dentry *origin,if ((child_sd->s_type &CONFIGFS_DIR ) && !(child_sd->s_type &CONFIGFS_USET_DROPPING ) && !(child_sd->s_type &CONFIGFS_USET_CREATING )) { - ret =configfs_depend_prep (child_sd->s_dentry, - target); + ret =configfs_depend_prep (child_sd, target);if (!ret) goto out;/* Child path boo-yah */ }
@@ -1098,7 +1094,7 @@ static int configfs_do_depend_item(struct dentry *subsys_dentry,spin_lock (&configfs_dirent_lock);/* Scan the tree, return 0 if found */ - ret =configfs_depend_prep (subsys_dentry, target); + ret =configfs_depend_prep (subsys_dentry->d_fsdata, target);if (ret) goto out_unlock_dirent_lock;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 131/752 net: ibm: emac: mal: fix potential system hang in mal_remove()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 7c5d41f87f079990bf241359e3c1332d8d10fe87 ]
napi_disable() is not idempotent and calling it on an already-disabled or unenabled NAPI context will cause the kernel to spin indefinitely waiting for the NAPI_STATE_SCHED bit to clear.
In mal_remove(), napi_disable() is called unconditionally. If no MACs were registered, NAPI was never enabled. Also, if they were registered but subsequently unregistered, NAPI was already disabled in mal_unregister_commac(). In either case, calling napi_disable() causes the kernel to hang upon module removal.
Fix this by only calling napi_disable() in mal_remove() if the commac list is not empty (which implies NAPI is enabled).
--- drivers/net/ethernet/ibm/emac/mal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/ibm/emac/mal.c +3 -3
@@ -716,13 +716,13 @@ static int mal_remove(struct platform_device *ofdev)MAL_DBG (mal,"remove" NL );/* Synchronize with scheduled polling */ -napi_disable (&mal->napi); - -if (!list_empty (&mal->list)) +if (!list_empty (&mal->list)) { +napi_disable (&mal->napi);/* This is *very* bad */ WARN (1 ,KERN_EMERG "mal%d: commac list is not empty on remove!\n" , mal->index); + }free_irq (mal->serr_irq, mal);free_irq (mal->txde_irq, mal);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 132/752 platform/x86: dell-laptop: add Inspiron N5110 to touchpad LED quirk table
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gleb Sonichev <[email protected]>
[ Upstream commit bfe91a80b13f8068f6fa07aa8c468d284150d4ad ]
The Inspiron N5110 needs the touchpad LED quirk (Vostro V130 quirk) to properly control the touchpad LED. Add its DMI identifier to the existing quirk table, next to the similar Inspiron M5110 entry.
Tested on Dell Inspiron N5110.
The touchpad LED works correctly with this quirk enabled.
--- drivers/platform/x86/dell/dell-laptop.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/dell/dell-laptop.c +9 -0
@@ -201,6 +201,15 @@ static const struct dmi_system_id dell_quirks[] __initconst = { }, .driver_data = &quirk_dell_vostro_v130, }, + { + .callback = dmi_matched, + .ident = "Dell Inspiron N5110", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron N5110"), + }, + .driver_data = &quirk_dell_vostro_v130, + }, { .callback = dmi_matched, .ident = "Dell Vostro 3360",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 133/752 wifi: mt76: transform aspm_conf for pci_disable_link_state
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiajia Liu <[email protected]>
[ Upstream commit 2dd78856223484895306351df1f903a4b75d213f ]
commit b478e162f227 ("PCI/ASPM: Consolidate link state defines") changed PCIE_LINK_STATE_L0S (1) to (BIT(0) | BIT(1)). PCI_EXP_LNKCTL_ASPM_L0S (1) and PCI_EXP_LNKCTL_ASPM_L1 (2) are no longer matched with PCIE_LINK_STATE_L0S (3) and PCIE_LINK_STATE_L1 (4).
On the platform enabling ASPM L0s and L1, mt76_pci_disable_aspm is not able to disable L1. Fix this by transforming aspm_conf to pcie link state.
--- drivers/net/wireless/mediatek/mt76/pci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/pci.c +7 -1
@@ -30,8 +30,14 @@ void mt76_pci_disable_aspm(struct pci_dev *pdev)if (IS_ENABLED (CONFIG_PCIEASPM )) {int err; +int state =0 ; - err =pci_disable_link_state (pdev, aspm_conf); +if (aspm_conf &PCI_EXP_LNKCTL_ASPM_L0S ) + state |=PCIE_LINK_STATE_L0S ; +if (aspm_conf &PCI_EXP_LNKCTL_ASPM_L1 ) + state |=PCIE_LINK_STATE_L1 ; + + err =pci_disable_link_state (pdev, state);if (!err)return ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 134/752 btrfs: protect sb_write_pointer() with invalidate lock
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: KangNing Liao <[email protected]>
[ Upstream commit 123b9a545f4d0348e81f558a032bf2a93ee5722f ]
sb_write_pointer() reads the super block from the block device page cache using read_cache_page_gfp(). This has the same race with BLKBSZSET as the one fixed by commit 3f29d661e568 ("btrfs: sync read disk super and set block size").
Take the mapping invalidate lock around read_cache_page_gfp() to serialize the read against block size changes.
--- fs/btrfs/zoned.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/zoned.c +2 -0
@@ -104,8 +104,10 @@ static int sb_write_pointer(struct block_device *bdev, struct blk_zone *zones, bytenr = ((zones[i].start + zones[i].len) <<SECTOR_SHIFT ) -BTRFS_SUPER_INFO_SIZE ; +filemap_invalidate_lock (mapping); page[i] =read_cache_page_gfp (mapping, bytenr >>PAGE_SHIFT ,GFP_NOFS ); +filemap_invalidate_unlock (mapping);if (IS_ERR (page[i])) {if (i ==1 )btrfs_release_disk_super (super[0 ]);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 135/752 hwmon: (adt7462) Add of_match_table to support devicetree
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kory Maincent <[email protected]>
[ Upstream commit cd1b42617aafe01810ab7d3b9948d2f5fa9fb8af ]
Add of_match_table to add support of devicetree probing.
--- drivers/hwmon/adt7462.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/hwmon/adt7462.c +8 -0
@@ -12,6 +12,7 @@#include <linux/hwmon.h> #include <linux/hwmon-sysfs.h> #include <linux/err.h> +#include <linux/mod_devicetable.h> #include <linux/mutex.h> #include <linux/log2.h> #include <linux/slab.h>
@@ -1814,10 +1815,17 @@ static const struct i2c_device_id adt7462_id[] = { };MODULE_DEVICE_TABLE (i2c, adt7462_id); +static const struct of_device_id adt7462_of_match[] = { + { .compatible ="onnn,adt7462" }, + { }, +}; +MODULE_DEVICE_TABLE (of, adt7462_of_match); +static struct i2c_driver adt7462_driver = { .class =I2C_CLASS_HWMON , .driver = { .name ="adt7462" , + .of_match_table = adt7462_of_match, }, .probe_new = adt7462_probe, .id_table = adt7462_id,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 136/752 ata: libata-pmp: add JMicron JMS562 quirk
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Rao <[email protected]>
[ Upstream commit c62aff1174cf88e10716c7513702443c47551fc6 ]
JMicron JMS562, as used in QNAP QDA-A2AR RAID1 adapters, may keep the exported ATA device not ready while the array is rebuilding.
In this state, libata may repeatedly try to softreset and classify the fan-out link. On the affected adapter, this can time out, make PMP/SCR access fail, and eventually disable the fan-out link before the RAID volume is exported.
A failing boot shows the fan-out link failing SRST, PMP access timing out, SCR read failing, and the link being disabled:
ata4.00: softreset failed (device not ready) ata4.15: qc timeout after 3000 msecs (cmd 0xe4) ata4.00: failed to read SCR 0 (Emask=0x4) ata4.00: failed to recover link after 3 tries, disabling
After that, the root filesystem on the exported RAID volume cannot be found.
Add JMS562 to the existing JMicron PMP quirk that disables LPM, avoids softreset on fan-out links, and assumes an ATA device. This prevents libata from dropping the exported RAID volume during rebuild recovery.
--- drivers/ata/libata-pmp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ata/libata-pmp.c +6 -1
@@ -446,8 +446,13 @@ static void sata_pmp_quirks(struct ata_port *ap)* otherwise. Don't try hard to recover it. */ ap->pmp_link[ap->nr_pmp_links -1 ].flags |=ATA_LFLAG_NO_RETRY ; - }else if (vendor ==0x197b && (devid ==0x2352 || devid ==0x0325 )) { + }else if (vendor ==0x197b && + (devid ==0x0562 || devid ==0x2352 || devid ==0x0325 )) {/* +* 0x0562: JMicron JMS562, as used in QNAP QDA-A2AR RAID1 +* adapters. The exported device may stay not ready +* while the array is rebuilding, and SRST/classify can +* time out before the RAID volume is exported. * 0x2352: found in Thermaltake BlackX Duet, jmicron JMB350? * 0x0325: jmicron JMB394. */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 137/752 platform/x86: intel-hid: Add HP ProBook x360 440 G1 to button_array_table
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Metchev <[email protected]>
[ Upstream commit c39023ca9a447f09c072080efc84d6874c2275c9 ]
The volume rocker buttons on the HP ProBook x360 440 G1 convertible emit events 0xc4-0xc7 via the intel-hid ACPI device (INT33D5). These codes are only present in intel_array_keymap, which is used when the "5 button array" input device exists. On this machine button_array_present() returns false because the firmware does not advertise the array through the HEBC method, so notify_handler() routes the events to a NULL priv->array and they are dropped as "unknown event 0xc4". As a result the side volume keys do nothing.
Add the machine to button_array_table so the array device is created and the volume rocker emits KEY_VOLUMEUP / KEY_VOLUMEDOWN. This is equivalent to booting with the enable_5_button_array=1 module parameter, which was used to confirm the fix on the affected hardware.
--- drivers/platform/x86/intel/hid.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/intel/hid.c +7 -0
@@ -123,6 +123,13 @@ static const struct dmi_system_id button_array_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Surface Go 3"), }, }, + { + .ident = "HP ProBook x360 440 G1", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "HP"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP ProBook x360 440 G1"), + }, + }, { } };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 138/752 sctp: Unwind address notifier registration on failure
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuho Choi <[email protected]>
[ Upstream commit c8459ee2fef502d6ef6c063751c33d9ac7943eab ]
sctp_v4_add_protocol() and sctp_v6_add_protocol() register their address notifiers before registering the SCTP protocol handlers. If protocol registration fails, the functions return without unregistering the notifiers.
Unregister the notifiers on the protocol registration failure paths. Also propagate notifier registration failures instead of ignoring them.
--- net/sctp/ipv6.c | 10 ++++++++-- net/sctp/protocol.c | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-)
net/sctp/ipv6.c +8 -2
@@ -1202,11 +1202,17 @@ void sctp_v6_protosw_exit(void)/* Register with inet6 layer. */ int sctp_v6_add_protocol (void ) { +int ret; +/* Register notifier for inet6 address additions/deletions. */ -register_inet6addr_notifier (&sctp_inet6addr_notifier); + ret =register_inet6addr_notifier (&sctp_inet6addr_notifier); +if (ret) +return ret; -if (inet6_add_protocol (&sctpv6_protocol,IPPROTO_SCTP ) <0 ) +if (inet6_add_protocol (&sctpv6_protocol,IPPROTO_SCTP ) <0 ) { +unregister_inet6addr_notifier (&sctp_inet6addr_notifier);return -EAGAIN ; + }return 0 ; }
net/sctp/protocol.c +8 -2
@@ -1272,12 +1272,18 @@ static void sctp_v4_protosw_exit(void)static int sctp_v4_add_protocol (void ) { +int ret; +/* Register notifier for inet address additions/deletions. */ -register_inetaddr_notifier (&sctp_inetaddr_notifier); + ret =register_inetaddr_notifier (&sctp_inetaddr_notifier); +if (ret) +return ret;/* Register SCTP with inet layer. */ -if (inet_add_protocol (&sctp_protocol,IPPROTO_SCTP ) <0 ) +if (inet_add_protocol (&sctp_protocol,IPPROTO_SCTP ) <0 ) { +unregister_inetaddr_notifier (&sctp_inetaddr_notifier);return -EAGAIN ; + }return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 139/752 PCI: Avoid SBR for Qualcomm WCN6855/WCN7850 WiFi, SDX62/SDX65 modems
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jose Ignacio Tornos Martinez <[email protected]>
[ Upstream commit 6a4f64c3a3ada43e71ef1e06da89beb36bdaeefa ]
Some Qualcomm PCIe devices (WCN6855/WCN7850 WiFi cards, SDX62/SDX65 modems) do not properly support Secondary Bus Reset (SBR).
Testing confirms this is device-specific, not deployment-specific:
MediaTek MT7925e successfully uses bus reset through the same passive M.2-to-PCIe adapters where Qualcomm devices fail, proving PERST# is properly wired through the adapters.
Prevent use of Secondary Bus Reset for these devices.
--- drivers/pci/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/pci/quirks.c +3 -0
@@ -3642,6 +3642,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x003c, quirk_no_bus_reset);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x0033 , quirk_no_bus_reset);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x0034 , quirk_no_bus_reset);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x003e , quirk_no_bus_reset); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_QCOM ,0x1103 , quirk_no_bus_reset);/* WCN6855 */ +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_QCOM ,0x1107 , quirk_no_bus_reset);/* WCN7850 */ +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_QCOM ,0x0308 , quirk_no_bus_reset);/* SDX62/SDX65 */ /* * Root port on some Cavium CN8xxx chips do not successfully complete a bus
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 140/752 dmaengine: dw-axi-dmac: fix PM for system sleep and channel alloc
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tze Yee Ng <[email protected]>
[ Upstream commit df0c2dc68770cf43f15df40b184df030b850ea05 ]
The driver only had runtime PM callbacks. If a channel stayed allocated across system suspend/resume, the runtime usage count could remain non-zero while hardware state (DMAC_CFG, clocks) was lost, and axi_dma_runtime_resume() would not run to restore it.
Add system-sleep PM ops that use pm_runtime_force_suspend() and pm_runtime_force_resume() so suspend/resume reuses the existing axi_dma_suspend() and axi_dma_resume() paths.
Replace pm_runtime_get() with pm_runtime_resume_and_get() in dma_chan_alloc_chan_resources() so clocks are enabled before a client can immediately submit a transfer and touch MMIO.
--- drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +9 -2
@@ -426,11 +426,17 @@ static void dw_axi_dma_synchronize(struct dma_chan *dchan)static int dma_chan_alloc_chan_resources (struct dma_chan *dchan) {struct axi_dma_chan *chan =dchan_to_axi_dma_chan (dchan); +int ret; + + ret =pm_runtime_resume_and_get (chan->chip->dev); +if (ret <0 ) +return ret;/* ASSERT: channel is idle */ if (axi_chan_is_hw_enable (chan)) {dev_err (chan2dev (chan),"%s is non-idle!\n" ,axi_chan_name (chan)); +pm_runtime_put (chan->chip->dev);return -EBUSY ; }
@@ -441,12 +447,11 @@ static int dma_chan_alloc_chan_resources(struct dma_chan *dchan) 64, 0);if (!chan->desc_pool) {dev_err (chan2dev (chan),"No memory for descriptors\n" ); +pm_runtime_put (chan->chip->dev);return -ENOMEM ; }dev_vdbg (dchan2dev (dchan),"%s: allocating\n" ,axi_chan_name (chan)); -pm_runtime_get (chan->chip->dev); -return 0 ; }
@@ -1494,6 +1499,8 @@ static int dw_remove(struct platform_device *pdev) }static const struct dev_pm_ops dw_axi_dma_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume)SET_RUNTIME_PM_OPS (axi_dma_runtime_suspend, axi_dma_runtime_resume,NULL ) };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 141/752 hwmon: (pmbus/lm25066) Fix PMBus coefficients for LM5064/5066/5066i
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Potin Lai <[email protected]>
[ Upstream commit 83dda7ed185501ba1f8165aeca83ff4a8ef7c263 ]
Swap the high setting and low setting coefficients in the lm25066_coeff table for LM5064, LM5066, and LM5066i. The coefficients were previously mapped incorrectly, resulting in inverted current and power scaling.
Additionally, dynamically assign the exponent (R) registers inside the probe's LM25066_DEV_SETUP_CL check. This ensures that the proper exponent is applied (e.g., for LM25056, high setting power exponent is -4, but low setting power exponent is -3).
--- drivers/hwmon/pmbus/lm25066.c | 54 ++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 26 deletions(-)
drivers/hwmon/pmbus/lm25066.c +28 -26
@@ -131,23 +131,23 @@ static struct __coeff lm25066_coeff[][PSC_NUM_CLASSES + 2] = { .R = -2, }, [PSC_CURRENT_IN] = { - .m = 10742, - .b = 1552, + .m = 5456, + .b = 2118, .R = -2, }, [PSC_CURRENT_IN_L] = { - .m = 5456, - .b = 2118, + .m = 10742, + .b = 1552, .R = -2, }, [PSC_POWER] = { - .m = 1204, - .b = 8524, + .m = 612, + .b = 11202, .R = -3, }, [PSC_POWER_L] = { - .m = 612, - .b = 11202, + .m = 1204, + .b = 8524, .R = -3, }, [PSC_TEMPERATURE] = {
@@ -166,23 +166,23 @@ static struct __coeff lm25066_coeff[][PSC_NUM_CLASSES + 2] = { .R = -2, }, [PSC_CURRENT_IN] = { - .m = 10753, - .b = -1200, + .m = 5405, + .b = -600, .R = -2, }, [PSC_CURRENT_IN_L] = { - .m = 5405, - .b = -600, + .m = 10753, + .b = -1200, .R = -2, }, [PSC_POWER] = { - .m = 1204, - .b = -6000, + .m = 605, + .b = -8000, .R = -3, }, [PSC_POWER_L] = { - .m = 605, - .b = -8000, + .m = 1204, + .b = -6000, .R = -3, }, [PSC_TEMPERATURE] = {
@@ -201,23 +201,23 @@ static struct __coeff lm25066_coeff[][PSC_NUM_CLASSES + 2] = { .R = -2, }, [PSC_CURRENT_IN] = { - .m = 15076, - .b = -504, + .m = 7645, + .b = 100, .R = -2, }, [PSC_CURRENT_IN_L] = { - .m = 7645, - .b = 100, + .m = 15076, + .b = -504, .R = -2, }, [PSC_POWER] = { - .m = 1701, - .b = -4000, + .m = 861, + .b = -965, .R = -3, }, [PSC_POWER_L] = { - .m = 861, - .b = -965, + .m = 1701, + .b = -4000, .R = -3, }, [PSC_TEMPERATURE] = {
@@ -492,18 +492,20 @@ static int lm25066_probe(struct i2c_client *client) info->m[PSC_VOLTAGE_OUT ] = coeff[PSC_VOLTAGE_OUT ].m; info->b[PSC_VOLTAGE_OUT ] = coeff[PSC_VOLTAGE_OUT ].b; info->R[PSC_VOLTAGE_OUT ] = coeff[PSC_VOLTAGE_OUT ].R; - info->R[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN ].R; - info->R[PSC_POWER ] = coeff[PSC_POWER ].R;if (config &LM25066_DEV_SETUP_CL ) { info->m[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN_L ].m; info->b[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN_L ].b; + info->R[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN_L ].R; info->m[PSC_POWER ] = coeff[PSC_POWER_L ].m; info->b[PSC_POWER ] = coeff[PSC_POWER_L ].b; + info->R[PSC_POWER ] = coeff[PSC_POWER_L ].R; }else { info->m[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN ].m; info->b[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN ].b; + info->R[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN ].R; info->m[PSC_POWER ] = coeff[PSC_POWER ].m; info->b[PSC_POWER ] = coeff[PSC_POWER ].b; + info->R[PSC_POWER ] = coeff[PSC_POWER ].R; }return pmbus_do_probe (client, info);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 142/752 Bluetooth: L2CAP: validate connectionless PSM length
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samuel Moelius <[email protected]>
[ Upstream commit a40a5f922546b3bd7c094d882b29177db4f2abe0 ]
Connectionless L2CAP frames carry a two-byte PSM at the start of the payload. l2cap_recv_frame() currently reads that PSM unconditionally after validating only the outer L2CAP length.
A malformed connectionless frame with a zero- or one-byte payload can therefore make the parser read beyond the advertised skb payload and use tailroom bytes as part of the PSM. A VHCI-backed QEMU reproducer injected a one-byte connectionless payload and reached the unchecked read.
Reject connectionless frames that cannot contain the PSM before reading or pulling it. This preserves all valid connectionless frames while dropping only structurally incomplete packets.
--- net/bluetooth/l2cap_core.c | 5 +++++ 1 file changed, 5 insertions(+)
net/bluetooth/l2cap_core.c +5 -0
@@ -8054,6 +8054,11 @@ static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb)break ;case L2CAP_CID_CONN_LESS : +if (skb->len <L2CAP_PSMLEN_SIZE ) { +kfree_skb (skb); +break ; + } + psm =get_unaligned ((__le16 *) skb->data);skb_pull (skb,L2CAP_PSMLEN_SIZE );l2cap_conless_channel (conn, psm, skb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 143/752 ASoC: rockchip: rockchip_pdm: Handle runtime PM resume failures in set_fmt
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit ee7b5f7b39332febf917f9ebf212842cc9379815 ]
rockchip_pdm_set_fmt() calls pm_runtime_get_sync() before accessing hardware registers, but ignores its return value.
If the runtime resume fails, the function continues to perform register accesses while the device state is undefined.
Replace pm_runtime_get_sync() with pm_runtime_resume_and_get() and return early on failure to avoid unpowered register accesses.
--- sound/soc/rockchip/rockchip_pdm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/rockchip/rockchip_pdm.c +5 -1
@@ -260,6 +260,7 @@ static int rockchip_pdm_set_fmt(struct snd_soc_dai *cpu_dai, {struct rk_pdm_dev *pdm =to_info (cpu_dai);unsigned int mask =0 , val =0 ; +int ret; mask =PDM_CKP_MSK ;switch (fmt &SND_SOC_DAIFMT_INV_MASK ) {
@@ -273,7 +274,10 @@ static int rockchip_pdm_set_fmt(struct snd_soc_dai *cpu_dai,return -EINVAL ; } -pm_runtime_get_sync (cpu_dai->dev); + ret =pm_runtime_resume_and_get (cpu_dai->dev); +if (ret) +return ret; +regmap_update_bits (pdm->regmap,PDM_CLK_CTRL , mask, val);pm_runtime_put (cpu_dai->dev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 144/752 ASoC: rockchip: rockchip_pdm: Reorder clock enable sequence
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 3168721d6ec3b610edf6a3c22ad190722a27d276 ]
Enable the 'hclk' bus clock before the 'clk' controller clock during runtime resume.
The bus clock provides the register access interface, so enable it before the controller clock. This also makes the resume sequence the reverse of the suspend sequence, which keeps the clock ordering consistent.
--- sound/soc/rockchip/rockchip_pdm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/rockchip/rockchip_pdm.c +5 -5
@@ -364,16 +364,16 @@ static int rockchip_pdm_runtime_resume(struct device *dev)struct rk_pdm_dev *pdm =dev_get_drvdata (dev);int ret; - ret =clk_prepare_enable (pdm->clk); + ret =clk_prepare_enable (pdm->hclk);if (ret) { -dev_err (pdm->dev,"clock enable failed %d\n" , ret); +dev_err (pdm->dev,"hclock enable failed %d\n" , ret);return ret; } - ret =clk_prepare_enable (pdm->hclk); + ret =clk_prepare_enable (pdm->clk);if (ret) { -clk_disable_unprepare (pdm->clk); -dev_err (pdm->dev,"hclock enable failed %d\n" , ret); +clk_disable_unprepare (pdm->hclk); +dev_err (pdm->dev,"clock enable failed %d\n" , ret);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 145/752 ASoC: rockchip: spdif: Restore regcache cache-only mode on sync failure
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 3546e9aa691ac981e4734fedd1646d0180784893 ]
If regcache_sync() fails during runtime resume, the driver disables the clocks and returns an error. However, the regmap cache-only mode is left disabled.
Restore cache-only mode in the error path so subsequent register accesses continue to use the cache while the device is inactive.
--- sound/soc/rockchip/rockchip_spdif.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/rockchip/rockchip_spdif.c +1 -0
@@ -98,6 +98,7 @@ static int __maybe_unused rk_spdif_runtime_resume(struct device *dev) ret =regcache_sync (spdif->regmap);if (ret) { +regcache_cache_only (spdif->regmap, true);clk_disable_unprepare (spdif->mclk);clk_disable_unprepare (spdif->hclk); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 146/752 sparc64: uprobes: add missing break
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 5b0eee4cd812bd6547eea393cb9b5c0322f26c88 ]
Missing fallthrough causes failure with newer compilers:
arch/sparc/kernel/uprobes.c:284:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
284 | default:
| ^
arch/sparc/kernel/uprobes.c:284:2: note: insert 'break;' to avoid fall-through
284 | default:
| ^
| break;--- arch/sparc/kernel/uprobes.c | 1 + 1 file changed, 1 insertion(+)
arch/sparc/kernel/uprobes.c +1 -0
@@ -278,6 +278,7 @@ int arch_uprobe_exception_notify(struct notifier_block *self,case DIE_SSTEP :if (uprobe_post_sstep_notifier (args->regs)) ret =NOTIFY_STOP ; +break ;default :break ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 147/752 net: stmmac: xgmac2: disable RBUE in default RX interrupt mask
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nazim Amirul <[email protected]>
[ Upstream commit d3265c19b35d036bba327b36b5366bee76b0157c ]
Enabling the RX Buffer Unavailable (RBUE) interrupt is counterproductive and can trigger a MAC interrupt storm under heavy RX pressure. When the DMA runs out of RX descriptors it fires RBUE continuously until software refills the ring.
However, RBUE is redundant: the normal RX completion interrupt (RIE) already triggers NAPI, which processes completed descriptors and refills the ring, causing the DMA to resume. The RBUE handler itself only sets handle_rx - the same outcome as RIE.
On Agilex5 under heavy RX pressure, the MAC interrupt (which includes RBUE) was observed firing 1,821,811,555 times against only 2,618,627 actual RX completions - a ~695x ratio - confirming the severity of the storm.
RBUE does not provide OOM recovery. If page_pool is exhausted, stmmac_rx_refill() cannot advance the DMA tail pointer, the DMA stays suspended, and RBUE fires again on the next NAPI completion - a storm with no forward progress. This patch trades that storm for a clean stall with the same RX outcome. Proper OOM recovery is a pre-existing gap outside the scope of this fix.
Note: as a consequence of disabling RBUE, the rx_buf_unav_irq ethtool counter will always read 0 on XGMAC2 devices. This behaviour is already inconsistent across DWMAC core versions.
Remove RBUE from XGMAC_DMA_INT_DEFAULT_EN and XGMAC_DMA_INT_DEFAULT_RX to prevent the interrupt storm while keeping normal RX handling intact.
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +2 -2
@@ -398,9 +398,9 @@#define XGMAC_RIE BIT(6)#define XGMAC_TBUE BIT(2)#define XGMAC_TIE BIT(0) -#define XGMAC_DMA_INT_DEFAULT_EN (XGMAC_NIE | XGMAC_AIE | XGMAC_RBUE | \ +#define XGMAC_DMA_INT_DEFAULT_EN (XGMAC_NIE | XGMAC_AIE | \ XGMAC_RIE | XGMAC_TIE) -#define XGMAC_DMA_INT_DEFAULT_RX (XGMAC_RBUE | XGMAC_RIE) +#define XGMAC_DMA_INT_DEFAULT_RX (XGMAC_RIE)#define XGMAC_DMA_INT_DEFAULT_TX (XGMAC_TIE)#define XGMAC_DMA_CH_Rx_WATCHDOG (x) (0x0000313c + (0x80 * (x)))#define XGMAC_RWT GENMASK(7, 0)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 148/752 ptp: ocp: add shutdown callback
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vadim Fedorenko <[email protected]>
[ Upstream commit f6f955cbf9d4e02deebe54ca91c118b53be9ffe6 ]
The shutdown callback was never implemented for this driver, but it's needed because .remove() callback is never called during kexec/reboot process. That leaves HW with some interrupts enabled and may cause spurious interrupt while booting into a new kernel during with kexec. If it happens that I2C interrupt fires during kexec, the whole I2C bus is disabled leaving TimeCard with no devlink communication. The same happens if timestampers were enabled, leaving the card without timestamper interrupts until full reboot cycle.
Implement .shutdown() callback with the same function as remove callback.
--- drivers/ptp/ptp_ocp.c | 1 + 1 file changed, 1 insertion(+)
drivers/ptp/ptp_ocp.c +1 -0
@@ -1506,6 +1506,7 @@ static struct pci_driver ptp_ocp_driver = { .id_table = ptp_ocp_pcidev_id, .probe = ptp_ocp_probe, .remove = ptp_ocp_remove, + .shutdown = ptp_ocp_remove, }; static int
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 149/752 vsock: use sk_acceptq_is_full() helper in all transports
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Raf Dickson <[email protected]>
[ Upstream commit 4ff2e84ff1b33d79fa0e3ae355ce4a334908ef9a ]
Replace the open-coded backlog check with sk_acceptq_is_full(). The helper uses > instead of >=, which is the correct comparison per commit 64a146513f8f ("[NET]: Revert incorrect accept queue backlog changes."), and adds READ_ONCE() for proper memory ordering.
--- net/vmw_vsock/hyperv_transport.c | 2 +- net/vmw_vsock/vmci_transport.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/vmw_vsock/hyperv_transport.c +1 -1
@@ -314,7 +314,7 @@ static void hvs_open_connection(struct vmbus_channel *chan) goto out;if (conn_from_host) { -if (sk->sk_ack_backlog >= sk->sk_max_ack_backlog) +if (sk_acceptq_is_full (sk)) goto out; new =vsock_create_connected (sk);
net/vmw_vsock/vmci_transport.c +1 -1
@@ -1002,7 +1002,7 @@ static int vmci_transport_recv_listen(struct sock *sk,* reset. Otherwise we create and initialize a child socket and reply * with a connection negotiation. */ -if (sk->sk_ack_backlog >= sk->sk_max_ack_backlog) { +if (sk_acceptq_is_full (sk)) {vmci_transport_reply_reset (pkt);return -ECONNREFUSED ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 150/752 e1000e: limit endianness conversion to boundary words
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Agalakov Daniil <[email protected]>
[ Upstream commit a5ecafcfb27baf2dba766c4fd99dbb947f4e85d8 ]
[Why]
In e1000_set_eeprom(), the eeprom_buff is allocated to hold a range of words. However, only the boundary words (the first and the last) are populated from the EEPROM if the write request is not word-aligned. The words in the middle of the buffer remain uninitialized because they are intended to be completely overwritten by the new data via memcpy().
The previous implementation had a loop that performed le16_to_cpus() on the entire buffer. This resulted in endianness conversion being performed on uninitialized memory for all interior words.
Fix this by converting the endianness only for the boundary words immediately after they are successfully read from the EEPROM.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/ethernet/intel/e1000e/ethtool.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/e1000e/ethtool.c +12 -7
@@ -597,20 +597,25 @@ static int e1000_set_eeprom(struct net_device *netdev,/* need read/modify/write of first changed EEPROM word */ /* only the second byte of the word is being modified */ ret_val =e1000_read_nvm (hw, first_word,1 , &eeprom_buff[0 ]); +if (ret_val) + goto out; + +/* Device's eeprom is always little-endian, word addressable */ +le16_to_cpus (&eeprom_buff[0 ]); + ptr++; } -if (((eeprom->offset + eeprom->len) &1 ) && (!ret_val)) +if ((eeprom->offset + eeprom->len) &1 ) {/* need read/modify/write of last changed EEPROM word */ /* only the first byte of the word is being modified */ ret_val =e1000_read_nvm (hw, last_word,1 , &eeprom_buff[last_word - first_word]); +if (ret_val) + goto out; -if (ret_val) - goto out; - -/* Device's eeprom is always little-endian, word addressable */ -for (i =0 ; i < last_word - first_word +1 ; i++) -le16_to_cpus (&eeprom_buff[i]); +/* Device's eeprom is always little-endian, word addressable */ +le16_to_cpus (&eeprom_buff[last_word - first_word]); + }memcpy (ptr, bytes, eeprom->len);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 151/752 net/sched: act_csum: dont mangle UDP tunnel GSO packets
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alice Mikityanska <[email protected]>
[ Upstream commit 9bcb30b389ec5888590cb6ec58c7a3b80fe49a11 ]
Similar to commit add641e7dee3 ("sched: act_csum: don't mangle TCP and UDP GSO packets"), UDP tunnel GSO packets going through act_csum shouldn't have their checksum calculated at this point, because it will be done after segmentation. Setting the checksum in act_csum modifies skb->ip_summed and prevents inner IP csum offload from kicking in, resulting in a packet with a bad checksum.
Add UDP tunnel GSO packets to the exceptions, and also add UDP GSO (SKB_GSO_UDP_L4), as the same logic as in the commit mentioned above applies to UDP GSO too.
--- net/sched/act_csum.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/sched/act_csum.c +6 -2
@@ -257,7 +257,9 @@ static int tcf_csum_ipv4_udp(struct sk_buff *skb, unsigned int ihl,const struct iphdr *iph;u16 ul; -if (skb_is_gso (skb) &&skb_shinfo (skb)->gso_type &SKB_GSO_UDP ) +if (skb_is_gso (skb) &&skb_shinfo (skb)->gso_type & + (SKB_GSO_UDP |SKB_GSO_UDP_L4 | +SKB_GSO_UDP_TUNNEL |SKB_GSO_UDP_TUNNEL_CSUM ))return 1 ;/*
@@ -313,7 +315,9 @@ static int tcf_csum_ipv6_udp(struct sk_buff *skb, unsigned int ihl,const struct ipv6hdr *ip6h;u16 ul; -if (skb_is_gso (skb) &&skb_shinfo (skb)->gso_type &SKB_GSO_UDP ) +if (skb_is_gso (skb) &&skb_shinfo (skb)->gso_type & + (SKB_GSO_UDP |SKB_GSO_UDP_L4 | +SKB_GSO_UDP_TUNNEL |SKB_GSO_UDP_TUNNEL_CSUM ))return 1 ;/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 152/752 i3c: mipi-i3c-hci: Tolerate i3c_master_add_i3c_dev_locked() failures in DAA
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
[ Upstream commit c236563c8a84239d31a1e6ec4444887a7b5ed98f ]
i3c_master_add_i3c_dev_locked() no longer leaves the address marked as free on failure, so aborting the DAA sequence on its error is unnecessary.
Failure to register a discovered device does not invalidate the entire Dynamic Address Assignment (DAA) procedure. Align with the behavior of other I3C master drivers by ignoring errors from i3c_master_add_i3c_dev_locked() and continuing enumeration.
--- drivers/i3c/master/mipi-i3c-hci/cmd_v1.c | 4 +--- drivers/i3c/master/mipi-i3c-hci/cmd_v2.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/i3c/master/mipi-i3c-hci/cmd_v1.c +1 -3
@@ -359,9 +359,7 @@ static int hci_cmd_v1_daa(struct i3c_hci *hci)* TODO: Extend the subsystem layer to allow for registering * new device and provide BCR/DCR/PID at the same time. */ - ret =i3c_master_add_i3c_dev_locked (&hci->master, next_addr); -if (ret) -break ; +i3c_master_add_i3c_dev_locked (&hci->master, next_addr); }if (dat_idx >=0 )
drivers/i3c/master/mipi-i3c-hci/cmd_v2.c +1 -3
@@ -299,9 +299,7 @@ static int hci_cmd_v2_daa(struct i3c_hci *hci)* TODO: Extend the subsystem layer to allow for registering * new device and provide BCR/DCR/PID at the same time. */ - ret =i3c_master_add_i3c_dev_locked (&hci->master, next_addr); -if (ret) -break ; +i3c_master_add_i3c_dev_locked (&hci->master, next_addr); }hci_free_xfer (xfer,2 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 153/752 sparc: Disable compat support with LLD
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 852fed2e8bfe195351fb0078ba7245d41154e7a5 ]
An LLVM=1 sparc64 allmodconfig enables COMPAT and then tries to build the 32-bit vDSO. That path cannot be linked with ld.lld:
ld.lld: error: unknown emulation: elf32_sparc
ld.lld does not support the 32-bit SPARC ELF emulation used for the compat vDSO, so keep COMPAT disabled when LLD is the linker. This avoids selecting an unsupported build path while leaving the existing GNU ld configuration unchanged.
--- arch/sparc/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/sparc/Kconfig +1 -0
@@ -489,6 +489,7 @@ endmenu config COMPAT bool depends on SPARC64 + depends on !LD_IS_LLD default y select HAVE_UID16 select ARCH_WANT_OLD_COMPAT_IPC
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 154/752 fuse: set ff->flock only on success
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Tianci <[email protected]>
[ Upstream commit 71947173cef279be5eed209ec28f8c11f9d73159 ]
If FUSE_SETLK fails (e.g., due to EWOULDBLOCK), we shall not set FUSE_RELEASE_FLOCK_UNLOCK in fuse_file_release().
--- fs/fuse/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/fuse/file.c +2 -1
@@ -2610,8 +2610,9 @@ static int fuse_file_flock(struct file *file, int cmd, struct file_lock *fl)struct fuse_file *ff = file->private_data;/* emulate flock with POSIX locks */ - ff->flock = true; err =fuse_setlk (file, fl,1 ); +if (!err) + ff->flock = true; }return err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 155/752 scsi: bfa: Reduce kernel stack usage in bfa_fcs_lport_fdmi_build_portattr_block()
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 57a6ed0b41677ccc5e28cc0976e495c1dfa33747 ]
bfa_fcs_fdmi_get_portattr() gets inlined into multiple places and has two fairly large variables on the stack, to the point of causing a warning in some randconfig builds:
drivers/scsi/bfa/bfa_fcs_lport.c:2198:1: error: stack frame size (1560) exceeds limit (1280) in 'bfa_fcs_lport_fdmi_build_portattr_block' [-Werror,-Wframe-larger-than]
2198 | bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi,
| ^
drivers/scsi/bfa/bfa_fcs_lport.c:1856:1: error: stack frame size (1600) exceeds limit (1280) in 'bfa_fcs_lport_fdmi_build_rhba_pyld' [-Werror,-Wframe-larger-than]
1856 | bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
| ^Mark the inner function as noinline_for_stack to keep it separate from the other variables and prevent multiple copies of the same variable to get inlined here.
--- drivers/scsi/bfa/bfa_fcs_lport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/bfa/bfa_fcs_lport.c +1 -1
@@ -2673,7 +2673,7 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, } -static void +static noinline_for_stack voidbfa_fcs_fdmi_get_portattr (struct bfa_fcs_lport_fdmi_s *fdmi,struct bfa_fcs_fdmi_port_attr_s *port_attr) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 156/752 gpio: pisosr: Read "ngpios" as u32
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Herring (Arm) <[email protected]>
[ Upstream commit 4910aa198d25e5d1067236560ba34ab12bccc677 ]
The generic "ngpios" property is encoded as a normal uint32 cell. The pisosr driver stores it in the gpio_chip field, but reading it with a u16 helper does not match the DT property encoding.
Read "ngpios" as u32 and keep the existing assignment to the chip field.
--- drivers/gpio/gpio-pisosr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/gpio-pisosr.c +3 -1
@@ -128,6 +128,7 @@ static int pisosr_gpio_probe(struct spi_device *spi) {struct device *dev = &spi->dev;struct pisosr_gpio *gpio; +u32 ngpios;int ret; gpio =devm_kzalloc (dev,sizeof (*gpio),GFP_KERNEL );
@@ -138,7 +139,8 @@ static int pisosr_gpio_probe(struct spi_device *spi) gpio->chip = template_chip; gpio->chip.parent = dev; -of_property_read_u16 (dev->of_node,"ngpios" , &gpio->chip.ngpio); +if (!of_property_read_u32 (dev->of_node,"ngpios" , &ngpios)) + gpio->chip.ngpio = ngpios; gpio->spi = spi;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 157/752 spi: Add NULL check for spi_get_device_id() in spi_get_device_match_data()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: guoqi0226 <[email protected]>
[ Upstream commit f1b061b4d4c6cbf861319ba954caa80145cf018f ]
Prevent NULL pointer dereference when spi_get_device_id() returns NULL, which can happen when using driver_override without matching SPI ID entry.
--- drivers/spi/spi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/spi/spi.c +5 -1
@@ -338,12 +338,16 @@ EXPORT_SYMBOL_GPL(spi_get_device_id);const void *spi_get_device_match_data (const struct spi_device *sdev) {const void *match; +const struct spi_device_id *id; match =device_get_match_data (&sdev->dev);if (match)return match; -return (const void *)spi_get_device_id (sdev)->driver_data; + id =spi_get_device_id (sdev); +if (!id) +return NULL ; +return (const void *)id->driver_data; }EXPORT_SYMBOL_GPL (spi_get_device_match_data);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 158/752 ALSA: hda/conexant: Add pin config quirk for Lenovo IdeaPad Slim 5 16AKP10
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Galen Hassen <[email protected]>
[ Upstream commit f7c4968ae3af3e819428da5416c2dfd361473f5c ]
The Lenovo IdeaPad Slim 5 16AKP10 (PCI SSID 17aa:38b6) uses the Conexant SN6140 codec. The internal microphone is on pin 0x1a but the BIOS configures it with pin default 0x95a60120, which includes a jack detection bit that causes the kernel to treat it as an unplugged external mic rather than a fixed internal mic.
Add a pin config quirk that overrides pin 0x1a to 0x95a60130, setting the connectivity bits to indicate a fixed/always-connected device. This allows the internal microphone to be correctly identified and used.
--- sound/pci/hda/patch_conexant.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/pci/hda/patch_conexant.c +12 -0
@@ -307,6 +307,7 @@ enum {CXT_FIXUP_HEADSET_MIC ,CXT_FIXUP_HP_MIC_NO_PRESENCE ,CXT_PINCFG_SWS_JS201D , +CXT_PINCFG_LENOVO_IDEAPAD_SLIM5_16AKP10 ,CXT_PINCFG_TOP_SPEAKER ,CXT_FIXUP_HP_A_U , CXT_FIXUP_ACER_SWIFT_HP,
@@ -841,6 +842,12 @@ static const struct hda_pintbl cxt_pincfg_lemote[] = { {} }; +/* Lenovo IdeaPad Slim 5 16AKP10 with SN6140 */ +static const struct hda_pintbl cxt_pincfg_lenovo_ideapad_slim5_16akp10[] = { + {0x1a ,0x95a60130 },/* Internal mic, fixed/always-connected */ + {} +}; +/* SuoWoSi/South-holding JS201D with sn6140 */ static const struct hda_pintbl cxt_pincfg_sws_js201d[] = { {0x16 ,0x03211040 },/* hp out */
@@ -1032,6 +1039,10 @@ static const struct hda_fixup cxt_fixups[] = { .type = HDA_FIXUP_PINS, .v.pins = cxt_pincfg_sws_js201d, }, + [CXT_PINCFG_LENOVO_IDEAPAD_SLIM5_16AKP10] = { + .type = HDA_FIXUP_PINS, + .v.pins = cxt_pincfg_lenovo_ideapad_slim5_16akp10, + }, [CXT_PINCFG_TOP_SPEAKER] = { .type = HDA_FIXUP_FUNC, .v.func = cxt_fixup_sirius_top_speaker,
@@ -1137,6 +1148,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {SND_PCI_QUIRK (0x17aa ,0x21da ,"Lenovo X220" ,CXT_PINCFG_LENOVO_TP410 ),SND_PCI_QUIRK (0x17aa ,0x21db ,"Lenovo X220-tablet" ,CXT_PINCFG_LENOVO_TP410 ),SND_PCI_QUIRK (0x17aa ,0x38af ,"Lenovo IdeaPad Z560" ,CXT_FIXUP_MUTE_LED_EAPD ), +SND_PCI_QUIRK (0x17aa ,0x38b6 ,"Lenovo IdeaPad Slim 5 16AKP10" ,CXT_PINCFG_LENOVO_IDEAPAD_SLIM5_16AKP10 ),SND_PCI_QUIRK (0x17aa ,0x3905 ,"Lenovo G50-30" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK (0x17aa ,0x390b ,"Lenovo G50-80" ,CXT_FIXUP_STEREO_DMIC ), SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 159/752 leds: uleds: Return -EFAULT on copy_to_user() failure
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yousef Alhouseen <[email protected]>
[ Upstream commit 61ed78f55a46e12afd4b464c4ba736f55ff33c5e ]
uleds_read() copies the current brightness value to userspace but ignores copy_to_user() failures. It then clears the pending update and reports a successful full read even when no data was copied.
Return -EFAULT when the copy fails and leave the update pending so a later read can retry.
--- drivers/leds/uleds.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/leds/uleds.c +7 -4
@@ -148,10 +148,13 @@ static ssize_t uleds_read(struct file *file, char __user *buffer, size_t count, }else if (!udev->new_data && (file->f_flags &O_NONBLOCK )) { retval = -EAGAIN ; }else if (udev->new_data) { - retval =copy_to_user (buffer, &udev->brightness, -sizeof (udev->brightness)); - udev->new_data = false; - retval =sizeof (udev->brightness); +if (copy_to_user (buffer, &udev->brightness, +sizeof (udev->brightness))) { + retval = -EFAULT ; + }else { + udev->new_data = false; + retval =sizeof (udev->brightness); + } }mutex_unlock (&udev->mutex);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 160/752 leds: pca9532: Dont stop blinking for non-zero brightness
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tobias Deiminger <[email protected]>
[ Upstream commit 0261683a4d31783d680e74b3ae5f22f6a62128cc ]
pca9532 unexpectedly stopped blinking when changing brightness to a non-zero value. To reproduce:
echo timer > /sys/class/leds/led-1/trigger # blinks echo 255 > /sys/class/leds/led-1/brightness # blinking stops, light on cat /sys/class/leds/led-1/trigger # still claims [timer]
According to Documentation/leds/leds-class.rst, only brightness = 0 shall be a stop condition:
Quoted 3 lines
You can change the brightness value of a LED independently of the timer trigger. However, if you set the brightness value to
LED_OFFit will also disable the timer trigger.
Therefore add a guard to continue blinking when brightness != LED_OFF, similar to how pca955x does it since 575f10dc64a2 ("leds: pca955x: Add HW blink support").
--- drivers/leds/leds-pca9532.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/leds/leds-pca9532.c +5 -3
@@ -177,11 +177,13 @@ static int pca9532_set_brightness(struct led_classdev *led_cdev,int err =0 ;struct pca9532_led *led =ldev_to_led (led_cdev); -if (value ==LED_OFF ) +if (value ==LED_OFF ) { led->state =PCA9532_OFF ; -else if (value ==LED_FULL ) + }else if (led->state ==PCA9532_PWM1 ) { +return 0 ;/* Non-zero brightness shall not stop HW blinking */ + }else if (value ==LED_FULL ) { led->state =PCA9532_ON ; -else { + }else { led->state =PCA9532_PWM0 ;/* Thecus: hardcode one pwm */ err =pca9532_calcpwm (led->client,0 ,0 , value);if (err)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 161/752 mfd: rsmu: Add 8a34002 support
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Bystrin <[email protected]>
[ Upstream commit d18fd55c780c2bae3d353024cab7f8746d3d9e91 ]
Add compatible string, i2c_devcie_id and spi_devcie_id to support 8a34002.
--- drivers/mfd/rsmu_i2c.c | 2 ++ drivers/mfd/rsmu_spi.c | 2 ++ 2 files changed, 4 insertions(+)
drivers/mfd/rsmu_i2c.c +2 -0
@@ -158,6 +158,7 @@ static int rsmu_i2c_remove(struct i2c_client *client)static const struct i2c_device_id rsmu_i2c_id[] = { {"8a34000" ,RSMU_CM }, {"8a34001" ,RSMU_CM }, + {"8a34002" ,RSMU_CM }, {"82p33810" ,RSMU_SABRE }, {"82p33811" ,RSMU_SABRE }, {"8v19n850" ,RSMU_SL },
@@ -169,6 +170,7 @@ MODULE_DEVICE_TABLE(i2c, rsmu_i2c_id);static const struct of_device_id rsmu_i2c_of_match[] = { { .compatible ="idt,8a34000" , .data = (void *)RSMU_CM }, { .compatible ="idt,8a34001" , .data = (void *)RSMU_CM }, + { .compatible ="idt,8a34002" , .data = (void *)RSMU_CM }, { .compatible ="idt,82p33810" , .data = (void *)RSMU_SABRE }, { .compatible ="idt,82p33811" , .data = (void *)RSMU_SABRE }, { .compatible ="idt,8v19n850" , .data = (void *)RSMU_SL },
drivers/mfd/rsmu_spi.c +2 -0
@@ -232,6 +232,7 @@ static int rsmu_spi_remove(struct spi_device *client)static const struct spi_device_id rsmu_spi_id[] = { {"8a34000" ,RSMU_CM }, {"8a34001" ,RSMU_CM }, + {"8a34002" ,RSMU_CM }, {"82p33810" ,RSMU_SABRE }, {"82p33811" ,RSMU_SABRE }, {}
@@ -241,6 +242,7 @@ MODULE_DEVICE_TABLE(spi, rsmu_spi_id);static const struct of_device_id rsmu_spi_of_match[] = { { .compatible ="idt,8a34000" , .data = (void *)RSMU_CM }, { .compatible ="idt,8a34001" , .data = (void *)RSMU_CM }, + { .compatible ="idt,8a34002" , .data = (void *)RSMU_CM }, { .compatible ="idt,82p33810" , .data = (void *)RSMU_SABRE }, { .compatible ="idt,82p33811" , .data = (void *)RSMU_SABRE }, {}
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 162/752 ALSA: usb-audio: Add quirk for YAMAHA CDS3000
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Louis Colaco <[email protected]>
[ Upstream commit 348f69320e4db6ebec6940c81154bec4b9eb275a ]
This quirk is identical to the one for the Yamaha Steinberg UR22, here applied to a CD player that also uses the Steinberg USB interface. This quirk is necessary to avoid sporadic "clic" noise when using the DAC of the player.
--- sound/usb/quirks-table.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
sound/usb/quirks-table.h +14 -0
@@ -484,6 +484,20 @@ YAMAHA_DEVICE(0x105d, NULL), } } }, +{ +USB_DEVICE (0x0499 ,0x150d ), + QUIRK_DRIVER_INFO { +/* .vendor_name = "Yamaha", */ +/* .product_name = "CDS3000", */ + QUIRK_DATA_COMPOSITE { + { QUIRK_DATA_STANDARD_AUDIO(1) }, + { QUIRK_DATA_STANDARD_AUDIO(2) }, + { QUIRK_DATA_MIDI_YAMAHA(3) }, + { QUIRK_DATA_IGNORE(4) }, + QUIRK_COMPOSITE_END + } + } +}, {USB_DEVICE (0x0499 ,0x1718 ), QUIRK_DRIVER_INFO {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 163/752 PCI: iproc: Protect root bus removal with rescan lock
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Zhang <[email protected]>
[ Upstream commit a6a64e150f12ad5391e0a0d60f6a3d119b06ce50 ]
Hold the pci_rescan_remove_lock lock while stopping and removing a root bus to avoid racing with concurrent rescan or hotplug operations triggered via sysfs. Such races may lead to use-after-free issues or system crashes.
--- drivers/pci/controller/pcie-iproc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/controller/pcie-iproc.c +2 -0
@@ -1545,8 +1545,10 @@ int iproc_pcie_remove(struct iproc_pcie *pcie) {struct pci_host_bridge *host =pci_host_bridge_from_priv (pcie); +pci_lock_rescan_remove ();pci_stop_root_bus (host->bus);pci_remove_root_bus (host->bus); +pci_unlock_rescan_remove ();iproc_pcie_msi_disable (pcie);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 164/752 PCI: altera: Protect root bus removal with rescan lock
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Zhang <[email protected]>
[ Upstream commit a8759c8ac48c0419f5899e95a6ffc611b07c965b ]
Hold the pci_rescan_remove_lock lock while stopping and removing a root bus to avoid racing with concurrent rescan or hotplug operations triggered via sysfs. Such races may lead to use-after-free issues or system crashes.
--- drivers/pci/controller/pcie-altera.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/controller/pcie-altera.c +2 -0
@@ -835,8 +835,10 @@ static int altera_pcie_remove(struct platform_device *pdev)struct altera_pcie *pcie =platform_get_drvdata (pdev);struct pci_host_bridge *bridge =pci_host_bridge_from_priv (pcie); +pci_lock_rescan_remove ();pci_stop_root_bus (bridge->bus);pci_remove_root_bus (bridge->bus); +pci_unlock_rescan_remove ();altera_pcie_irq_teardown (pcie);return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 165/752 PCI: rockchip: Protect root bus removal with rescan lock
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Zhang <[email protected]>
[ Upstream commit 0bd9611587bb494c33566d825fe34b2705e4b167 ]
Hold the pci_rescan_remove_lock lock while stopping and removing a root bus to avoid racing with concurrent rescan or hotplug operations triggered via sysfs. Such races may lead to use-after-free issues or system crashes.
--- drivers/pci/controller/pcie-rockchip-host.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/controller/pcie-rockchip-host.c +2 -0
@@ -1018,8 +1018,10 @@ static int rockchip_pcie_remove(struct platform_device *pdev)struct rockchip_pcie *rockchip =dev_get_drvdata (dev);struct pci_host_bridge *bridge =pci_host_bridge_from_priv (rockchip); +pci_lock_rescan_remove ();pci_stop_root_bus (bridge->bus);pci_remove_root_bus (bridge->bus); +pci_unlock_rescan_remove ();irq_domain_remove (rockchip->irq_domain);rockchip_pcie_deinit_phys (rockchip);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 166/752 PCI: mediatek: Protect root bus removal with rescan lock
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Zhang <[email protected]>
[ Upstream commit a29812a55da8d0dbeb071b26ac428c338e3fc389 ]
Hold the pci_rescan_remove_lock lock while stopping and removing a root bus to avoid racing with concurrent rescan or hotplug operations triggered via sysfs. Such races may lead to use-after-free issues or system crashes.
--- drivers/pci/controller/pcie-mediatek.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/controller/pcie-mediatek.c +2 -0
@@ -1179,8 +1179,10 @@ static int mtk_pcie_remove(struct platform_device *pdev)struct mtk_pcie *pcie =platform_get_drvdata (pdev);struct pci_host_bridge *host =pci_host_bridge_from_priv (pcie); +pci_lock_rescan_remove ();pci_stop_root_bus (host->bus);pci_remove_root_bus (host->bus); +pci_unlock_rescan_remove ();mtk_pcie_free_resources (pcie);mtk_pcie_irq_teardown (pcie);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 167/752 md/raid5: account discard IO
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit 74ddbf98e2db646ec58f7e7731c936b7a4a470fe ]
Raid5 handles discard bios internally through make_discard_request() and never passes them through md_account_bio(). As a result, discard IO is missing the md-device iostat accounting that normal raid5 IO and discard IO in other raid levels get from md_account_bio().
Before accounting the bio, trim the request to the full data stripes that raid5 will actually discard. The first full stripe is the ceiling of the bio start divided by data-stripe sectors, and the last full stripe is the floor of the bio end divided by data-stripe sectors. Account that exact MD logical full-stripe range, then restore the original iterator so bio completion and iostat still cover the original request.
--- drivers/md/raid5.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-)
drivers/md/raid5.c +23 -10
@@ -5679,26 +5679,39 @@ static void make_discard_request(struct mddev *mddev, struct bio *bi) {struct r5conf *conf = mddev->private;sector_t logical_sector, last_sector; +sector_t first_stripe, last_stripe;struct stripe_head *sh; +struct bvec_iter bi_iter; +struct bio *orig_bi = bi;int stripe_sectors;if (mddev->reshape_position != MaxSector)/* Skip discard while reshape is happening */ return ; - logical_sector = bi->bi_iter.bi_sector & ~((sector_t )RAID5_STRIPE_SECTORS (conf)-1 ); - last_sector =bio_end_sector (bi); - - bi->bi_next =NULL ; - stripe_sectors = conf->chunk_sectors * (conf->raid_disks - conf->max_degraded); - logical_sector =DIV_ROUND_UP_SECTOR_T (logical_sector, - stripe_sectors); -sector_div (last_sector, stripe_sectors); + first_stripe =DIV_ROUND_UP_SECTOR_T (bi->bi_iter.bi_sector, + stripe_sectors); + last_stripe =bio_end_sector (bi); +sector_div (last_stripe, stripe_sectors); + +if (first_stripe >= last_stripe) { +bio_endio (bi); +return ; + } + + bi_iter = bi->bi_iter; + bi->bi_iter.bi_sector = first_stripe * stripe_sectors; + bi->bi_iter.bi_size = ((last_stripe - first_stripe) * + stripe_sectors) <<9 ; +md_account_bio (mddev, &bi); + orig_bi->bi_iter = bi_iter; + bi->bi_iter = bi_iter; + bi->bi_next =NULL ; - logical_sector *= conf->chunk_sectors; - last_sector *= conf->chunk_sectors; + logical_sector = first_stripe * conf->chunk_sectors; + last_sector = last_stripe * conf->chunk_sectors;for (; logical_sector < last_sector; logical_sector +=RAID5_STRIPE_SECTORS (conf)) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 168/752 md/raid5: let stripe batch bm_seq comparison wrap-safe
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Cheng <[email protected]>
[ Upstream commit 00e93faf4cea9e8802ac5dfee0952d84fc95c40f ]
Once the 32-bit seq wraps, a newer bm_seq can look smaller than old, so .. covert to wrap-safe calculate way.
--- drivers/md/raid5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid5.c +1 -1
@@ -911,7 +911,7 @@ static void stripe_add_to_batch_list(struct r5conf *conf, struct stripe_head *shif (test_and_clear_bit (STRIPE_BIT_DELAY , &sh->state)) {int seq = sh->bm_seq;if (test_bit (STRIPE_BIT_DELAY , &sh->batch_head->state) && - sh->batch_head->bm_seq > seq) + sh->batch_head->bm_seq - seq >0 ) seq = sh->batch_head->bm_seq;set_bit (STRIPE_BIT_DELAY , &sh->batch_head->state); sh->batch_head->bm_seq = seq;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 169/752 f2fs: validate inline dentry name lengths before conversion
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samuel Moelius <[email protected]>
[ Upstream commit cfcd0e49a178b3dac2c0ece656079081dbf5da74 ]
Inline dentry conversion copies names out of the inline dentry area before checking that each recorded name length fits in the available filename slots.
A corrupted image can therefore make the conversion path read past the inline filename storage while building the regular dentry block.
Validate each inline dentry name length against the inline filename area before copying it.
--- fs/f2fs/inline.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/f2fs/inline.c +7 -0
@@ -488,6 +488,12 @@ static int f2fs_add_inline_entries(struct inode *dir, void *inline_dentry) bit_pos++;continue ; } +if (unlikely (le16_to_cpu (de->name_len) >F2FS_NAME_LEN || + bit_pos +GET_DENTRY_SLOTS (le16_to_cpu (de->name_len)) > + d.max)) { + err = -EFSCORRUPTED ; + goto punch_dentry_pages; + }/* * We only need the disk_name and hash to move the dentry.
@@ -508,6 +514,7 @@ static int f2fs_add_inline_entries(struct inode *dir, void *inline_dentry) bit_pos +=GET_DENTRY_SLOTS (le16_to_cpu (de->name_len)); }return 0 ; + punch_dentry_pages:truncate_inode_pages (&dir->i_data,0 );f2fs_truncate_blocks (dir,0 , false);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 170/752 rtc: aspeed: add AST2700 compatible
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tommy Huang <[email protected]>
[ Upstream commit 3319cfeeb8c4047026f84df045c438f7bbd338a6 ]
Add support for matching the RTC controller on ASPEED AST2700 SoCs.
The AST2700 RTC controller is compatible with the existing ASPEED RTC driver implementation.
--- drivers/rtc/rtc-aspeed.c | 1 + 1 file changed, 1 insertion(+)
drivers/rtc/rtc-aspeed.c +1 -0
@@ -111,6 +111,7 @@ static const struct of_device_id aspeed_rtc_match[] = { { .compatible = "aspeed,ast2400-rtc", }, { .compatible = "aspeed,ast2500-rtc", }, { .compatible = "aspeed,ast2600-rtc", }, + { .compatible = "aspeed,ast2700-rtc", }, {} }; MODULE_DEVICE_TABLE(of, aspeed_rtc_match);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 171/752 ksmbd: use connection ClientGUID for lease lookup
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit fa111daae1a02dbff5693dfc12f368bccd9eb5f4 ]
MS-SMB2 defines the lease table lookup key as Connection.ClientGuid. Use the connection ClientGUID consistently when checking for same-client leases and duplicate lease keys.
Also preserve directory and parent lease metadata when copying an existing lease state to a new open.
--- fs/ksmbd/oplock.c | 16 +++++++++------- fs/ksmbd/oplock.h | 2 +- fs/ksmbd/smb2pdu.c | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-)
fs/ksmbd/oplock.c +9 -7
@@ -510,7 +510,7 @@ static inline int compare_guid_key(struct oplock_info *opinfo,* Return: oplock(lease) object on success, otherwise NULL */ static struct oplock_info *same_client_has_lease (struct ksmbd_inode *ci, -char *client_guid, +const char *client_guid,struct lease_ctx_info *lctx) {int ret;
@@ -981,7 +981,7 @@ void destroy_lease_table(struct ksmbd_conn *conn)write_unlock (&lease_list_lock); } -int find_same_lease_key (struct ksmbd_session *sess,struct ksmbd_inode *ci, +int find_same_lease_key (struct ksmbd_conn *conn,struct ksmbd_inode *ci,struct lease_ctx_info *lctx) {struct oplock_info *opinfo;
@@ -998,7 +998,7 @@ int find_same_lease_key(struct ksmbd_session *sess, struct ksmbd_inode *ci, }list_for_each_entry (lb, &lease_table_list, l_entry) { -if (!memcmp (lb->client_guid, sess->ClientGUID, +if (!memcmp (lb->client_guid, conn->ClientGUID,SMB2_CLIENT_GUID_SIZE )) goto found; }
@@ -1014,7 +1014,7 @@ int find_same_lease_key(struct ksmbd_session *sess, struct ksmbd_inode *ci,rcu_read_unlock ();if (opinfo->o_fp->f_ci == ci) goto op_next; - err =compare_guid_key (opinfo, sess->ClientGUID, + err =compare_guid_key (opinfo, conn->ClientGUID, lctx->lease_key);if (err) { err = -EINVAL ;
@@ -1047,6 +1047,9 @@ static void copy_lease(struct oplock_info *op1, struct oplock_info *op2) lease2->flags = lease1->flags; lease2->epoch = lease1->epoch; lease2->version = lease1->version; + lease2->is_dir = lease1->is_dir; +memcpy (lease2->parent_lease_key, lease1->parent_lease_key, +SMB2_LEASE_KEY_SIZE ); }static int add_lease_global_list (struct oplock_info *opinfo)
@@ -1195,7 +1198,6 @@ int smb_grant_oplock(struct ksmbd_work *work, int req_op_level, u64 pid, struct ksmbd_file *fp, __u16 tid, struct lease_ctx_info *lctx, int share_ret) { - struct ksmbd_session *sess = work->sess; int err = 0;struct oplock_info *opinfo =NULL , *prev_opinfo =NULL ;struct ksmbd_inode *ci = fp->f_ci;
@@ -1235,12 +1237,12 @@ int smb_grant_oplock(struct ksmbd_work *work, int req_op_level, u64 pid,struct oplock_info *m_opinfo;/* is lease already granted ? */ - m_opinfo =same_client_has_lease (ci, sess->ClientGUID, + m_opinfo =same_client_has_lease (ci, work->conn->ClientGUID, lctx);if (m_opinfo) {copy_lease (m_opinfo, opinfo);if (atomic_read (&m_opinfo->breaking_cnt)) - opinfo->o_lease->flags = + opinfo->o_lease->flags |=SMB2_LEASE_FLAG_BREAK_IN_PROGRESS_LE ;opinfo_put (m_opinfo); goto out;
fs/ksmbd/oplock.h +1 -1
@@ -124,7 +124,7 @@ void create_posix_rsp_buf(char *cc, struct ksmbd_file *fp);struct create_context *smb2_find_context_vals (void *open_req,const char *tag,int tag_len);struct oplock_info *lookup_lease_in_table (struct ksmbd_conn *conn,char *lease_key); -int find_same_lease_key (struct ksmbd_session *sess,struct ksmbd_inode *ci, +int find_same_lease_key (struct ksmbd_conn *conn,struct ksmbd_inode *ci,struct lease_ctx_info *lctx);void destroy_lease_table (struct ksmbd_conn *conn); void smb_send_parent_lease_break_noti(struct ksmbd_file *fp,
fs/ksmbd/smb2pdu.c +1 -1
@@ -3269,7 +3269,7 @@ int smb2_open(struct ksmbd_work *work)ksmbd_debug (SMB ,"lease req for(%s) req oplock state 0x%x, lease state 0x%x\n" , name, req_op_level, lc->req_state); - rc =find_same_lease_key (sess, fp->f_ci, lc); + rc =find_same_lease_key (conn, fp->f_ci, lc);if (rc) goto err_out1; } else if (open_flags == O_RDONLY &&
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 172/752 ksmbd: treat unnamed DATA stream as base file
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 171b5d72dd80f99271c073c6e38d5263687c3b6d ]
The SMB path suffix :: names the unnamed data stream of the base file, not an alternate data stream backed by a DosStream xattr.
Canonicalize an empty stream name with an explicit type to a NULL stream name after parsing. This keeps the base filename produced by strsep() and lets open continue through the normal base-file path instead of looking for a non-existent empty stream xattr.
--- fs/ksmbd/misc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
fs/ksmbd/misc.c +11 -3
@@ -121,7 +121,9 @@ int parse_stream_name(char *filename, char **stream_name, int *s_type)char *stream_type;char *s_name;int rc =0 ; +bool has_stream_type = false; + *stream_name =NULL ; s_name = filename; filename =strsep (&s_name,":" );ksmbd_debug (SMB ,"filename : %s, streams : %s\n" , filename, s_name);
@@ -137,14 +139,20 @@ int parse_stream_name(char *filename, char **stream_name, int *s_type)ksmbd_debug (SMB ,"stream name : %s, stream type : %s\n" , s_name, stream_type); -if (!strncasecmp ("$data" , stream_type,5 )) +if (!strncasecmp ("$data" , stream_type,5 )) { *s_type =DATA_STREAM ; -else if (!strncasecmp ("$index_allocation" , stream_type,17 )) + has_stream_type = true; + }else if (!strncasecmp ("$index_allocation" , stream_type,17 )) { *s_type =DIR_STREAM ; -else + has_stream_type = true; + }else { rc = -ENOENT ; + } } +if (has_stream_type && !s_name[0 ] && *s_type ==DATA_STREAM ) + goto out; + *stream_name = s_name; out:return rc;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 173/752 ksmbd: apply create security descriptor first
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit ba3cf6ee4f0eacc1f8c607b80188e3b32ef5e0e3 ]
smb2.create.aclfile creates files with an SMB2_CREATE_SD_BUFFER create context and expects the resulting security descriptor to match the descriptor supplied by the client.
ksmbd currently tries to inherit the parent DACL first and only parses the SMB2_CREATE_SD_BUFFER context when DACL inheritance fails. If inheritance succeeds, the explicit security descriptor supplied on create is ignored. This breaks create requests that include owner/group information in the security descriptor.
Apply the create security descriptor first when the context is present. Fall back to the existing inherited/default ACL path only when no create security descriptor was supplied.
--- fs/ksmbd/smb2pdu.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
fs/ksmbd/smb2pdu.c +9 -7
@@ -3143,14 +3143,16 @@ int smb2_open(struct ksmbd_work *work)if (posix_acl_rc)ksmbd_debug (SMB ,"inherit posix acl failed : %d\n" , posix_acl_rc); -if (test_share_config_flag (work->tcon->share_conf, -KSMBD_SHARE_FLAG_ACL_XATTR )) { - rc =smb_inherit_dacl (conn, &path, sess->user->uid, - sess->user->gid); - } + rc =smb2_create_sd_buffer (work, req, &path); +if (rc && rc != -ENOENT ) + goto err_out; -if (rc) { - rc =smb2_create_sd_buffer (work, req, &path); +if (rc == -ENOENT ) { +if (test_share_config_flag (work->tcon->share_conf, +KSMBD_SHARE_FLAG_ACL_XATTR )) { + rc =smb_inherit_dacl (conn, &path, sess->user->uid, + sess->user->gid); + }if (rc) {if (posix_acl_rc) ksmbd_vfs_set_init_posix_acl(user_ns,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 174/752 ksmbd: break RH leases before delete-on-close
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 1f1083c36fa11c5d9011451c7b9ab380545c72ea ]
The delete paths only marked the opened file delete pending or delete-on-close. When another client still held a read/handle lease, no lease break was sent before the delete state changed.
smb2.lease.unlink uses a create request with FILE_DELETE_ON_CLOSE and expects the second client's unlink to break the first client's RH lease to R with ACK_REQUIRED set. SetInfo(FileDispositionInformation) has the same lease-breaking requirement.
Break level-II/read-handle leases before setting delete pending or delete-on-close so clients are notified before the file is removed.
--- fs/ksmbd/smb2pdu.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
fs/ksmbd/smb2pdu.c +7 -3
@@ -3287,8 +3287,10 @@ int smb2_open(struct ksmbd_work *work) goto err_out1; } -if (req->CreateOptions &FILE_DELETE_ON_CLOSE_LE ) +if (req->CreateOptions &FILE_DELETE_ON_CLOSE_LE ) { +smb_break_all_levII_oplock (work, fp,0 );ksmbd_fd_set_delete_on_close (fp, file_info); + }if (need_truncate) { rc =smb2_create_truncate (&fp->filp->f_path);
@@ -5921,7 +5923,8 @@ static int set_rename_info(struct ksmbd_work *work, struct ksmbd_file *fp,return smb2_rename (work, fp, rename_info, work->conn->local_nls); } -static int set_file_disposition_info (struct ksmbd_file *fp, +static int set_file_disposition_info (struct ksmbd_work *work, +struct ksmbd_file *fp,struct smb2_file_disposition_info *file_info) {struct inode *inode;
@@ -5936,6 +5939,7 @@ static int set_file_disposition_info(struct ksmbd_file *fp,if (S_ISDIR (inode->i_mode) &&ksmbd_vfs_empty_dir (fp) == -ENOTEMPTY )return -EBUSY ; +smb_break_all_levII_oplock (work, fp,0 );ksmbd_set_inode_pending_delete (fp); }else {ksmbd_clear_inode_pending_delete (fp);
@@ -6054,7 +6058,7 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,if (buf_len <sizeof (struct smb2_file_disposition_info ))return -EINVAL ; -return set_file_disposition_info (fp, +return set_file_disposition_info (work, fp, (struct smb2_file_disposition_info *)buffer); }case FILE_FULL_EA_INFORMATION :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 175/752 PCI/sysfs: Use kstrtobool() to parse the ROM attribute input
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Wilczyński <[email protected]>
[ Upstream commit 92742802ecbf215a2b60dcfd326d2213595010f1 ]
pci_write_rom() controls access to the ROM content through the corresponding sysfs attribute, and treats the input as a request to disable only when it matches the string "0\n" exactly:
if ((off == 0) && (*buf == '0') && (count == 2))
The count == 2 condition encodes the trailing newline that echo(1) appends. This was found when userspace wrote "0" without a trailing newline aiming to disable access, which failed to match the condition above and enabled access instead. For example:
$ echo 0 > rom # "0\n", count 2, access disabled $ echo -n 0 > rom # "0", count 1, access enabled $ echo > rom # "", count 1, access enabled (likely not desirable)
Parse the input with kstrtobool(), which handles common boolean inputs such as "0", "1", "n", "y" or "off", "on", with or without a trailing newline, so both of the above disable access, and update the now stale comment.
As a side effect, input that does not parse as a boolean is rejected with -EINVAL rather than enabling access. The documented "0" and "1" continue to work as before, and rejecting malformed input brings the attribute in line with how sysfs attributes typically handle it.
--- drivers/pci/pci-sysfs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/pci/pci-sysfs.c +6 -5
@@ -1343,18 +1343,19 @@ void __weak pci_remove_resource_files(struct pci_dev *dev) { return; }* @off: file offset * @count: number of byte in input * -* writing anything except 0 enables it +* Writing a boolean value enables or disables the ROM display. */ static ssize_t pci_write_rom (struct file *filp,struct kobject *kobj,struct bin_attribute *bin_attr,char *buf,loff_t off,size_t count) {struct pci_dev *pdev =to_pci_dev (kobj_to_dev (kobj)); +bool enable; -if ((off ==0 ) && (*buf =='0' ) && (count ==2 )) - pdev->rom_attr_enabled =0 ; -else - pdev->rom_attr_enabled =1 ; +if (kstrtobool (buf, &enable)) +return -EINVAL ; + + pdev->rom_attr_enabled = enable;return count; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 176/752 net: au1000: move free_irq out of the close-time spinlocked section
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Runyu Xiao <[email protected]>
[ Upstream commit f48763beab4eea41fc480c9702ec6eebe8d75e4f ]
au1000_close() calls free_irq() while aup->lock is still held with spin_lock_irqsave(). free_irq() can sleep because it takes the IRQ descriptor request mutex, so it does not belong inside the close-time spinlocked section.
This was found by our static analysis tool and then confirmed by manual review of the in-tree au1000_close() .ndo_stop path. The reviewed path keeps aup->lock held across the MAC reset, queue stop and free_irq(dev->irq, dev).
A directed runtime validation kept that ndo_stop carrier and the same free_irq(dev->irq, dev) operation under the driver lock. Lockdep reported "BUG: sleeping function called from invalid context" and "Invalid wait context" while free_irq() was taking desc->request_mutex, with au1000_close() and free_irq() on the stack.
Drop aup->lock before freeing the IRQ. The protected close-time work still stops the device and queue before IRQ teardown, but the sleepable IRQ core path now runs outside the spinlocked section.
--- drivers/net/ethernet/amd/au1000_eth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/au1000_eth.c +2 -1
@@ -943,9 +943,10 @@ static int au1000_close(struct net_device *dev)/* stop the device */ netif_stop_queue (dev); +spin_unlock_irqrestore (&aup->lock, flags); +/* disable the interrupt */ free_irq (dev->irq, dev); -spin_unlock_irqrestore (&aup->lock, flags);return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 177/752 rtc: bq32000: add delay between RTC reads
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adriana Stancu <[email protected]>
[ Upstream commit d4992b7050a10079bc760bdc5b8688e05a09dfc2 ]
When the RTC is used on systems without a interrupt line, userspace tools like hwclock fall back to a frequent polling loop to synchronize with the edge of the next second.
On the BQ32000, this aggressive polling can temporarly lock the register refresh cycle, because the continuous transfers prevent the hardware from updating the buffer. This results in stale data reads or select() timeouts in userspace.
This patch introduces a delay before reading the RTC registers in order to provide a sufficient idle time for the hardware to sync with the register buffer.
--- drivers/rtc/rtc-bq32k.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/rtc/rtc-bq32k.c +9 -0
@@ -15,6 +15,7 @@#include <linux/init.h> #include <linux/errno.h> #include <linux/bcd.h> +#include <linux/delay.h> #define BQ32K_SECONDS 0x00/* Seconds register address */ #define BQ32K_SECONDS_MASK 0x7F/* Mask over seconds value */
@@ -88,9 +89,17 @@ static int bq32k_write(struct device *dev, void *data, uint8_t off, uint8_t len)static int bq32k_rtc_read_time (struct device *dev,struct rtc_time *tm) { +struct i2c_client *client =to_i2c_client (dev);struct bq32k_regs regs;int error; +/* +* When the device doesn't have the interrupt connected, prevent +* userpace from polling the RTC registers too frequently. +*/ +if (client->irq <=0 ) +usleep_range (2000 ,2500 ); + error =bq32k_read (dev, ®s,0 ,sizeof (regs));if (error)return error;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 178/752 fbdev: pm2fb: unwind WC setup on probe failure
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haoxiang Li <[email protected]>
[ Upstream commit 16eb19f0c90af03bda6ba66586d7bb0e9cf85b43 ]
Add arch_phys_wc_del() on error path to keep the write-combining setup balanced when later probe steps fail.
--- drivers/video/fbdev/pm2fb.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/pm2fb.c +1 -0
@@ -1707,6 +1707,7 @@ static int pm2fb_probe(struct pci_dev *pdev, const struct pci_device_id *id) err_exit_both:kfree (info->pixmap.addr); err_exit_pixmap: +arch_phys_wc_del (default_par->wc_cookie);iounmap (info->screen_base);release_mem_region (pm2fb_fix.smem_start, pm2fb_fix.smem_len); err_exit_mmio:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 179/752 btrfs: tree-checker: validate INODE_REFs namelen
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiming Shi <[email protected]>
[ Upstream commit 3dc22abc21f5892406c09202fa2627196cc96967 ]
[BUG]
A crafted btrfs image can trigger the following crash:
BUG: unable to handle page fault for address: ffffd1dc42884000 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page CPU: 9 UID: 0 PID: 1034 Comm: poc Not tainted 7.1.0-rc4-custom+ #383 PREEMPT(full) 46af0a92938a63be7132e0dfd71e62327c51d5c2 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS unknown 02/02/2022 RIP: 0010:memcpy+0xc/0x10 Call Trace: <TASK> read_extent_buffer+0xe4/0x100 [btrfs 3cf0785dd58fec8c5ff84633b772f17ce1f92a8f] btrfs_get_name+0x15e/0x1e0 [btrfs 3cf0785dd58fec8c5ff84633b772f17ce1f92a8f] reconnect_path+0x165/0x390 exportfs_decode_fh_raw+0x337/0x400 ? drop_caches_sysctl_handler+0xb0/0xb0 </TASK> ---[ end trace 0000000000000000 ]--- RIP: 0010:memcpy+0xc/0x10 Kernel panic - not syncing: Fatal exception
[CAUSE]
TThe crafted image has the following corrupted INODE_REF item:
item 9 key (258 INODE_REF 257) itemoff 11544 itemsize 4106
index 2 namelen 4096 name: d\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000The itemsize matches the namelen, but the namelen is 4096, way larger than normal name length limit (BTRFS_NAME_LEN, 255).
Meanwhile the memory of the @name is only 255 byte sized, this will cause out-of-boundary access, and cause the above crash.
[FIX]
Add extra namelen verification for INODE_REF, just like what we have done in ROOT_REF checks.
Now the crafted image can be rejected gracefully:
BTRFS critical (device dm-2): corrupt leaf: root=5 block=30572544 slot=14 ino=259, invalid inode ref name length, has 4096 expect [1, 255] BTRFS error (device dm-2): read time tree block corruption detected on logical 30572544 mirror 2
--- fs/btrfs/tree-checker.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/btrfs/tree-checker.c +6 -0
@@ -1621,6 +1621,12 @@ static int check_inode_ref(struct extent_buffer *leaf, iref = (struct btrfs_inode_ref *)ptr; namelen =btrfs_inode_ref_name_len (leaf, iref); +if (unlikely (namelen ==0 || namelen >BTRFS_NAME_LEN )) { +inode_ref_err (leaf, slot, +"invalid inode ref name length, has %u expect [1, %u]" , + namelen,BTRFS_NAME_LEN ); +return -EUCLEAN ; + }if (unlikely (ptr +sizeof (*iref) + namelen > end)) { inode_ref_err(leaf, slot, "inode ref overflow, ptr %lu end %lu namelen %u",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 180/752 drm/arm/malidp: use clk_bulk API in runtime PM resume and suspend
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo Kenji Mendonça Kaneko <[email protected]>
[ Upstream commit 46f715a16989f4e7bbbc2eb41447051874b027f3 ]
malidp_runtime_pm_resume() calls clk_prepare_enable() three times without checking the return value. If any clock fails to enable, the driver silently proceeds with unclocked hardware, leading to undefined behavior.
Convert both the resume and suspend paths to use the clk_bulk API:clk_bulk_prepare_enable() in resume checks the return value and rolls back any successfully enabled clocks on failure; clk_bulk_disable_unprepare() in suspend keeps the two paths symmetric.
This issue was found by code review without access to Mali DP hardware.
--- drivers/gpu/drm/arm/malidp_drv.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/gpu/drm/arm/malidp_drv.c +16 -6
@@ -672,6 +672,11 @@ static int malidp_runtime_pm_suspend(struct device *dev)struct drm_device *drm =dev_get_drvdata (dev);struct malidp_drm *malidp = drm->dev_private;struct malidp_hw_device *hwdev = malidp->dev; +struct clk_bulk_data clks[] = { + { .clk = hwdev->pclk }, + { .clk = hwdev->aclk }, + { .clk = hwdev->mclk }, + };/* we can only suspend if the hardware is in config mode */ WARN_ON (!hwdev->hw->in_config_mode (hwdev));
@@ -679,9 +684,7 @@ static int malidp_runtime_pm_suspend(struct device *dev)malidp_se_irq_fini (hwdev);malidp_de_irq_fini (hwdev); hwdev->pm_suspended = true; -clk_disable_unprepare (hwdev->mclk); -clk_disable_unprepare (hwdev->aclk); -clk_disable_unprepare (hwdev->pclk); +clk_bulk_disable_unprepare (ARRAY_SIZE (clks), clks);return 0 ; }
@@ -691,10 +694,17 @@ static int malidp_runtime_pm_resume(struct device *dev)struct drm_device *drm =dev_get_drvdata (dev);struct malidp_drm *malidp = drm->dev_private;struct malidp_hw_device *hwdev = malidp->dev; +struct clk_bulk_data clks[] = { + { .clk = hwdev->pclk }, + { .clk = hwdev->aclk }, + { .clk = hwdev->mclk }, + }; +int err; + + err =clk_bulk_prepare_enable (ARRAY_SIZE (clks), clks); +if (err) +return err; -clk_prepare_enable (hwdev->pclk); -clk_prepare_enable (hwdev->aclk); -clk_prepare_enable (hwdev->mclk); hwdev->pm_suspended = false;malidp_de_irq_hw_init (hwdev);malidp_se_irq_hw_init (hwdev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 181/752 netfilter: nf_conntrack_expect: zero at allocation time
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 241ccd2fed9051db443aadce248fc0ab30f55e97 ]
There are occasional LLM hints wrt. leaking uninitialized data to userspace via ctnetlink. Just zero at allocation time, expectations are not frequently used these days.
Intentionally keeps _init as-is because we could theoretically support re-init, so add the missing exp->dir there.
--- net/netfilter/nf_conntrack_expect.c | 3 ++- net/netfilter/nf_conntrack_netlink.c | 11 +---------- 2 files changed, 3 insertions(+), 11 deletions(-)
net/netfilter/nf_conntrack_expect.c +2 -1
@@ -299,7 +299,7 @@ struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me) {struct nf_conntrack_expect *new; - new =kmem_cache_alloc (nf_ct_expect_cachep,GFP_ATOMIC ); + new =kmem_cache_zalloc (nf_ct_expect_cachep,GFP_ATOMIC );if (!new)return NULL ;
@@ -363,6 +363,7 @@ void nf_ct_expect_init(struct nf_conntrack_expect *exp, unsigned int class,#if IS_ENABLED (CONFIG_NF_NAT )memset (&exp->saved_addr,0 ,sizeof (exp->saved_addr));memset (&exp->saved_proto,0 ,sizeof (exp->saved_proto)); + exp->dir =0 ;#endif }EXPORT_SYMBOL_GPL (nf_ct_expect_init);
net/netfilter/nf_conntrack_netlink.c +1 -10
@@ -3552,8 +3552,6 @@ ctnetlink_alloc_expect(const struct nlattr * const cda[], struct nf_conn *ct,if (cda[CTA_EXPECT_FLAGS ]) { exp->flags =ntohl (nla_get_be32 (cda[CTA_EXPECT_FLAGS ])); exp->flags &= ~NF_CT_EXPECT_USERSPACE ; - }else { - exp->flags =0 ; }if (cda[CTA_EXPECT_FN ]) {const char *name =nla_data (cda[CTA_EXPECT_FN ]);
@@ -3565,8 +3563,7 @@ ctnetlink_alloc_expect(const struct nlattr * const cda[], struct nf_conn *ct, goto err_out; } exp->expectfn = expfn->expectfn; - }else - exp->expectfn =NULL ; + } exp->class = class; exp->master = ct;
@@ -3580,12 +3577,6 @@ ctnetlink_alloc_expect(const struct nlattr * const cda[], struct nf_conn *ct, exp, nf_ct_l3num(ct));if (err <0 ) goto err_out; -#if IS_ENABLED (CONFIG_NF_NAT ) - } else { -memset (&exp->saved_addr,0 ,sizeof (exp->saved_addr)); -memset (&exp->saved_proto,0 ,sizeof (exp->saved_proto)); - exp->dir =0 ; -#endif }return exp; err_out:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 182/752 ksmbd: fix sd_ndr.data memory leak in ksmbd_vfs_set_sd_xattr
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiang Liu <[email protected]>
[ Upstream commit d4d56b00c7df88cd5751e7415bdfabc9fdbc82a7 ]
ndr_encode_v4_ntacl() allocates sd_ndr.data via kzalloc() at entry. If any subsequent ndr_write_*() call returns error during encoding, the allocated sd_ndr.data won't be freed and causes memory leak.
Move kfree(sd_ndr.data) into out label to ensure the buffer gets released on all success and error return paths.
--- fs/ksmbd/vfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ksmbd/vfs.c +1 -1
@@ -1510,8 +1510,8 @@ int ksmbd_vfs_set_sd_xattr(struct ksmbd_conn *conn,if (rc <0 )pr_err ("Failed to store XATTR ntacl :%d\n" , rc); -kfree (sd_ndr.data); out: +kfree (sd_ndr.data);kfree (acl_ndr.data);kfree (smb_acl);kfree (def_smb_acl);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 183/752 drm/arm/komeda: fix error handling for clk_prepare_enable() and callers
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo Kenji Mendonça Kaneko <[email protected]>
[ Upstream commit 6502eb8cfcd6f7bc5f1f8b73ee524112bd93319d ]
komeda_dev_resume() calls clk_prepare_enable() without checking the return value. If the clock fails to enable, the function returns 0 (success) while IRQs are enabled and IOMMU is connected on potentially unclocked hardware, causing undefined behavior on resume.
Propagate the error from clk_prepare_enable() and fix all call sites in komeda_drv.c that previously ignored the return value of komeda_dev_resume():
- komeda_platform_probe(): if resume fails, jump to err_destroy_mdev (skipping the suspend call, since the clock was never enabled)
- komeda_pm_resume(): propagate the error and skip drm_mode_config_helper_resume() on failure
This issue was found by code review without access to Komeda hardware.
--- drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 6 +++++- drivers/gpu/drm/arm/display/komeda/komeda_drv.c | 14 +++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +5 -1
@@ -321,7 +321,11 @@ void komeda_dev_destroy(struct komeda_dev *mdev)int komeda_dev_resume (struct komeda_dev *mdev) { -clk_prepare_enable (mdev->aclk); +int err; + + err =clk_prepare_enable (mdev->aclk); +if (err) +return err; mdev->funcs->enable_irq (mdev);
drivers/gpu/drm/arm/display/komeda/komeda_drv.c +9 -5
@@ -61,8 +61,11 @@ static int komeda_bind(struct device *dev) }pm_runtime_enable (dev); -if (!pm_runtime_enabled (dev)) -komeda_dev_resume (mdrv->mdev); +if (!pm_runtime_enabled (dev)) { + err =komeda_dev_resume (mdrv->mdev); +if (err) + goto err_destroy_mdev; + } mdrv->kms =komeda_kms_attach (mdrv->mdev);if (IS_ERR (mdrv->kms)) {
@@ -79,7 +82,7 @@ static int komeda_bind(struct device *dev)pm_runtime_disable (dev); else komeda_dev_suspend(mdrv->mdev); - +err_destroy_mdev:komeda_dev_destroy (mdrv->mdev); free_mdrv:
@@ -176,11 +179,12 @@ static int __maybe_unused komeda_pm_suspend(struct device *dev)static int __maybe_unused komeda_pm_resume (struct device *dev) {struct komeda_drv *mdrv =dev_get_drvdata (dev); +int err =0 ;if (!pm_runtime_status_suspended (dev)) -komeda_dev_resume (mdrv->mdev); + err =komeda_dev_resume (mdrv->mdev); -return drm_mode_config_helper_resume (&mdrv->kms->base); +return err ? err :drm_mode_config_helper_resume (&mdrv->kms->base); }static const struct dev_pm_ops komeda_pm_ops = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 184/752 ksmbd: fix n.data memory leak in ksmbd_vfs_set_dos_attrib_xattr
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiang Liu <[email protected]>
[ Upstream commit 7ac657bb9c5c1b0f7bdf1fa6d3ad532f969be5cf ]
Free ndr buffer data when ndr_encode_dos_attr() returns error to avoid memory leak.
--- fs/ksmbd/vfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ksmbd/vfs.c +3 -2
@@ -1603,14 +1603,15 @@ int ksmbd_vfs_set_dos_attrib_xattr(struct user_namespace *user_ns, err =ndr_encode_dos_attr (&n, da);if (err) -return err; + goto out; err =ksmbd_vfs_setxattr (user_ns, path,XATTR_NAME_DOS_ATTRIBUTE , (void *)n.data, n.offset,0 , get_write);if (err)ksmbd_debug (SMB ,"failed to store dos attribute in xattr\n" ); -kfree (n.data); +out: +kfree (n.data);return err; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 185/752 ksmbd: Fix acl.sd_buf memory leak and invalid sd_size error handling
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiang Liu <[email protected]>
[ Upstream commit d708a36634bb7b6f94d0e76d587d2ec50b2b93b5 ]
1. When ndr_decode_v4_ntacl() fails, the code jumped to free_n_data which only freed n.data, skipping kfree(acl.sd_buf) and leaking the buffer. Zero-initialize struct xattr_ntacl acl, reorder error labels to out_free to release acl.sd_buf on all error paths.
2. if (acl.sd_size < sizeof(struct smb_ntsd)) is true, original code returned success without freeing sd_buf and left stale *pntsd. Set rc = -EINVAL before jumping to out_free to return error code and free buffer.
--- fs/ksmbd/vfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/ksmbd/vfs.c +3 -4
@@ -1527,7 +1527,7 @@ int ksmbd_vfs_get_sd_xattr(struct ksmbd_conn *conn,struct ndr n;struct inode *inode =d_inode (dentry);struct ndr acl_ndr = {0 }; -struct xattr_ntacl acl; +struct xattr_ntacl acl = {0 };struct xattr_smb_acl *smb_acl =NULL , *def_smb_acl =NULL ;__u8 cmp_hash[XATTR_SD_HASH_SIZE ] = {0 };
@@ -1538,7 +1538,7 @@ int ksmbd_vfs_get_sd_xattr(struct ksmbd_conn *conn, n.length = rc; rc =ndr_decode_v4_ntacl (&n, &acl);if (rc) - goto free_n_data; + goto out_free; smb_acl =ksmbd_vfs_make_xattr_posix_acl (user_ns, inode,ACL_TYPE_ACCESS );
@@ -1568,6 +1568,7 @@ int ksmbd_vfs_get_sd_xattr(struct ksmbd_conn *conn, *pntsd = acl.sd_buf;if (acl.sd_size <sizeof (struct smb_ntsd )) {pr_err ("sd size is invalid\n" ); + rc = -EINVAL ; goto out_free; }
@@ -1587,8 +1588,6 @@ int ksmbd_vfs_get_sd_xattr(struct ksmbd_conn *conn,kfree (acl.sd_buf); *pntsd =NULL ; } - -free_n_data:kfree (n.data);return rc; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 186/752 xen/front-pgdir-shbuf: free grant reference head on errors
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yousef Alhouseen <[email protected]>
[ Upstream commit 678d59219ce0ae883f04c96936222c6168ef1164 ]
grant_references() allocates a private grant-reference head before claiming references for the page directory and, for guest-owned buffers, the data pages. The success path frees the remaining head, but claim failures and grant_refs_for_buffer() errors return immediately.
Unwind through a common exit path so the private grant-reference head is released even when granting fails part-way through setup. The caller still tears down any references already stored in buf->grefs.
Message-ID: <[email protected]>
--- drivers/xen/xen-front-pgdir-shbuf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/xen/xen-front-pgdir-shbuf.c +8 -4
@@ -456,8 +456,10 @@ static int grant_references(struct xen_front_pgdir_shbuf *buf)unsigned long frame; cur_ref =gnttab_claim_grant_reference (&priv_gref_head); -if (cur_ref <0 ) -return cur_ref; +if (cur_ref <0 ) { + ret = cur_ref; + goto out_free_refs; + } frame =xen_page_to_gfn (virt_to_page (buf->directory +PAGE_SIZE * i));
@@ -468,11 +470,13 @@ static int grant_references(struct xen_front_pgdir_shbuf *buf)if (buf->ops->grant_refs_for_buffer) { ret = buf->ops->grant_refs_for_buffer (buf, &priv_gref_head, j);if (ret) -return ret; + goto out_free_refs; } + ret =0 ; +out_free_refs:gnttab_free_grant_references (priv_gref_head); -return 0 ; +return ret; }/**
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 187/752 freevxfs: dont BUG() on unknown typed-extent type
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Farhad Alemi <[email protected]>
[ Upstream commit 704d48d81dc41470e108811c32c577ada66192d4 ]
vxfs_bmap_typed() handles four typed-extent types and calls BUG() in its default case, so an on-disk typed extent with any other type value crashes the kernel. It is reachable from ioctl(FIBMAP) on a regular file:
kernel BUG at fs/freevxfs/vxfs_bmap.c:230!
RIP: vxfs_bmap_typed fs/freevxfs/vxfs_bmap.c:230 [inline]
vxfs_bmap1+0x128a/0x12d0 fs/freevxfs/vxfs_bmap.c:257Replace the BUG() with WARN_ON_ONCE() and return 0 -- the value vxfs_bmap_typed() already returns on failure (and from the DEV4 case above); vxfs_getblk() maps 0 to -EIO, so the ioctl fails cleanly.
--- fs/freevxfs/vxfs_bmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/freevxfs/vxfs_bmap.c +2 -1
@@ -251,7 +251,8 @@ vxfs_bmap_typed(struct inode *ip, long iblock)return 0 ; }default : -BUG (); +WARN_ON_ONCE (1 ); +return 0 ; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 188/752 xen/gntalloc: validate grant count before allocation
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yousef Alhouseen <[email protected]>
[ Upstream commit 2299822f3f466b5dcad2377bf63986199f881a6b ]
gntalloc_ioctl_alloc() allocates the grant-id array before checking whether the requested count fits within the global grant limit. Counts above that limit cannot succeed, so reject them before the user-controlled allocation reaches kcalloc().
Use a subtraction-based check while holding gref_mutex so adding the requested count cannot wrap. Also cast the count before advancing the per-file index so the page-size multiplication is performed in 64-bit arithmetic.
Message-ID: <[email protected]>
--- drivers/xen/gntalloc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/xen/gntalloc.c +11 -2
@@ -275,6 +275,7 @@ static long gntalloc_ioctl_alloc(struct gntalloc_file_private_data *priv,int rc =0 ;struct ioctl_gntalloc_alloc_gref op;uint32_t *gref_ids; +unsigned int limit_snapshot;pr_debug ("%s: priv %p\n" , __func__, priv);
@@ -283,6 +284,12 @@ static long gntalloc_ioctl_alloc(struct gntalloc_file_private_data *priv, goto out; } + limit_snapshot =READ_ONCE (limit); +if (op.count > limit_snapshot) { + rc = -ENOSPC ; + goto out; + } + gref_ids =kcalloc (op.count,sizeof (gref_ids[0 ]),GFP_KERNEL );if (!gref_ids) { rc = -ENOMEM ;
@@ -295,14 +302,16 @@ static long gntalloc_ioctl_alloc(struct gntalloc_file_private_data *priv,* are about to enforce, removing them here is a good idea. */ do_cleanup (); -if (gref_size + op.count > limit) { + limit_snapshot =READ_ONCE (limit); +if (gref_size > limit_snapshot || + op.count > limit_snapshot - gref_size) {mutex_unlock (&gref_mutex); rc = -ENOSPC ; goto out_free; } gref_size += op.count; op.index = priv->index; - priv->index += op.count *PAGE_SIZE ; + priv->index += (uint64_t )op.count *PAGE_SIZE ;mutex_unlock (&gref_mutex); rc =add_grefs (&op, gref_ids, priv);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 189/752 ksmbd: fix credit charge calculation for SMB2 QUERY_INFO
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 284dc80ff529a0b454f11b6c2fea0d5daf6f315f ]
smb2_validate_credit_charge() computes the credit charge a request is allowed to consume from the payload size:
CreditCharge = (max(SendPayloadSize, ResponsePayloadSize) - 1)/65536 + 1
For SMB2 QUERY_INFO, the server must validate CreditCharge based on the *maximum* of InputBufferLength and OutputBufferLength. ksmbd instead summed the two lengths, which overestimates the required charge.
As a result a single-credit QUERY_INFO whose InputBufferLength and OutputBufferLength each fit in 64KB but whose sum exceeds 64KB is rejected with STATUS_INVALID_PARAMETER, even though it is a valid request. IOCTL already uses max() of the request and response sizes; make QUERY_INFO consistent by feeding InputBufferLength as the request length and OutputBufferLength as the expected response length so that smb2_validate_credit_charge() takes their maximum.
--- fs/ksmbd/smb2misc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
fs/ksmbd/smb2misc.c +7 -2
@@ -261,8 +261,12 @@ static int smb2_calc_size(void *buf, unsigned int *len)static inline int smb2_query_info_req_len (struct smb2_query_info_req *h) { -return le32_to_cpu (h->InputBufferLength) + -le32_to_cpu (h->OutputBufferLength); +return le32_to_cpu (h->InputBufferLength); +} + +static inline int smb2_query_info_resp_len (struct smb2_query_info_req *h) +{ +return le32_to_cpu (h->OutputBufferLength); }static inline int smb2_set_info_req_len (struct smb2_set_info_req *h)
@@ -308,6 +312,7 @@ static int smb2_validate_credit_charge(struct ksmbd_conn *conn,switch (hdr->Command) {case SMB2_QUERY_INFO : req_len =smb2_query_info_req_len (__hdr); + expect_resp_len =smb2_query_info_resp_len (__hdr);break ;case SMB2_SET_INFO : req_len =smb2_set_info_req_len (__hdr);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 190/752 ALSA: usb-audio: caiaq: validate EP1 reply lengths
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit aba30af07d4fe499b50209801eba9da8a815522f ]
usb_ep1_command_reply_dispatch() uses buf[0] as a command byte and then reads command-specific fixed items from the same URB buffer. Several paths use buf + 1, buf[1], buf[2], or buf + 3 without first proving that urb->actual_length contains those bytes.
Add per-command length checks, use a payload length derived from the bytes after the command byte for the control-state copy, and reject short analog input payloads before the input helper reads fixed offsets from the EP1 reply.
--- sound/usb/caiaq/device.c | 17 ++++++++++++++--- sound/usb/caiaq/input.c | 6 ++++++ 2 files changed, 20 insertions(+), 3 deletions(-)
sound/usb/caiaq/device.c +14 -3
@@ -134,14 +134,22 @@ static void usb_ep1_command_reply_dispatch (struct urb* urb)struct device *dev = &urb->dev->dev;struct snd_usb_caiaqdev *cdev = urb->context;unsigned char *buf = urb->transfer_buffer; +unsigned int payload_len; +unsigned int copy_len;if (urb->status || !cdev) {dev_warn (dev,"received EP1 urb->status = %i\n" , urb->status);return ; } +if (urb->actual_length <1 ) +return ; + + payload_len = urb->actual_length -1 ;switch (buf[0 ]) {case EP1_CMD_GET_DEVICE_INFO : +if (payload_len <sizeof (struct caiaq_device_spec )) +break ;memcpy (&cdev->spec, buf+1 ,sizeof (struct caiaq_device_spec )); cdev->spec.fw_version =le16_to_cpu (cdev->spec.fw_version); dev_dbg(dev, "device spec (firmware %d): audio: %d in, %d out, "
@@ -157,18 +165,21 @@ static void usb_ep1_command_reply_dispatch (struct urb* urb)wake_up (&cdev->ep1_wait_queue);break ;case EP1_CMD_AUDIO_PARAMS : +if (payload_len <1 ) +break ; cdev->audio_parm_answer = buf[1 ];wake_up (&cdev->ep1_wait_queue);break ;case EP1_CMD_MIDI_READ : +if (urb->actual_length <3 || urb->actual_length -3 < buf[2 ]) +break ;snd_usb_caiaq_midi_handle_input (cdev, buf[1 ], buf +3 , buf[2 ]);break ;case EP1_CMD_READ_IO :if (cdev->chip.usb_id ==USB_ID (USB_VID_NATIVEINSTRUMENTS ,USB_PID_AUDIO8DJ )) { -if (urb->actual_length >sizeof (cdev->control_state)) - urb->actual_length =sizeof (cdev->control_state); -memcpy (cdev->control_state, buf +1 , urb->actual_length); + copy_len = min_t(unsigned int, payload_len, sizeof(cdev->control_state)); +memcpy (cdev->control_state, buf +1 , copy_len);wake_up (&cdev->ep1_wait_queue);break ; }
sound/usb/caiaq/input.c +6 -0
@@ -203,6 +203,8 @@ static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *cdev,switch (cdev->chip.usb_id) {case USB_ID (USB_VID_NATIVEINSTRUMENTS ,USB_PID_RIGKONTROL2 ): +if (len <6 ) +return ;snd_caiaq_input_report_abs (cdev,ABS_X , buf,2 );snd_caiaq_input_report_abs (cdev,ABS_Y , buf,0 );snd_caiaq_input_report_abs (cdev,ABS_Z , buf,1 );
@@ -210,11 +212,15 @@ static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *cdev,case USB_ID (USB_VID_NATIVEINSTRUMENTS ,USB_PID_RIGKONTROL3 ):case USB_ID (USB_VID_NATIVEINSTRUMENTS ,USB_PID_KORECONTROLLER ):case USB_ID (USB_VID_NATIVEINSTRUMENTS ,USB_PID_KORECONTROLLER2 ): +if (len <6 ) +return ;snd_caiaq_input_report_abs (cdev,ABS_X , buf,0 );snd_caiaq_input_report_abs (cdev,ABS_Y , buf,1 );snd_caiaq_input_report_abs (cdev,ABS_Z , buf,2 );break ;case USB_ID (USB_VID_NATIVEINSTRUMENTS ,USB_PID_TRAKTORKONTROLX1 ): +if (len <16 ) +return ;snd_caiaq_input_report_abs (cdev,ABS_HAT0X , buf,4 );snd_caiaq_input_report_abs (cdev,ABS_HAT0Y , buf,2 );snd_caiaq_input_report_abs (cdev,ABS_HAT1X , buf,6 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 191/752 wifi: ralink: RT2X00: init EEPROM properly
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Corentin Labbe <[email protected]>
[ Upstream commit 0a2581cbae9e442835f68d22044157db61cdf54d ]
I have an hostapd setup with a
01:00.0 Network controller: Ralink corp. RT2790 Wireless 802.11n 1T/2R PCIe
The setup work fine on 6.18.26-gentoo
It breaks on 6.18.33-gentoo (and still broken on 6.18.37)
I found an hint in dmesg:
On 6.18.26-gentoo I see:
May 31 15:48:45 trash01 kernel: ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 0003 detected On 6.18.33-gentoo I see: May 31 15:22:57 trash01 kernel: ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 0006 detected
The RF chipset seems badly detected.
The problem was the EEPROM which was badly initialized.
Probably the origin was in some PCI change but unfortunately I couldn't play to bisect/reboot often the board with this card to do it.
--- drivers/net/wireless/ralink/rt2x00/rt2400pci.c | 2 +- drivers/net/wireless/ralink/rt2x00/rt2500pci.c | 2 +- drivers/net/wireless/ralink/rt2x00/rt2800pci.c | 2 +- drivers/net/wireless/ralink/rt2x00/rt61pci.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/ralink/rt2x00/rt2400pci.c +1 -1
@@ -1429,7 +1429,7 @@ static irqreturn_t rt2400pci_interrupt(int irq, void *dev_instance)*/ static int rt2400pci_validate_eeprom (struct rt2x00_dev *rt2x00dev) { -struct eeprom_93cx6 eeprom; +struct eeprom_93cx6 eeprom = {};u32 reg;u16 word;u8 *mac;
drivers/net/wireless/ralink/rt2x00/rt2500pci.c +1 -1
@@ -1555,7 +1555,7 @@ static irqreturn_t rt2500pci_interrupt(int irq, void *dev_instance)*/ static int rt2500pci_validate_eeprom (struct rt2x00_dev *rt2x00dev) { -struct eeprom_93cx6 eeprom; +struct eeprom_93cx6 eeprom = {};u32 reg;u16 word;u8 *mac;
drivers/net/wireless/ralink/rt2x00/rt2800pci.c +1 -1
@@ -108,7 +108,7 @@ static void rt2800pci_eepromregister_write(struct eeprom_93cx6 *eeprom)static int rt2800pci_read_eeprom_pci (struct rt2x00_dev *rt2x00dev) { -struct eeprom_93cx6 eeprom; +struct eeprom_93cx6 eeprom = {};u32 reg; reg =rt2x00mmio_register_read (rt2x00dev,E2PROM_CSR );
drivers/net/wireless/ralink/rt2x00/rt61pci.c +1 -1
@@ -2298,7 +2298,7 @@ static irqreturn_t rt61pci_interrupt(int irq, void *dev_instance)*/ static int rt61pci_validate_eeprom (struct rt2x00_dev *rt2x00dev) { -struct eeprom_93cx6 eeprom; +struct eeprom_93cx6 eeprom = {};u32 reg;u16 word;u8 *mac;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 192/752 wifi: mac80211: validate deauth frame length before reason access
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <[email protected]>
[ Upstream commit 4a360c6e18dfa9d70006c7247a6a8cc8dfe0d60f ]
ieee80211_rx_mgmt_deauth() reads the deauth reason code before checking that the fixed field is actually present in the received frame.
Validate the deauth frame length first and only then read the reason code.
--- net/mac80211/mlme.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/mac80211/mlme.c +4 -2
@@ -3126,13 +3126,15 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata, struct ieee80211_mgmt *mgmt, size_t len) {struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; -u16 reason_code =le16_to_cpu (mgmt->u.deauth.reason_code); +u16 reason_code;sdata_assert_lock (sdata); -if (len <24 +2 ) + if (len < offsetofend(struct ieee80211_mgmt, u.deauth.reason_code))return ; + reason_code =le16_to_cpu (mgmt->u.deauth.reason_code); +if (!ether_addr_equal (mgmt->bssid, mgmt->sa)) {ieee80211_tdls_handle_disconnect (sdata, mgmt->sa, reason_code);return ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 193/752 wifi: rsi: avoid reading TKIP MIC keys for non-TKIP ciphers
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 843fe9bc583b7686ca68312ac9319c9240a73c03 ]
rsi_hal_load_key() copies tx_mic_key and rx_mic_key from data[16] and data[24] whenever key data is present. Those offsets are only part of the 32-byte TKIP key layout. Shorter keys used by other ciphers, such as CCMP, do not provide those bytes, so the unconditional copies can read past the supplied key buffer.
Only copy the MIC keys for TKIP, and reject malformed TKIP keys that are shorter than the expected 32-byte layout.
--- drivers/net/wireless/rsi/rsi_91x_mgmt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/rsi/rsi_91x_mgmt.c +4 -2
@@ -848,8 +848,10 @@ int rsi_hal_load_key(struct rsi_common *common, }else {memcpy (&set_key->key[0 ][0 ], data, key_len); } -memcpy (set_key->tx_mic_key, &data[16 ],8 ); -memcpy (set_key->rx_mic_key, &data[24 ],8 ); +if (cipher ==WLAN_CIPHER_SUITE_TKIP ) { +memcpy (set_key->tx_mic_key, &data[16 ],8 ); +memcpy (set_key->rx_mic_key, &data[24 ],8 ); + } }else {memset (&set_key[FRAME_DESC_SZ ],0 , frame_len -FRAME_DESC_SZ ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 194/752 wifi: libertas: reject short monitor TX frames
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 13ff543e0b2c713aedeaadadde686686e949dc78 ]
In monitor mode, lbs_hard_start_xmit() casts skb->data to a radiotap TX header, skips that header, and then copies the 802.11 destination address from offset 4 in the remaining frame. The generic length check only rejects zero-length and oversized skbs, so a short monitor frame can be read past the end of the skb data.
Require enough bytes for the radiotap TX header and the destination address field before using the monitor-mode header layout.
--- drivers/net/wireless/marvell/libertas/tx.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/wireless/marvell/libertas/tx.c +7 -0
@@ -116,6 +116,13 @@ netdev_tx_t lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)if (priv->wdev->iftype ==NL80211_IFTYPE_MONITOR ) {struct tx_radiotap_hdr *rtap_hdr = (void *)skb->data; +if (skb->len <sizeof (*rtap_hdr) +4 +ETH_ALEN ) { +lbs_deb_tx ("tx err: short monitor frame %u\n" , skb->len); + dev->stats.tx_dropped++; + dev->stats.tx_errors++; + goto free; + } +/* set txpd fields from the radiotap header */ txpd->tx_control =cpu_to_le32 (convert_radiotap_rate_to_mv (rtap_hdr->rate));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 195/752 ksmbd: find bound sessions during reauthentication
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit faf8578c77f3d846aca9cd882c293e03eafcc6df ]
A session bound to an additional connection is stored in the session channel list, but it is not added to that connection's local session table. After the binding exchange completes, conn->binding is cleared.
A later SESSION_SETUP reauthentication on the bound channel only searches the local session table. It fails to find the session and returns STATUS_USER_SESSION_DELETED instead of processing authentication and returning STATUS_LOGON_FAILURE for invalid credentials.
If the local lookup fails, look up the session globally and accept it only when the current connection is registered in its channel list. This keeps unbound connections from using the session while allowing reauthentication on an established channel.
This fixes smb2.session.bind_invalid_auth.
--- fs/ksmbd/smb2pdu.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/ksmbd/smb2pdu.c +7 -0
@@ -1795,6 +1795,13 @@ int smb2_sess_setup(struct ksmbd_work *work) }else { sess =ksmbd_session_lookup (conn,le64_to_cpu (req->hdr.SessionId)); +if (!sess) { + sess =ksmbd_session_lookup_slowpath (le64_to_cpu (req->hdr.SessionId)); +if (sess && !lookup_chann_list (sess, conn)) { +ksmbd_user_session_put (sess); + sess =NULL ; + } + }if (!sess) { rc = -ENOENT ; goto out_err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 196/752 ksmbd: mark invalid session responses as signed
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 9e8ad620ddfde5a5f4ef58372e3805e9388cb0f4 ]
When a signed request uses a session that is not registered on the connection, ksmbd returns STATUS_USER_SESSION_DELETED before reaching the normal response signing path. The response therefore lacks SMB2_FLAGS_SIGNED.
Clients that require signing check this flag before handling STATUS_USER_SESSION_DELETED and replace the server status with STATUS_ACCESS_DENIED when it is absent. The protocol permits this error response to skip signature verification because the connection has no matching session key.
Preserve SMB2_FLAGS_SIGNED on the early error response when the request was signed. This lets the client propagate STATUS_USER_SESSION_DELETED. It fixes smb2.session.bind2.
--- fs/ksmbd/server.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/ksmbd/server.c +6 -0
@@ -195,6 +195,12 @@ static void __handle_ksmbd_work(struct ksmbd_work *work,else conn->ops->set_rsp_status (work,STATUS_USER_SESSION_DELETED ); +if (conn->ops->is_sign_req (work, conn->ops->get_cmd_val (work))) { +struct smb2_hdr *rsp_hdr; + + rsp_hdr =ksmbd_resp_buf_curr (work); + rsp_hdr->Flags |=SMB2_FLAGS_SIGNED ; + } goto send; }else if (rc >0 ) { rc = conn->ops->get_ksmbd_tcon (work);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 197/752 ksmbd: validate SID namespace before mapping IDs
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit fbe0bb2b75eb3c61e8464486506253d1b471240b ]
sid_to_id() currently treats the last subauthority of any owner or group SID as a Unix uid or gid. For example, this maps Everyone (S-1-1-0) to uid 0 and BUILTIN\Users (S-1-5-32-545) to gid 545.
When an SMB2 CREATE security descriptor contains those SIDs, ksmbd attempts to change the newly created file to the bogus Unix ownership. notify_change() then returns -EPERM, which makes smb2.create.aclfile fail with NT_STATUS_SHARING_VIOLATION.
Validate the SID prefix before extracting its RID. Only server-domain owner SIDs and S-1-22-2 Unix group SIDs have local ID representations. Treat other valid Windows SIDs as unmapped so their original values can still be preserved in the NT ACL xattr.
--- fs/ksmbd/smbacl.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
fs/ksmbd/smbacl.c +17 -4
@@ -259,6 +259,7 @@ static int sid_to_id(struct user_namespace *user_ns, struct smb_sid *psid, uint sidtype, struct smb_fattr *fattr) { + const struct smb_sid *sid_prefix;int rc = -EINVAL ;/*
@@ -275,6 +276,12 @@ static int sid_to_id(struct user_namespace *user_ns,kuid_t uid;uid_t id; +/* Only the server domain RID has a local uid representation. */ + sid_prefix = &server_conf.domain_sid; +if (psid->num_subauth != sid_prefix->num_subauth +1 || +compare_sids (psid, sid_prefix)) +return -EINVAL ; + id =le32_to_cpu (psid->sub_auth[psid->num_subauth -1 ]); uid =mapped_kuid_user (user_ns, &init_user_ns,KUIDT_INIT (id));if (uid_valid (uid)) {
@@ -285,6 +292,12 @@ static int sid_to_id(struct user_namespace *user_ns,kgid_t gid;gid_t id; +/* Local gids are represented by S-1-22-2-<gid>. */ + sid_prefix = &sid_unix_groups; +if (psid->num_subauth != sid_prefix->num_subauth +1 || +compare_sids (psid, sid_prefix)) +return -EINVAL ; + id =le32_to_cpu (psid->sub_auth[psid->num_subauth -1 ]); gid =mapped_kgid_user (user_ns, &init_user_ns,KGIDT_INIT (id));if (gid_valid (gid)) {
@@ -858,9 +871,9 @@ int parse_sec_desc(struct user_namespace *user_ns, struct smb_ntsd *pntsd, rc =sid_to_id (user_ns, owner_sid_ptr,SIDOWNER , fattr);if (rc) { -pr_err ("%s: Error %d mapping Owner SID to uid\n" , - __func__, rc); +ksmbd_debug (SMB ,"Owner SID has no Unix uid mapping\n" ); owner_sid_ptr =NULL ; + rc =0 ; } }
@@ -873,9 +886,9 @@ int parse_sec_desc(struct user_namespace *user_ns, struct smb_ntsd *pntsd, } rc =sid_to_id (user_ns, group_sid_ptr,SIDUNIX_GROUP , fattr);if (rc) { -pr_err ("%s: Error %d mapping Group SID to gid\n" , - __func__, rc); +ksmbd_debug (SMB ,"Group SID has no Unix gid mapping\n" ); group_sid_ptr =NULL ; + rc =0 ; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 198/752 wifi: cfg80211: validate rx/tx MLME callback frame lengths before access
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <[email protected]>
[ Upstream commit d5e4586546974179feca305a94e07fac3e9727fe ]
cfg80211_rx_mlme_mgmt() and cfg80211_tx_mlme_mgmt() call tracepoints before rejecting frames shorter than the frame-control field. After that, they only require len >= 2 before dispatching into subtype handlers that assume their fixed fields are present.
The frames that trip this are not shorter than 2 bytes; they are short relative to their subtype. mwifiex is a concrete in-tree example on the length side: mwifiex_process_mgmt_packet() only requires a 4-address ieee80211_hdr plus the 2-byte firmware length prefix before handing the frame to cfg80211_rx_mlme_mgmt(). After stripping the length prefix and removing addr4, pkt_len can be exactly 24: a bare 3-address management header with no reason-code body. The existing WARN_ON(len < 2) does not fire on such a frame, and cfg80211_process_deauth() then reads u.deauth.reason_code as a two-byte access starting at offset 24, immediately past the 24-byte buffer.
Add a frame-control length gate, then validate each subtype's minimum frame size in an if/else-if chain that mirrors the dispatch logic. Trace only after the frame is known to be well-formed.
Side effects of this change:
- The WARN_ON(len < 2) is dropped. It only guarded the frame_control read, never the subtype fixed fields, and it does not fire on the frames that actually trigger the out-of-bounds read (which are >= 2). The len >= 2 check is kept as the guard before dereferencing frame_control, but without the warning: these are exported callbacks and a malformed frame from a driver should be dropped silently rather than backtraced.
- cfg80211_tx_mlme_mgmt() previously routed every non-deauth subtype through disassociation handling; it now silently ignores unrecognised subtypes.
--- net/wireless/mlme.c | 45 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-)
net/wireless/mlme.c +37 -8
@@ -125,19 +125,35 @@ void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len) {struct wireless_dev *wdev = dev->ieee80211_ptr;struct ieee80211_mgmt *mgmt = (void *)buf; +__le16 fc;ASSERT_WDEV_LOCK (wdev); -trace_cfg80211_rx_mlme_mgmt (dev, buf, len); +if (len <sizeof (fc)) +return ; -if (WARN_ON (len <2 )) + fc = mgmt->frame_control; + +if (ieee80211_is_auth (fc)) { + if (len < offsetofend(struct ieee80211_mgmt, u.auth.status_code)) +return ; + }else if (ieee80211_is_deauth (fc)) { + if (len < offsetofend(struct ieee80211_mgmt, u.deauth.reason_code)) +return ; + }else if (ieee80211_is_disassoc (fc)) { + if (len < offsetofend(struct ieee80211_mgmt, u.disassoc.reason_code)) +return ; + }else {return ; + } -if (ieee80211_is_auth (mgmt->frame_control)) +trace_cfg80211_rx_mlme_mgmt (dev, buf, len); + +if (ieee80211_is_auth (fc))cfg80211_process_auth (wdev, buf, len); -else if (ieee80211_is_deauth (mgmt->frame_control)) +else if (ieee80211_is_deauth (fc))cfg80211_process_deauth (wdev, buf, len, false); -else if (ieee80211_is_disassoc (mgmt->frame_control)) +else cfg80211_process_disassoc (wdev, buf, len, false); }EXPORT_SYMBOL (cfg80211_rx_mlme_mgmt);
@@ -188,15 +204,28 @@ void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len, {struct wireless_dev *wdev = dev->ieee80211_ptr;struct ieee80211_mgmt *mgmt = (void *)buf; +__le16 fc;ASSERT_WDEV_LOCK (wdev); -trace_cfg80211_tx_mlme_mgmt (dev, buf, len, reconnect); +if (len <sizeof (fc)) +return ; -if (WARN_ON (len <2 )) + fc = mgmt->frame_control; + +if (ieee80211_is_deauth (fc)) { + if (len < offsetofend(struct ieee80211_mgmt, u.deauth.reason_code)) +return ; + }else if (ieee80211_is_disassoc (fc)) { + if (len < offsetofend(struct ieee80211_mgmt, u.disassoc.reason_code)) +return ; + }else {return ; + } + +trace_cfg80211_tx_mlme_mgmt (dev, buf, len, reconnect); -if (ieee80211_is_deauth (mgmt->frame_control)) +if (ieee80211_is_deauth (fc))cfg80211_process_deauth (wdev, buf, len, reconnect);else cfg80211_process_disassoc (wdev, buf, len, reconnect);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 199/752 gpio: dwapb: Mask interrupts at hardware initialization
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liang Hao <[email protected]>
[ Upstream commit aaf7766ba3b99a3834319e7cf939838afc705574 ]
GPIO interrupts may retain stale state across warm reboots when peripherals remain powered. If a GPIO line is not explicitly configured for interrupts, this can result in interrupt storms due to missing handlers.
Fix this by ensuring all interrupts are masked and disabled at hardware initialization time via the init_hw() callback. Pending interrupts are also cleared to start from a known-safe state.
Interrupts will be unmasked only when explicitly configured by userspace or kernel drivers.
--- drivers/gpio/gpio-dwapb.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/gpio/gpio-dwapb.c +17 -0
@@ -200,6 +200,22 @@ static void dwapb_toggle_trigger(struct dwapb_gpio *gpio, unsigned int offs)dwapb_write (gpio,GPIO_INT_POLARITY , pol); } +static int dwapb_irq_init_hw (struct gpio_chip *gc) +{ +struct dwapb_gpio *gpio =to_dwapb_gpio (gc); + +/* +* GPIO interrupts may retain stale state across warm reboots when +* peripherals stay powered. Force a known-safe state before the GPIO +* irqchip and irq domain are set up. +*/ +dwapb_write (gpio,GPIO_INTEN ,0 ); +dwapb_write (gpio,GPIO_INTMASK ,0xffffffff ); +dwapb_write (gpio,GPIO_PORTA_EOI ,0xffffffff ); + +return 0 ; +} +static u32 dwapb_do_irq (struct dwapb_gpio *gpio) {struct gpio_chip *gc = &gpio->ports[0 ].gc;
@@ -440,6 +456,7 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio, girq = &gc->irq; girq->handler = handle_bad_irq; girq->default_type =IRQ_TYPE_NONE ; + girq->init_hw = dwapb_irq_init_hw; port->pirq = pirq; pirq->irqchip.name =DWAPB_DRIVER_NAME ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 200/752 wifi: libipw: fix key index receive bound checks
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 74ed3669f26803b1761c1f55403062bea44c3466 ]
libipw_rx() reads skb->data[hdrlen + 3] to extract the WEP key index in both the software-decrypt key selection path and the hardware-decrypted IV/ICV strip path. In both places the existing guard only checks skb->len >= hdrlen + 3, which proves bytes up to hdrlen + 2 but not the byte at hdrlen + 3.
Require hdrlen + 4 bytes before reading that item in both paths. This is a local source-boundary check only; it does not change the key index semantics.
--- drivers/net/wireless/intel/ipw2x00/libipw_rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/ipw2x00/libipw_rx.c +2 -2
@@ -417,7 +417,7 @@ int libipw_rx(struct libipw_device *ieee, struct sk_buff *skb, ieee->host_mc_decrypt : ieee->host_decrypt;if (can_be_decrypted) { -if (skb->len >= hdrlen +3 ) { +if (skb->len >= hdrlen +4 ) {/* Top two-bits of byte 3 are the key index */ keyidx = skb->data[hdrlen +3 ] >>6 ; }
@@ -663,7 +663,7 @@ int libipw_rx(struct libipw_device *ieee, struct sk_buff *skb,int trimlen =0 ;/* Top two-bits of byte 3 are the key index */ -if (skb->len >= hdrlen +3 ) +if (skb->len >= hdrlen +4 ) keyidx = skb->data[hdrlen +3 ] >>6 ;/* To strip off any security data which appears before the
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 201/752 netfilter: ipset: mark the rcu locked areas properly
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jozsef Kadlecsik <[email protected]>
[ Upstream commit 5d0c22e73656d050daffad10a2ba8765ce8441c8 ]
When we bump the uref counter, there's no need to keep the rcu lock because the referred hash table can't disappear. Also, from the same reason in mtype_gc we need the rcu lock and not a spinlock.
--- net/netfilter/ipset/ip_set_hash_gen.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
net/netfilter/ipset/ip_set_hash_gen.h +5 -8
@@ -554,9 +554,10 @@ mtype_gc(struct work_struct *work) set = gc->set; h = set->data; -spin_lock_bh (&set->lock); - t =ipset_dereference_set (h->table, set); +rcu_read_lock_bh (); + t =rcu_dereference_bh (h->table);atomic_inc (&t->uref); +rcu_read_unlock_bh (); numof_locks =ahash_numof_locks (t->htable_bits); r = gc->region++;if (r >= numof_locks) {
@@ -565,7 +566,6 @@ mtype_gc(struct work_struct *work) next_run = (IPSET_GC_PERIOD (set->timeout) *HZ ) / numof_locks;if (next_run <HZ /10 ) next_run =HZ /10 ; -spin_unlock_bh (&set->lock);mtype_gc_do (set, h, t, r);
@@ -841,15 +841,13 @@ mtype_add(struct ip_set *set, void *value, const struct ip_set_ext *ext, key =HKEY (value, h->initval, t->htable_bits); r =ahash_region (key);atomic_inc (&t->uref); +rcu_read_unlock_bh (); elements = t->hregion[r].elements; maxelem = t->maxelem;if (elements >= maxelem) {u32 e; -if (SET_WITH_TIMEOUT (set)) { -rcu_read_unlock_bh (); +if (SET_WITH_TIMEOUT (set))mtype_gc_do (set, h, t, r); -rcu_read_lock_bh (); - } maxelem = h->maxelem; elements =0 ;for (e =0 ; e <ahash_numof_locks (t->htable_bits); e++)
@@ -857,7 +855,6 @@ mtype_add(struct ip_set *set, void *value, const struct ip_set_ext *ext,if (elements >= maxelem &&SET_WITH_FORCEADD (set)) forceadd = true; } -rcu_read_unlock_bh ();spin_lock_bh (&t->hregion[r].lock); n =rcu_dereference_bh (hbucket (t, key));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 202/752 wifi: rsi: validate beacon length before fixed buffer copy
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 8ecdeb8b8a33b22c597299043c0dcfce50beb9ea ]
rsi_prepare_beacon() copies the mac80211 beacon frame after FRAME_DESC_SZ into a management skb whose usable tailroom may be smaller than MAX_MGMT_PKT_SIZE after alignment.
Validate the beacon length against the actual tailroom before the copy and skb_put(). Leave ownership of the management skb with the caller on error, matching the existing rsi_send_beacon() cleanup path.
--- drivers/net/wireless/rsi/rsi_91x_hal.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/wireless/rsi/rsi_91x_hal.c +8 -0
@@ -434,6 +434,7 @@ int rsi_prepare_beacon(struct rsi_common *common, struct sk_buff *skb)struct ieee80211_vif *vif;struct sk_buff *mac_bcn;u8 vap_id =0 , i; +unsigned int tailroom;u16 tim_offset =0 ;for (i =0 ; i <RSI_MAX_VIFS ; i++) {
@@ -483,6 +484,13 @@ int rsi_prepare_beacon(struct rsi_common *common, struct sk_buff *skb)if (mac_bcn->data[tim_offset +2 ] ==0 ) bcn_frm->frame_info |=cpu_to_le16 (RSI_DATA_DESC_DTIM_BEACON ); + tailroom =skb_tailroom (skb); +if (tailroom <FRAME_DESC_SZ || + mac_bcn->len > tailroom -FRAME_DESC_SZ ) { +dev_kfree_skb (mac_bcn); +return -EMSGSIZE ; + } +memcpy (&skb->data[FRAME_DESC_SZ ], mac_bcn->data, mac_bcn->len);skb_put (skb, mac_bcn->len +FRAME_DESC_SZ );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 203/752 btrfs: only account delalloc bytes for regular file inodes in btrfs_getattr()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chen <[email protected]>
[ Upstream commit 9411aafdf352b8d72668732af5a37dcb27383e25 ]
btrfs_getattr() unconditionally reads BTRFS_I(inode)->new_delalloc_bytes and adds it (sector-aligned) to stat->blocks for every inode type. However, new_delalloc_bytes lives in a union with last_dir_index_offset:
union {
u64 new_delalloc_bytes; /* files only */
u64 last_dir_index_offset; /* directories only */
};
For a directory inode this memory holds last_dir_index_offset, which is set during directory logging (e.g. flush_dir_items_batch()) to the offset of the last logged BTRFS_DIR_INDEX_KEY. That offset grows with the number of entries ever created in the directory (dir indexes are monotonic and never reused), so it can be arbitrarily large.
As a result, after a directory has been logged (e.g. via an fsync that triggers directory logging), btrfs_getattr() reports inflated st_blocks for that directory. The inflation is purely in-core and disappears after the inode is evicted and reloaded (btrfs_alloc_inode() zeroes the union), e.g. after a remount.
Reproducer (on a btrfs filesystem):
D=/mnt/btrfs/d
mkdir -p $D
for i in $(seq 1 20000); do touch $D/f$i; done
sync # commit, push dir index high
touch $D/trigger # dirty the dir in a new transaction
xfs_io -c fsync $D # log the directory -> sets last_dir_index_offset
stat -c '%b' $D # st_blocks is now inflated (e.g. 40)
# umount + mount -> st_blocks drops back to the correct value
The evict path already knows this union is type-dependent and guards the corresponding WARN_ON with !S_ISDIR() in btrfs_destroy_inode(); only btrfs_getattr() was missing the equivalent check.
Only read new_delalloc_bytes for regular files, which are the only inodes that ever set it.
--- fs/btrfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/inode.c +2 -1
@@ -9550,7 +9550,8 @@ static int btrfs_getattr(struct user_namespace *mnt_userns, stat->dev =BTRFS_I (inode)->root->anon_dev;spin_lock (&BTRFS_I (inode)->lock); - delalloc_bytes =BTRFS_I (inode)->new_delalloc_bytes; + delalloc_bytes =S_ISREG (inode->i_mode) ? +BTRFS_I (inode)->new_delalloc_bytes :0 ; inode_bytes =inode_get_bytes (inode);spin_unlock (&BTRFS_I (inode)->lock); stat->blocks = (ALIGN(inode_bytes, blocksize) +
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 204/752 btrfs: fix use-after-free on reloc root after error in insert_dirty_subvol()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 83201804efa4a5168be754e1dfc9b2faee760cac ]
If during relocation we fail in insert_dirty_subvol() because btrfs_update_reloc_root() returned an error, we will leave a root's reloc_root field pointing to a reloc root that was freed instead of NULL, resulting later in a use-after-free, or double free attempt during unmount.
The sequence of steps is this:
1) During relocation the call to btrfs_update_reloc_root() in insert_dirty_subvol() fails, so insert_dirty_subvol() returns the error to merge_reloc_root() without adding the root to the list rc->dirty_subvol_roots;
2) Then merge_reloc_root() aborts the current transaction because insert_dirty_subvol() returned an error;
3) Up the call chain, merge_reloc_roots() gets the error, adds the reloc root for root X to the local reloc_roots list and jumps to the 'out' label, where it calls free_reloc_roots() to free all the reloc roots in the local reloc_roots list. This frees the reloc root for root X;
4) We go up the call chain to relocate_block_group() which calls clean_dirty_subvols() to go over dirty roots and set their ->reloc_root field to NULL, but root X is not in the dirty_subvol_roots list, so its ->reloc_root still points to a reloc root;
5) Relocation finishes, with an error and a transaction abort, but the ->reloc_root field for root X still points to the reloc root that was freed in step 3;
6) When unmounting the fs we end up calling:
btrfs_free_fs_roots()
btrfs_drop_and_free_fs_root()
--> calls btrfs_put_root() against root X's ->reloc_root
which is not NULL and points to the already freed reloc root in step 4 above
Resulting in a use-after-free to a double free attempt.
Syzbot reported this with the following dmesg/syslog:
[ 106.004389][ T5339] BTRFS error (device loop0 state A): Transaction aborted (error -5) [ 106.014266][ T5339] BTRFS: error (device loop0 state A) in merge_reloc_root:1655: errno=-5 IO failure [ 106.021891][ T1061] BTRFS error (device loop0 state A): error while writing out transaction: -5 [ 106.026964][ T1061] BTRFS warning (device loop0 state A): Skipping commit of aborted transaction. [ 106.033807][ T5340] BTRFS error (device loop0 state A): bdev /dev/loop0 errs: wr 3, rd 0, flush 0, corrupt 0, gen 0 [ 106.039265][ T1061] BTRFS: error (device loop0 state A) in cleanup_transaction:2067: errno=-5 IO failure [ 106.044382][ T5339] BTRFS info (device loop0 state EA): forced readonly [ 106.074329][ T5339] BTRFS: error (device loop0 state EA) in merge_reloc_roots:1887: errno=-5 IO failure [ 106.081004][ T5356] BTRFS info (device loop0 state EA): scrub: started on devid 1 [ 106.085611][ T5339] BTRFS info (device loop0 state EA): balance: ended with status: -30 [ 106.089517][ T5356] BTRFS info (device loop0 state EA): scrub: not finished on devid 1 with status: -30 [ 106.662365][ T5338] BTRFS info (device loop0 state EA): last unmount of filesystem 3a375e4e-b156-4d76-a2ad-16e198ce1409 [ 106.682946][ T5338] ================================================================== [ 106.686574][ T5338] BUG: KASAN: slab-use-after-free in btrfs_put_root+0x2f/0x250 [ 106.690090][ T5338] Write of size 4 at addr ffff88803f978630 by task syz.0.0/5338 [ 106.693173][ T5338] [ 106.694279][ T5338] CPU: 0 UID: 0 PID: 5338 Comm: syz.0.0 Not tainted syzkaller #0 PREEMPT(full) [ 106.694293][ T5338] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 106.694300][ T5338] Call Trace: [ 106.694308][ T5338] <TASK> [ 106.694314][ T5338] dump_stack_lvl+0xe8/0x150 [ 106.694331][ T5338] print_address_description+0x55/0x1e0 [ 106.694343][ T5338] ? btrfs_put_root+0x2f/0x250 [ 106.694358][ T5338] print_report+0x58/0x70 [ 106.694368][ T5338] kasan_report+0x117/0x150 [ 106.694384][ T5338] ? btrfs_put_root+0x2f/0x250 [ 106.694399][ T5338] kasan_check_range+0x264/0x2c0 [ 106.694416][ T5338] btrfs_put_root+0x2f/0x250 [ 106.694430][ T5338] btrfs_drop_and_free_fs_root+0x160/0x210 [ 106.694447][ T5338] btrfs_free_fs_roots+0x2f9/0x3c0 [ 106.694464][ T5338] ? __pfx_btrfs_free_fs_roots+0x10/0x10 [ 106.694479][ T5338] ? free_root_pointers+0x5bf/0x5f0 [ 106.694494][ T5338] close_ctree+0x798/0x12d0 [ 106.694511][ T5338] ? __pfx_close_ctree+0x10/0x10 [ 106.694526][ T5338] ? _raw_spin_unlock_irqrestore+0x74/0x80 [ 106.694599][ T5338] ? rcu_preempt_deferred_qs_irqrestore+0x906/0xbc0 [ 106.694620][ T5338] ? __rcu_read_unlock+0x83/0xe0 [ 106.694636][ T5338] ? btrfs_put_super+0x48/0x1c0 [ 106.694652][ T5338] ? __pfx_btrfs_put_super+0x10/0x10 [ 106.694667][ T5338] generic_shutdown_super+0x13d/0x2d0 [ 106.694682][ T5338] kill_anon_super+0x3b/0x70 [ 106.694695][ T5338] btrfs_kill_super+0x41/0x50 [ 106.694710][ T5338] deactivate_locked_super+0xbc/0x130 [ 106.694722][ T5338] cleanup_mnt+0x437/0x4d0 [ 106.694736][ T5338] ? _raw_spin_unlock_irq+0x23/0x50 [ 106.694752][ T5338] task_work_run+0x1d9/0x270 [ 106.694769][ T5338] ? __pfx_task_work_run+0x10/0x10 [ 106.694784][ T5338] ? do_raw_spin_unlock+0x4d/0x210 [ 106.694802][ T5338] do_exit+0x70f/0x22c0 [ 106.694817][ T5338] ? trace_irq_disable+0x3b/0x140 [ 106.694835][ T5338] ? __pfx_do_exit+0x10/0x10 [ 106.694848][ T5338] ? preempt_schedule_thunk+0x16/0x30 [ 106.694863][ T5338] ? preempt_schedule_common+0x82/0xd0 [ 106.694878][ T5338] ? preempt_schedule_thunk+0x16/0x30 [ 106.694892][ T5338] do_group_exit+0x21b/0x2d0 [ 106.694906][ T5338] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 106.694918][ T5338] __x64_sys_exit_group+0x3f/0x40 [ 106.694932][ T5338] x64_sys_call+0x221a/0x2240 [ 106.694944][ T5338] do_syscall_64+0x174/0x580 [ 106.694954][ T5338] ? clear_bhb_loop+0x40/0x90 [ 106.694967][ T5338] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 106.694978][ T5338] RIP: 0033:0x7f958ef9ce59 [ 106.694988][ T5338] Code: Unable to access opcode bytes at 0x7f958ef9ce2f. [ 106.694994][ T5338] RSP: 002b:00007fffd4058318 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 106.695008][ T5338] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f958ef9ce59 [ 106.695015][ T5338] RDX: 00007f958c3f8000 RSI: 0000000000000000 RDI: 0000000000000000 [ 106.695022][ T5338] RBP: 0000000000000003 R08: 0000000000000000 R09: 00007f958f1e73e0 [ 106.695028][ T5338] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 [ 106.695034][ T5338] R13: 00007f958f1e73e0 R14: 0000000000000003 R15: 00007fffd40583d0 [ 106.695046][ T5338] </TASK> [ 106.695050][ T5338] [ 106.821635][ T5338] Allocated by task 1061: [ 106.823446][ T5338] kasan_save_track+0x3e/0x80 [ 106.825498][ T5338] __kasan_kmalloc+0x93/0xb0 [ 106.827381][ T5338] __kmalloc_cache_noprof+0x31c/0x660 [ 106.829525][ T5338] btrfs_alloc_root+0x75/0x930 [ 106.831458][ T5338] read_tree_root_path+0x127/0xb00 [ 106.833556][ T5338] btrfs_read_tree_root+0x34/0x60 [ 106.835553][ T5338] create_reloc_root+0x6b3/0xcb0 [ 106.837556][ T5338] btrfs_init_reloc_root+0x2ec/0x4b0 [ 106.839557][ T5338] record_root_in_trans+0x2ab/0x350 [ 106.841685][ T5338] btrfs_record_root_in_trans+0x15c/0x180 [ 106.844237][ T5338] start_transaction+0x39c/0x1820 [ 106.846638][ T5338] btrfs_finish_one_ordered+0x88e/0x2680 [ 106.849436][ T5338] btrfs_work_helper+0x37b/0xc20 [ 106.851549][ T5338] process_scheduled_works+0xb5d/0x1860 [ 106.853807][ T5338] worker_thread+0xa53/0xfc0 [ 106.855773][ T5338] kthread+0x389/0x470 [ 106.857548][ T5338] ret_from_fork+0x514/0xb70 [ 106.859493][ T5338] ret_from_fork_asm+0x1a/0x30 [ 106.861504][ T5338] [ 106.862527][ T5338] Freed by task 5339: [ 106.864224][ T5338] kasan_save_track+0x3e/0x80 [ 106.866180][ T5338] kasan_save_free_info+0x46/0x50 [ 106.868371][ T5338] __kasan_slab_free+0x5c/0x80 [ 106.870462][ T5338] kfree+0x1c5/0x640 [ 106.872180][ T5338] __del_reloc_root+0x341/0x3b0 [ 106.874290][ T5338] free_reloc_roots+0x5f/0x90 [ 106.876282][ T5338] merge_reloc_roots+0x73f/0x8a0 [ 106.878489][ T5338] relocate_block_group+0xbcc/0xe70 [ 106.880742][ T5338] do_nonremap_reloc+0xa8/0x5b0 [ 106.882885][ T5338] btrfs_relocate_block_group+0x7e6/0xc40 [ 106.885336][ T5338] btrfs_relocate_chunk+0x115/0x820 [ 106.887502][ T5338] __btrfs_balance+0x1db0/0x2ae0 [ 106.889543][ T5338] btrfs_balance+0xaf3/0x11b0 [ 106.891456][ T5338] btrfs_ioctl_balance+0x3d3/0x610 [ 106.893672][ T5338] __se_sys_ioctl+0xfc/0x170 [ 106.895530][ T5338] do_syscall_64+0x174/0x580 [ 106.897518][ T5338] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 106.900101][ T5338] [ 106.901123][ T5338] The buggy address belongs to the object at ffff88803f978000 [ 106.901123][ T5338] which belongs to the cache kmalloc-4k of size 4096 [ 106.906907][ T5338] The buggy address is located 1584 bytes inside of [ 106.906907][ T5338] freed 4096-byte region [ffff88803f978000, ffff88803f979000) [ 106.912980][ T5338] [ 106.914022][ T5338] The buggy address belongs to the physical page: [ 106.916716][ T5338] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3f978 [ 106.920390][ T5338] head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 [ 106.923834][ T5338] flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff) [ 106.927104][ T5338] page_type: f5(slab) [ 106.928898][ T5338] raw: 04fff00000000040 ffff88801ac42140 dead000000000122 0000000000000000 [ 106.932507][ T5338] raw: 0000000000000000 0000000800040004 00000000f5000000 0000000000000000 [ 106.936193][ T5338] head: 04fff00000000040 ffff88801ac42140 dead000000000122 0000000000000000 [ 106.939856][ T5338] head: 0000000000000000 0000000800040004 00000000f5000000 0000000000000000 [ 106.943601][ T5338] head: 04fff00000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff [ 106.947268][ T5338] head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 [ 106.950988][ T5338] page dumped because: kasan: bad access detected [ 106.953710][ T5338] page_owner tracks the page as allocated [ 106.956198][ T5338] page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 24, tgid 24 (kworker/u4:2), ts 105728970387, free_ts 29540875453 [ 106.964984][ T5338] post_alloc_hook+0x22d/0x280 [ 106.966956][ T5338] get_page_from_freelist+0x2593/0x2610 [ 106.969307][ T5338] __alloc_frozen_pages_noprof+0x18d/0x380 [ 106.971839][ T5338] allocate_slab+0x77/0x660 [ 106.973709][ T5338] refill_objects+0x339/0x3d0 [ 106.975696][ T5338] __pcs_replace_empty_main+0x321/0x720 [ 106.978136][ T5338] __kmalloc_node_track_caller_noprof+0x572/0x7b0 [ 106.981009][ T5338] __alloc_skb+0x2c1/0x7d0 [ 106.982983][ T5338] nsim_dev_trap_report_work+0x29a/0xb90 [ 106.985356][ T5338] process_scheduled_works+0xb5d/0x1860 [ 106.987710][ T5338] worker_thread+0xa53/0xfc0 [ 106.989847][ T5338] kthread+0x389/0x470 [ 106.991727][ T5338] ret_from_fork+0x514/0xb70 [ 106.993722][ T5338] ret_from_fork_asm+0x1a/0x30 [ 106.995900][ T5338] page last free pid 77 tgid 77 stack trace: [ 106.998479][ T5338] __free_frozen_pages+0xc1c/0xd30 [ 107.000819][ T5338] vfree+0x1d1/0x2f0 [ 107.002631][ T5338] delayed_vfree_work+0x55/0x80 [ 107.004848][ T5338] process_scheduled_works+0xb5d/0x1860 [ 107.007366][ T5338] worker_thread+0xa53/0xfc0 [ 107.009388][ T5338] kthread+0x389/0x470 [ 107.011177][ T5338] ret_from_fork+0x514/0xb70 [ 107.013313][ T5338] ret_from_fork_asm+0x1a/0x30 [ 107.015454][ T5338] [ 107.016460][ T5338] Memory state around the buggy address: [ 107.019052][ T5338] ffff88803f978500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 107.022691][ T5338] ffff88803f978580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 107.026264][ T5338] >ffff88803f978600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 107.029721][ T5338] ^ [ 107.032062][ T5338] ffff88803f978680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 107.035547][ T5338] ffff88803f978700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 107.038865][ T5338] ==================================================================
Fix this by resetting a root's ->reloc_root if we get an error while trying to merge a reloc root.
--- fs/btrfs/relocation.c | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-)
fs/btrfs/relocation.c +33 -9
@@ -1647,6 +1647,17 @@ static int insert_dirty_subvol(struct btrfs_trans_handle *trans,return 0 ; } +static void clear_reloc_root (struct btrfs_root *root) +{ + root->reloc_root =NULL ; +/* +* Need barrier to ensure clear_bit() only happens after +* root->reloc_root = NULL. Pairs with have_reloc_root(). +*/ +smp_wmb (); +clear_bit (BTRFS_ROOT_DEAD_RELOC_TREE , &root->state); +} +static int clean_dirty_subvols (struct reloc_control *rc) {struct btrfs_root *root;
@@ -1661,13 +1672,7 @@ static int clean_dirty_subvols(struct reloc_control *rc)struct btrfs_root *reloc_root = root->reloc_root;list_del_init (&root->reloc_dirty_list); - root->reloc_root =NULL ; -/* -* Need barrier to ensure clear_bit() only happens after -* root->reloc_root = NULL. Pairs with have_reloc_root. -*/ -smp_wmb (); -clear_bit (BTRFS_ROOT_DEAD_RELOC_TREE , &root->state); +clear_reloc_root (root);if (reloc_root) {/* * btrfs_drop_snapshot drops our ref we hold for
@@ -2052,13 +2057,32 @@ void merge_reloc_roots(struct reloc_control *rc) goto out; } ret =merge_reloc_root (rc, root); -btrfs_put_root (root);if (ret) { -if (list_empty (&reloc_root->root_list)) +/* +* Clear the reloc root since below we will call +* free_reloc_roots(), otherwise we leave +* root->reloc_root pointing to a freed reloc +* root and trigger a use-after-free during +* unmount or elsewhere. +*/ +clear_reloc_root (root); +btrfs_put_root (root); +/* +* We are adding the reloc_root to the local +* reloc_roots list, so we add a ref for this +* list which will be dropped below by the call +* to free_reloc_roots(). +*/ +if (list_empty (&reloc_root->root_list)) {list_add_tail (&reloc_root->root_list, &reloc_roots); +btrfs_grab_root (reloc_root); + } +/* Now drop the ref for root->reloc_root. */ +btrfs_put_root (reloc_root); goto out; } +btrfs_put_root (root); }else {if (!IS_ERR (root)) {if (root->reloc_root == reloc_root) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 205/752 btrfs: fix reloc root cleanup in merge_reloc_roots()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit b78fe9563e2d5ae47805f1e5dc722c91fd30e1f8 ]
If the root we got has zero root refs in its root item, we are resetting the root's ->reloc_root without using barriers like we do everywhere else. Sashiko complained about this while reviewing another patch, and it's correct (see the Link tag below).
Also, we should not clear BTRFS_ROOT_DEAD_RELOC_TREE from the root unless the root points to the reloc root we have.
Fix this by using clear_reloc_root(), which issues the memory barrier after setting the root's ->reloc_root to NULL and before clearing the bit BTRFS_ROOT_DEAD_RELOC_TREE from the root.
--- fs/btrfs/relocation.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/btrfs/relocation.c +2 -3
@@ -2086,11 +2086,10 @@ void merge_reloc_roots(struct reloc_control *rc) }else {if (!IS_ERR (root)) {if (root->reloc_root == reloc_root) { - root->reloc_root =NULL ; +clear_reloc_root (root); +/* Drop the ref for root->reloc_root. */ btrfs_put_root (reloc_root); } -clear_bit (BTRFS_ROOT_DEAD_RELOC_TREE , - &root->state);btrfs_put_root (root); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 206/752 wifi: iwlwifi: mvm: fix an off-by-1 boundary check
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit d77aff138c9ec6c8562f4c2c9f262d3d9c4b4cb8 ]
Before looking at the 11th byte, check the length is big enough.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +1 -1
@@ -3039,7 +3039,7 @@ static void iwl_mvm_check_he_obss_narrow_bw_ru_iter(struct wiphy *wiphy, elem =cfg80211_find_elem (WLAN_EID_EXT_CAPABILITY , ies->data, ies->len); -if (!elem || elem->datalen <10 || +if (!elem || elem->datalen <11 || !(elem->data[10 ] &WLAN_EXT_CAPA10_OBSS_NARROW_BW_RU_TOLERANCE_SUPPORT )) { data->tolerated = false;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 207/752 wifi: iwlwifi: mvm: fix sched scan IE sizing
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit 4f155d262b31b9b17e0f9856bdabe0968eb4930f ]
Scheduled scan built the probe request before iwl_mvm_scan_fits(), so oversized IEs could be copied into the fixed preq buffer before length validation. Move iwl_mvm_build_scan_probe() after the fits check.
Also advertise max_sched_scan_ie_len using iwl_mvm_max_scan_ie_len() so userspace limits account for driver-inserted DS/TPC bytes.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 4 +--- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +1 -3
@@ -586,9 +586,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) hw->wiphy->max_sched_scan_reqs =1 ; hw->wiphy->max_sched_scan_ssids =PROBE_OPTION_MAX ; hw->wiphy->max_match_sets =iwl_umac_scan_get_max_profiles (mvm->fw); -/* we create the 802.11 header and zero length SSID IE. */ - hw->wiphy->max_sched_scan_ie_len = -SCAN_OFFLOAD_PROBE_REQ_SIZE -24 -2 ; + hw->wiphy->max_sched_scan_ie_len =iwl_mvm_max_scan_ie_len (mvm); hw->wiphy->max_sched_scan_plans =IWL_MAX_SCHED_SCAN_PLANS ; hw->wiphy->max_sched_scan_plan_interval =U16_MAX ;
drivers/net/wireless/intel/iwlwifi/mvm/scan.c +2 -2
@@ -2746,8 +2746,6 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,if (ret)return ret; -iwl_mvm_build_scan_probe (mvm, vif, ies, ¶ms); -/* for 6 GHZ band only PSC channels need to be added */ for (i =0 ; i < params.n_channels; i++) {struct ieee80211_channel *channel = params.channels[i];
@@ -2781,6 +2779,8 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm, goto out; } +iwl_mvm_build_scan_probe (mvm, vif, ies, ¶ms); + uid =iwl_mvm_build_scan_cmd (mvm, vif, &hcmd, ¶ms, type);if (uid <0 ) { ret = uid;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 208/752 blk-cgroup: fix leaks and online flag on radix_tree_insert failure
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tao Cui <[email protected]>
[ Upstream commit dbbca20764382b4d411ec2918f4e278ffe547acc ]
When radix_tree_insert() fails in blkg_create(), the error path has two issues:
1. blkg->online is set to true unconditionally, even when the blkg was never fully inserted. Move the assignment inside the success block.
2. The error path calls blkg_put() without first calling percpu_ref_kill(). Because the refcount is still in percpu mode, percpu_ref_put() only does this_cpu_sub() without checking for zero, so blkg_release() is never triggered. This permanently leaks the blkg memory, its percpu iostat, policy data, the parent blkg reference, and the cgroup css reference — the latter preventing the cgroup from ever being destroyed.
Fix by replacing blkg_put() with percpu_ref_kill(), matching the pattern used in blkg_destroy().
--- block/blk-cgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
block/blk-cgroup.c +2 -2
@@ -296,15 +296,15 @@ static struct blkcg_gq *blkg_create(struct blkcg *blkcg, blkg->pd[i]->online = true; } } + blkg->online = true; } - blkg->online = true;spin_unlock (&blkcg->lock);if (!ret)return blkg;/* @blkg failed fully initialized, use the usual release path */ -blkg_put (blkg); +percpu_ref_kill (&blkg->refcnt);return ERR_PTR (ret); err_put_css:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 209/752 arm64: fixmap: Allow 256K early_ioremap() at any offset
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Peng <[email protected]>
[ Upstream commit 21fc7ec93f8b633b60d5bddef2f1529ff6b36185 ]
NR_FIX_BTMAPS is the per-slot page limit for early_ioremap(). Since __early_ioremap() maps the page-aligned physical range, a 256K request can require one extra page when the physical address is not page-aligned.
Reserve one extra page per slot so the 256K mapping budget is usable regardless of the initial page offset.
--- arch/arm64/include/asm/fixmap.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm64/include/asm/fixmap.h +5 -1
@@ -73,8 +73,12 @@ enum fixed_addresses {/* * Temporary boot-time mappings, used by early_ioremap(), * before ioremap() is functional. +* +* Reserve one extra page so a 256K mapping may start at any +* offset within a page. early_ioremap() maps the page-aligned +* physical range, so the initial offset can consume an extra page. */ -#define NR_FIX_BTMAPS (SZ_256K / PAGE_SIZE) +#define NR_FIX_BTMAPS ((SZ_256K / PAGE_SIZE) + 1)#define FIX_BTMAPS_SLOTS 7#define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 210/752 arm64: kprobes: Allow reentering kprobes while single-stepping
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pu Hu <[email protected]>
[ Upstream commit 23f851ac0078a908bf3422d6467ebc1db5828c46 ]
A kprobe can be hit while another kprobe is in KPROBE_HIT_SS state. This can happen when tracing or perf code runs from the debug exception path while the first kprobe is preparing or executing its out-of-line single-step instruction.
Currently arm64 treats a kprobe hit in KPROBE_HIT_SS as unrecoverable, the same as a hit in KPROBE_REENTER. This is too strict. A hit in KPROBE_HIT_SS is still a one-level reentry and can be handled by saving the current kprobe state and setting up single-step for the new probe, just like reentry from KPROBE_HIT_ACTIVE or KPROBE_HIT_SSDONE.
The truly unrecoverable case is hitting another kprobe while already in KPROBE_REENTER, because the reentry save area has already been consumed.
Move KPROBE_HIT_SS to the recoverable reentry cases and leave KPROBE_REENTER as the unrecoverable nested reentry case.
This change also requires saving saved_irqflag in struct prev_kprobe. When a nested kprobe calls kprobes_save_local_irqflag(), it overwrites kcb->saved_irqflag with the currently masked DAIF value, losing the outer kprobe's original DAIF state. Without this fix, when the outer kprobe's single-step finishes, kprobes_restore_local_irqflag() applies the wrong DAIF mask and leaves interrupts permanently disabled.
Extend struct prev_kprobe with a saved_irqflag field and save/restore it alongside kp and status. This ensures the outer kprobe's original interrupt state is preserved across reentry.
This mirrors the x86 fix in commit 6a5022a56ac3 ("kprobes/x86: Allow to handle reentered kprobe on single-stepping").
--- arch/arm64/include/asm/kprobes.h | 6 ++++++ arch/arm64/kernel/probes/kprobes.c | 23 ++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-)
arch/arm64/include/asm/kprobes.h +6 -0
@@ -26,6 +26,12 @@struct prev_kprobe {struct kprobe *kp;unsigned int status; + +/* +* The original DAIF state of the outer kprobe, saved here before +* a nested kprobe overwrites kcb->saved_irqflag during reentry. +*/ +unsigned long saved_irqflag; };/* per-cpu kprobe control block */
arch/arm64/kernel/probes/kprobes.c +22 -1
@@ -150,12 +150,27 @@ static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) { kcb->prev_kprobe.kp =kprobe_running (); kcb->prev_kprobe.status = kcb->kprobe_status; + +/* +* Save the outer kprobe's original DAIF flags before the nested +* kprobe calls kprobes_save_local_irqflag() and overwrites +* kcb->saved_irqflag. Without this, the outer kprobe will restore +* the wrong DAIF state and leave interrupts permanently masked. +*/ + kcb->prev_kprobe.saved_irqflag = kcb->saved_irqflag; }static void __kprobes restore_previous_kprobe (struct kprobe_ctlblk *kcb) {__this_cpu_write (current_kprobe, kcb->prev_kprobe.kp); kcb->kprobe_status = kcb->prev_kprobe.status; + +/* +* Restore the outer kprobe's saved_irqflag so that when its +* single-step completes, kprobes_restore_local_irqflag() uses +* the correct original DAIF value. +*/ + kcb->saved_irqflag = kcb->prev_kprobe.saved_irqflag; }static void __kprobes set_current_kprobe (struct kprobe *p)
@@ -216,10 +231,16 @@ static int __kprobes reenter_kprobe(struct kprobe *p,switch (kcb->kprobe_status) {case KPROBE_HIT_SSDONE :case KPROBE_HIT_ACTIVE : +case KPROBE_HIT_SS : +/* +* A probe can be hit while another kprobe is preparing or +* executing its XOL single-step instruction. This is still a +* recoverable one-level reentry, so handle it in the same way as +* reentry from KPROBE_HIT_ACTIVE or KPROBE_HIT_SSDONE. +*/ kprobes_inc_nmissed_count (p);setup_singlestep (p, regs, kcb,1 );break ; -case KPROBE_HIT_SS :case KPROBE_REENTER :pr_warn ("Failed to recover from reentered kprobes.\n" );dump_kprobe (p);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 211/752 drm/amd/pm/si: Dont schedule thermal work when queue isnt initialized
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Kristóf <[email protected]>
[ Upstream commit f8922d5a946699fc2bdc7660e6778bd6726bf8b8 ]
When DPM is turned off with the amdgpu.dpm=0 module parameter, the thermal work queue isn't initialized so we shouldn't schedule any work on it.
--- drivers/gpu/drm/amd/pm/powerplay/si_dpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/si_dpm.c +1 -1
@@ -7592,7 +7592,7 @@ static int si_dpm_process_interrupt(struct amdgpu_device *adev,break ; } -if (queue_thermal) +if (queue_thermal && amdgpu_dpm)schedule_work (&adev->pm.dpm.thermal.work);return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 212/752 wifi: iwlwifi: bound aligned TLV advance in FW parser
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit acad742714bdc70e7fd7f234323807c596828213 ]
Validate ALIGN(tlv_len, 4) against remaining parser length before consuming bytes from the firmware image.
This avoids length underflow on malformed TLVs.
--- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-drv.c +11 -2
@@ -571,6 +571,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,u32 build, paging_mem_size;int num_of_cpus;bool usniffer_req = false; +size_t aligned_tlv_len;if (len <sizeof (*ucode)) {IWL_ERR (drv,"uCode has invalid length: %zd\n" , len);
@@ -619,8 +620,16 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, len, tlv_len);return -EINVAL ; } - len -=ALIGN (tlv_len,4 ); - data +=sizeof (*tlv) +ALIGN (tlv_len,4 ); + + aligned_tlv_len =ALIGN (tlv_len,4 ); +if (len < aligned_tlv_len) { +IWL_ERR (drv,"invalid aligned TLV len: %zd/%zu\n" , + len, aligned_tlv_len); +return -EINVAL ; + } + + len -= aligned_tlv_len; + data +=sizeof (*tlv) + aligned_tlv_len;switch (tlv_type) {case IWL_UCODE_TLV_INST :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 213/752 ALSA: usb-audio: Add FIXED_RATE quirk for JBL Quantum650 Wireless
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel C. Ribeiro <[email protected]>
[ Upstream commit f6d6a4147ace0c417035f65b021027c209c75190 ]
JBL Quantum650 Wireless (0ecb:2125) requires the same workaround that was used for JBL Quantum610 and Quantum810 for limiting the sample rate. Without it, the capture (microphone) stream fails to work. Setting the QUIRK_FLAG_FIXED_RATE flag, as done for the sibling models, makes both playback and capture work correctly.
--- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/quirks.c +2 -0
@@ -1851,6 +1851,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_CTL_MSG_DELAY_1M),DEVICE_FLG (0x0ecb ,0x205c ,/* JBL Quantum610 Wireless */ QUIRK_FLAG_FIXED_RATE ), +DEVICE_FLG (0x0ecb ,0x2125 ,/* JBL Quantum650 Wireless */ +QUIRK_FLAG_FIXED_RATE ),DEVICE_FLG (0x0ecb ,0x2069 ,/* JBL Quantum810 Wireless */ QUIRK_FLAG_FIXED_RATE ), DEVICE_FLG(0x0fd9, 0x0008, /* Hauppauge HVR-950Q */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 214/752 wifi: mwifiex: replace one-element arrays with flexible array members
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Georgi Valkov <[email protected]>
[ Upstream commit 1cb5845a58d8e1f85d5766c6fbcbfddf96c212a1 ]
Replace deprecated one-element arrays with flexible array members. CONFIG_FORTIFY_SOURCE reports the following warning when one-element arrays are used as variable-length buffers:
sta_cmd.c:1033 mwifiex_sta_prepare_cmd
memcpy: detected field-spanning write (size 84) of single field "domain->triplet" at .../marvell/mwifiex/sta_cmd.c:1033 (size 3)
Convert affected structs to use flexible array members.
- Preserve existing wire layouts.
- Use DECLARE_FLEX_ARRAY() for structs inside affected unions.
Tested-on: WRT3200ACM, OpenWrt
--- drivers/net/wireless/marvell/mwifiex/fw.h | 18 +++++++++--------- drivers/net/wireless/marvell/mwifiex/join.c | 8 ++++---- drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-)
drivers/net/wireless/marvell/mwifiex/fw.h +9 -9
@@ -802,7 +802,7 @@ struct chan_band_param_set {struct mwifiex_ie_types_chan_band_list_param_set {struct mwifiex_ie_types_header header; -struct chan_band_param_set chan_band_param[1 ]; +struct chan_band_param_set chan_band_param[]; } __packed;struct mwifiex_ie_types_rates_param_set {
@@ -860,7 +860,7 @@ struct mwifiex_ie_types_wildcard_ssid_params {#define TSF_DATA_SIZE 8struct mwifiex_ie_types_tsf_timestamp {struct mwifiex_ie_types_header header; -u8 tsf_data[1 ]; +u8 tsf_data[]; } __packed;struct mwifiex_cf_param_set {
@@ -877,8 +877,8 @@ struct mwifiex_ibss_param_set {struct mwifiex_ie_types_ss_param_set {struct mwifiex_ie_types_header header;union { -struct mwifiex_cf_param_set cf_param_set[1 ]; -struct mwifiex_ibss_param_set ibss_param_set[1 ]; + DECLARE_FLEX_ARRAY(struct mwifiex_cf_param_set, cf_param_set); + DECLARE_FLEX_ARRAY(struct mwifiex_ibss_param_set, ibss_param_set); } cf_ibss; } __packed;
@@ -896,8 +896,8 @@ struct mwifiex_ds_param_set {struct mwifiex_ie_types_phy_param_set {struct mwifiex_ie_types_header header;union { -struct mwifiex_fh_param_set fh_param_set[1 ]; -struct mwifiex_ds_param_set ds_param_set[1 ]; + DECLARE_FLEX_ARRAY(struct mwifiex_fh_param_set, fh_param_set); + DECLARE_FLEX_ARRAY(struct mwifiex_ds_param_set, ds_param_set); } fh_ds; } __packed;
@@ -1349,7 +1349,7 @@ struct host_cmd_ds_802_11_snmp_mib {__le16 query_type;__le16 oid;__le16 buf_size; -u8 value[1 ]; +u8 value[]; } __packed;struct mwifiex_rate_scope {
@@ -1517,7 +1517,7 @@ struct mwifiex_scan_cmd_config {* TLV_TYPE_CHANLIST, mwifiex_ie_types_chan_list_param_set * WLAN_EID_SSID, mwifiex_ie_types_ssid_param_set */ -u8 tlv_buf[1 ];/* SSID TLV(s) and ChanList TLVs are stored +u8 tlv_buf[];/* SSID TLV(s) and ChanList TLVs are stored here */ } __packed;
@@ -1649,7 +1649,7 @@ struct host_cmd_ds_802_11_bg_scan_query_rsp {struct mwifiex_ietypes_domain_param_set {struct mwifiex_ie_types_header header;u8 country_code[IEEE80211_COUNTRY_STRING_LEN ]; -struct ieee80211_country_ie_triplet triplet[1 ]; +struct ieee80211_country_ie_triplet triplet[]; } __packed;struct host_cmd_ds_802_11d_domain_info {
drivers/net/wireless/marvell/mwifiex/join.c +4 -4
@@ -431,15 +431,15 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv, phy_tlv = (struct mwifiex_ie_types_phy_param_set *) pos; phy_tlv->header.type =cpu_to_le16 (WLAN_EID_DS_PARAMS ); - phy_tlv->header.len =cpu_to_le16 (sizeof (phy_tlv->fh_ds.ds_param_set)); -memcpy (&phy_tlv->fh_ds.ds_param_set, + phy_tlv->header.len =cpu_to_le16 (sizeof (*phy_tlv->fh_ds.ds_param_set)); +memcpy (phy_tlv->fh_ds.ds_param_set, &bss_desc->phy_param_set.ds_param_set.current_chan, -sizeof (phy_tlv->fh_ds.ds_param_set)); +sizeof (*phy_tlv->fh_ds.ds_param_set)); pos +=sizeof (phy_tlv->header) +le16_to_cpu (phy_tlv->header.len); ss_tlv = (struct mwifiex_ie_types_ss_param_set *) pos; ss_tlv->header.type =cpu_to_le16 (WLAN_EID_CF_PARAMS ); - ss_tlv->header.len =cpu_to_le16 (sizeof (ss_tlv->cf_ibss.cf_param_set)); + ss_tlv->header.len =cpu_to_le16 (sizeof (*ss_tlv->cf_ibss.cf_param_set)); pos +=sizeof (ss_tlv->header) +le16_to_cpu (ss_tlv->header.len);/* Get the common rates supported between the driver and the BSS Desc */
drivers/net/wireless/marvell/mwifiex/sta_cmd.c +1 -1
@@ -120,7 +120,7 @@ static int mwifiex_cmd_802_11_snmp_mib(struct mwifiex_private *priv, "cmd: SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid); cmd->command =cpu_to_le16 (HostCmd_CMD_802_11_SNMP_MIB); cmd->size =cpu_to_le16 (sizeof (struct host_cmd_ds_802_11_snmp_mib ) - -1 +S_DS_GEN ); + +S_DS_GEN ); snmp_mib->oid =cpu_to_le16 ((u16 )cmd_oid);if (cmd_action == HostCmd_ACT_GEN_GET) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 215/752 regulator: core: clamp voltage constraints before applying apply_uV
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kamal Wadhwa <[email protected]>
[ Upstream commit a45cc646a3aa83eb4ab4c7ed2685785ea51dc5e6 ]
machine_constraints_voltage() currently applies apply_uV against the machine-supplied [min_uV, max_uV] range, and only afterwards clamps that range down to what the regulator can actually supply (via ops->list_voltage()).
If the machine-supplied range is wider than the regulator's actual range, apply_uV's rounding can pick a selector outside the (correct) clamped range, so the regulator ends up programmed outside its clamped min/max. At bring-up this shows up as a voltage read-back outside the clamped range.
Fix this by moving the clamping block ahead of the apply_uV block, so apply_uV always targets an already-clamped range. Whether apply_uV should run is decided from the unclamped constraints beforehand and stored in a local bool, since clamping must not itself change whether apply_uV fires.
No functional change to the clamping logic itself, only its position relative to apply_uV. Its early return 0 exits become fallthroughs since the apply_uV logic now follows it.
--- drivers/regulator/core.c | 163 +++++++++++++++++++++------------------ 1 file changed, 90 insertions(+), 73 deletions(-)
drivers/regulator/core.c +90 -73
@@ -1199,10 +1199,98 @@ static int machine_constraints_voltage(struct regulator_dev *rdev, {const struct regulator_ops *ops = rdev->desc->ops;int ret; +bool apply_uV; + +/* +* Decide up front, from the constraints as handed to us, whether +* apply_uV needs to run below. The clamping pass right after this +* may rewrite constraints->min_uV/max_uV (e.g. the fixed-voltage +* autoconfigure case), and we don't want that to change whether +* apply_uV fires. +*/ + apply_uV = rdev->constraints->apply_uV && + rdev->constraints->min_uV && rdev->constraints->max_uV; + +/* +* Constrain machine-level voltage specs to fit the actual range +* supported by this regulator before apply_uV (below) tries to +* force hardware to a value from that range: otherwise apply_uV +* can target a constraint value that doesn't correspond to any +* real voltage selector and fail registration outright, even +* though the clamping pass would have narrowed it to a value +* the regulator can actually hit. +*/ +if (ops->list_voltage && rdev->desc->n_voltages) { +int count = rdev->desc->n_voltages; +int i; +int min_uV =INT_MAX ; +int max_uV =INT_MIN ; +int cmin = constraints->min_uV; +int cmax = constraints->max_uV; + +/* it's safe to autoconfigure fixed-voltage supplies +* and the constraints are used by list_voltage. +*/ +if (count ==1 && !cmin) { + cmin =1 ; + cmax =INT_MAX ; + constraints->min_uV = cmin; + constraints->max_uV = cmax; + } + +/* voltage constraints are optional */ +if ((cmin ==0 ) && (cmax ==0 )) { +/* nothing more to do */ + +/* else require explicit machine-level constraints */ + }else if (cmin <=0 || cmax <=0 || cmax < cmin) { +rdev_err (rdev,"invalid voltage constraints\n" ); +return -EINVAL ; + +/* no need to loop voltages if range is continuous */ + }else if (rdev->desc->continuous_voltage_range) { +/* nothing more to do */ + + }else { +/* initial: [cmin..cmax] valid, [min_uV..max_uV] not */ +for (i =0 ; i < count; i++) { +int value; + + value = ops->list_voltage (rdev, i); +if (value <=0 ) +continue ; + +/* maybe adjust [min_uV..max_uV] */ +if (value >= cmin && value < min_uV) + min_uV = value; +if (value <= cmax && value > max_uV) + max_uV = value; + } + +/* final: [min_uV..max_uV] valid iff constraints valid */ +if (max_uV < min_uV) { +rdev_err (rdev, +"unsupportable voltage constraints %u-%uuV\n" , + min_uV, max_uV); +return -EINVAL ; + } + +/* use regulator's subset of machine constraints */ +if (constraints->min_uV < min_uV) { +rdev_dbg (rdev,"override min_uV, %d -> %d\n" , + constraints->min_uV, min_uV); + constraints->min_uV = min_uV; + } +if (constraints->max_uV > max_uV) { +rdev_dbg (rdev,"override max_uV, %d -> %d\n" , + constraints->max_uV, max_uV); + constraints->max_uV = max_uV; + } + } + }/* do we need to apply the constraint voltage */ -if (rdev->constraints->apply_uV && - rdev->constraints->min_uV && rdev->constraints->max_uV) { +if (apply_uV) {int target_min, target_max;int current_uV =regulator_get_voltage_rdev (rdev);
@@ -1256,77 +1344,6 @@ static int machine_constraints_voltage(struct regulator_dev *rdev, } } -/* constrain machine-level voltage specs to fit -* the actual range supported by this regulator. -*/ -if (ops->list_voltage && rdev->desc->n_voltages) { -int count = rdev->desc->n_voltages; -int i; -int min_uV =INT_MAX ; -int max_uV =INT_MIN ; -int cmin = constraints->min_uV; -int cmax = constraints->max_uV; - -/* it's safe to autoconfigure fixed-voltage supplies -* and the constraints are used by list_voltage. -*/ -if (count ==1 && !cmin) { - cmin =1 ; - cmax =INT_MAX ; - constraints->min_uV = cmin; - constraints->max_uV = cmax; - } - -/* voltage constraints are optional */ -if ((cmin ==0 ) && (cmax ==0 )) -return 0 ; - -/* else require explicit machine-level constraints */ -if (cmin <=0 || cmax <=0 || cmax < cmin) { -rdev_err (rdev,"invalid voltage constraints\n" ); -return -EINVAL ; - } - -/* no need to loop voltages if range is continuous */ -if (rdev->desc->continuous_voltage_range) -return 0 ; - -/* initial: [cmin..cmax] valid, [min_uV..max_uV] not */ -for (i =0 ; i < count; i++) { -int value; - - value = ops->list_voltage (rdev, i); -if (value <=0 ) -continue ; - -/* maybe adjust [min_uV..max_uV] */ -if (value >= cmin && value < min_uV) - min_uV = value; -if (value <= cmax && value > max_uV) - max_uV = value; - } - -/* final: [min_uV..max_uV] valid iff constraints valid */ -if (max_uV < min_uV) { -rdev_err (rdev, -"unsupportable voltage constraints %u-%uuV\n" , - min_uV, max_uV); -return -EINVAL ; - } - -/* use regulator's subset of machine constraints */ -if (constraints->min_uV < min_uV) { -rdev_dbg (rdev,"override min_uV, %d -> %d\n" , - constraints->min_uV, min_uV); - constraints->min_uV = min_uV; - } -if (constraints->max_uV > max_uV) { -rdev_dbg (rdev,"override max_uV, %d -> %d\n" , - constraints->max_uV, max_uV); - constraints->max_uV = max_uV; - } - } -return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 216/752 wifi: mac80211_hwsim: reject undersized HWSIM_ATTR_TX_INFO
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ibrahim Hashimov <[email protected]>
[ Upstream commit 3dc723ac78a6e4fa0fd49e27e487ed319da40a9f ]
hwsim_tx_info_frame_received_nl() casts the HWSIM_ATTR_TX_INFO payload to a struct hwsim_tx_rate * and unconditionally reads IEEE80211_TX_MAX_RATES entries (8 bytes) from it. The policy only bounds the attribute from above (NLA_BINARY .len is a maximum) and the op sets GENL_DONT_VALIDATE_STRICT, so a short or zero-length attribute is accepted and the loop reads past the payload.
Require the exact length in the policy, so a malformed attribute is rejected before the handler runs.
--- drivers/net/wireless/mac80211_hwsim.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/mac80211_hwsim.c +3 -3
@@ -738,9 +738,9 @@ static const struct nla_policy hwsim_genl_policy[HWSIM_ATTR_MAX + 1] = { [HWSIM_ATTR_FLAGS] = { .type = NLA_U32 }, [HWSIM_ATTR_RX_RATE] = { .type = NLA_U32 }, [HWSIM_ATTR_SIGNAL] = { .type = NLA_U32 }, - [HWSIM_ATTR_TX_INFO] = { .type = NLA_BINARY, - .len =IEEE80211_TX_MAX_RATES * - sizeof(struct hwsim_tx_rate)}, + [HWSIM_ATTR_TX_INFO ] = +NLA_POLICY_EXACT_LEN (IEEE80211_TX_MAX_RATES * + sizeof(struct hwsim_tx_rate)), [HWSIM_ATTR_COOKIE] = { .type = NLA_U64 }, [HWSIM_ATTR_CHANNELS] = { .type = NLA_U32 }, [HWSIM_ATTR_RADIO_ID] = { .type = NLA_U32 },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 217/752 drm/gma500: return errors from Oaktrail HDMI I2C reads
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 9b5ce5c496efd20c1c662cedba88465d39ec1f93 ]
xfer_read() waits for the HDMI I2C transaction to reach I2C_TRANSACTION_DONE, but it ignores both timeout and signal returns from wait_for_completion_interruptible_timeout(). If the interrupt never advances the transaction state, the loop can wait forever.
Return -ETIMEDOUT when the completion wait expires, propagate interrupted waits, and make the I2C master_xfer callback return the first transfer error instead of reporting a successful message count.
--- drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c +16 -5
@@ -95,6 +95,7 @@ static int xfer_read(struct i2c_adapter *adap, struct i2c_msg *pmsg)struct oaktrail_hdmi_dev *hdmi_dev =i2c_get_adapdata (adap);struct hdmi_i2c_dev *i2c_dev = hdmi_dev->i2c_dev;u32 temp; +int ret; i2c_dev->status =I2C_STAT_INIT ; i2c_dev->msg = pmsg;
@@ -106,9 +107,14 @@ static int xfer_read(struct i2c_adapter *adap, struct i2c_msg *pmsg)HDMI_WRITE (HDMI_HI2CHCR , temp);HDMI_READ (HDMI_HI2CHCR ); -while (i2c_dev->status !=I2C_TRANSACTION_DONE ) -wait_for_completion_interruptible_timeout (&i2c_dev->complete, +while (i2c_dev->status !=I2C_TRANSACTION_DONE ) { + ret =wait_for_completion_interruptible_timeout (&i2c_dev->complete,10 *HZ ); +if (ret <0 ) +return ret; +if (!ret) +return -ETIMEDOUT ; + }return 0 ; }
@@ -127,7 +133,7 @@ static int oaktrail_hdmi_i2c_access(struct i2c_adapter *adap, {struct oaktrail_hdmi_dev *hdmi_dev =i2c_get_adapdata (adap);struct hdmi_i2c_dev *i2c_dev = hdmi_dev->i2c_dev; -int i; +int i, ret =0 ;mutex_lock (&i2c_dev->i2c_lock);
@@ -139,9 +145,11 @@ static int oaktrail_hdmi_i2c_access(struct i2c_adapter *adap,for (i =0 ; i < num; i++) {if (pmsg->len && pmsg->buf) {if (pmsg->flags &I2C_M_RD ) -xfer_read (adap, pmsg); + ret =xfer_read (adap, pmsg);else -xfer_write (adap, pmsg); + ret =xfer_write (adap, pmsg); +if (ret) +break ; } pmsg++;/* next message */ }
@@ -151,6 +159,9 @@ static int oaktrail_hdmi_i2c_access(struct i2c_adapter *adap,mutex_unlock (&i2c_dev->i2c_lock); +if (ret) +return ret; +return i; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 218/752 phonet: check register_netdevice_notifier() error in phonet_device_init()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Minhong He <[email protected]>
[ Upstream commit d1ff66b66151c14b084e88040512a064b1c1e493 ]
phonet_device_init() registers a netdevice notifier before calling phonet_netlink_register(), but does not check whether notifier registration succeeded. On failure, netlink setup still proceeds and init may return success without the notifier in place.
Also, the existing phonet_netlink_register() failure path called phonet_device_exit(), which runs rtnl_unregister_all() even though rtnl_register_many() already unwound any partial registration. Calling the full exit helper on a partial init is not correct.
Check each registration error, including proc_create_net(), and unwind only the steps that have succeeded so far, in reverse order.
--- net/phonet/pn_dev.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-)
net/phonet/pn_dev.c +24 -6
@@ -336,16 +336,34 @@ static struct pernet_operations phonet_net_ops = {/* Initialize Phonet devices list */ int __init phonet_device_init (void ) { -int err =register_pernet_subsys (&phonet_net_ops); +int err; + + err =register_pernet_subsys (&phonet_net_ops);if (err)return err; -proc_create_net ("pnresource" ,0 , init_net.proc_net, &pn_res_seq_ops, -sizeof (struct seq_net_private )); -register_netdevice_notifier (&phonet_device_notifier); +if (!proc_create_net ("pnresource" ,0 , init_net.proc_net, + &pn_res_seq_ops,sizeof (struct seq_net_private ))) { + err = -ENOMEM ; + goto err_pernet; + } + + err =register_netdevice_notifier (&phonet_device_notifier); +if (err) + goto err_proc; + err =phonet_netlink_register ();if (err) -phonet_device_exit (); + goto err_notifier; + +return 0 ; + +err_notifier: +unregister_netdevice_notifier (&phonet_device_notifier); +err_proc: +remove_proc_entry ("pnresource" , init_net.proc_net); +err_pernet: +unregister_pernet_subsys (&phonet_net_ops);return err; }
@@ -353,8 +371,8 @@ void phonet_device_exit(void) {rtnl_unregister_all (PF_PHONET );unregister_netdevice_notifier (&phonet_device_notifier); -unregister_pernet_subsys (&phonet_net_ops);remove_proc_entry ("pnresource" , init_net.proc_net); +unregister_pernet_subsys (&phonet_net_ops); }int phonet_route_add (struct net_device *dev,u8 daddr)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 219/752 ALSA: hda/realtek: Add mute LED quirk for HP Laptop 14s-dr1xxx
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Madhavender Singh <[email protected]>
[ Upstream commit bf4fc9f33ec21595143132a3e7fb8b5d2c2261cd ]
This laptop with an ALC236 codec requires theALC236_FIXUP_HP_MUTE_LED_COEFBIT2
fixup for its mute LED to function correctly.
Add the subsystem ID 0x103c:0x86c8 to the quirk table to apply this fixup.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -9329,6 +9329,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x869d ,"HP" ,ALC236_FIXUP_HP_MUTE_LED ),SND_PCI_QUIRK (0x103c ,0x86c1 ,"HP Laptop 15-da3001TU" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x86c7 ,"HP Envy AiO 32" ,ALC274_FIXUP_HP_ENVY_GPIO ), +SND_PCI_QUIRK (0x103c ,0x86c8 ,"HP Laptop 14s-dr1xxx" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x86e7 ,"HP Spectre x360 15-eb0xxx" ,ALC285_FIXUP_HP_SPECTRE_X360_EB1 ),SND_PCI_QUIRK (0x103c ,0x863e ,"HP Spectre x360 15-df1xxx" ,ALC285_FIXUP_HP_SPECTRE_X360_DF1 ), SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 220/752 ice: pass the return value of skb_checksum_help()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Swiatkowski <[email protected]>
[ Upstream commit 2d19302f628853742c4828381abbd668c1315598 ]
skb_checksum_help() can fail. Pass its return value back to the caller.
Commonize this software path in goto.
Instead of just returning error try calculating software checksum first. There is a check for TSO in checksum_sw_fb.
--- drivers/net/ethernet/intel/ice/ice_txrx.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/ice/ice_txrx.c +9 -11
@@ -1709,7 +1709,7 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off) ret =ipv6_skip_exthdr (skb, exthdr - skb->data, &l4_proto, &frag_off);if (ret <0 ) -return -1 ; + goto checksum_sw_fb; }/* define outer transport */
@@ -1728,11 +1728,7 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off) l4.hdr =skb_inner_network_header (skb);break ;default : -if (first->tx_flags &ICE_TX_FLAGS_TSO ) -return -1 ; - -skb_checksum_help (skb); -return 0 ; + goto checksum_sw_fb; }/* compute outer L3 header size */
@@ -1791,7 +1787,7 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off)ipv6_skip_exthdr (skb, exthdr - skb->data, &l4_proto, &frag_off); }else { -return -1 ; + goto checksum_sw_fb; }/* compute inner L3 header size */
@@ -1820,15 +1816,17 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off)break ;default : -if (first->tx_flags &ICE_TX_FLAGS_TSO ) -return -1 ; -skb_checksum_help (skb); -return 0 ; + goto checksum_sw_fb; } off->td_cmd |= cmd; off->td_offset |= offset;return 1 ; + +checksum_sw_fb: +if (first->tx_flags &ICE_TX_FLAGS_TSO ) +return -1 ; +return skb_checksum_help (skb); }/**
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 221/752 powerpc/pseries: Ensure vpa,slb_shadow & dtl are unregistered during crash
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vaibhav Jain <[email protected]>
[ Upstream commit 810d07fb4cf7577847f85a6fd6273b69cad8d580 ]
Currently pseries_kexec_cpu_down() skips unregistering vpa, slb_shadow and dtl areas during a crash and kexec shutdown path. It was done to avoid doing an HCALL while crashing. However recently Anushree reported that during kernel crash while the kdump kernel was coming up, Hypervisor reported invalid values for 'vpa.yield_count' while it dispatching L2-KVM Guest vcpus. The error manifested as debug build Hypervisor assert triggering to indicate possible VPA corruption.
Looking at the kexec cpu offline path it was discovered that during crash kernel doesn't unregister the VPA/SLB-Shadow/DTL area with Hypervisor. Instead it re-allocates and re-registers these areas for cpus during boot. During kexec boot the previously allocated areas can get overwritten with new content without hypervisor knowledge. This creates a small window where while kexec kernel boots and the L2-VCPUs are being dispatched, Hypervisor may try to read/write to a wrong memory area which previously belonged to older VPA.
Fix this possible race and memory corruption by updating pseries_kexec_cpu_down() to also unregister vpa,slb_shadow & dtl areas during a kernel crash.
--- arch/powerpc/platforms/pseries/kexec.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
arch/powerpc/platforms/pseries/kexec.c +8 -5
@@ -20,12 +20,15 @@void pseries_kexec_cpu_down (int crash_shutdown,int secondary) {/* -* Don't risk a hypervisor call if we're crashing -* XXX: Why? The hypervisor is not crashing. It might be better -* to at least attempt unregister to avoid the hypervisor stepping -* on our memory. +* Ensure vpa/slb_shadow/dtl cleanup even while we are crashing. +* Why? The hypervisor is not crashing so at least attempt unregister to +* avoid the hypervisor stepping on our memory. If hypervisor or kexec +* kernel steps on the old memory allocated to these areas before the +* new kexec-kernel happens to allocate and register new areas, +* the hypervisor will see invalid content which may cause +* unexpected behavior. */ -if (firmware_has_feature (FW_FEATURE_SPLPAR ) && !crash_shutdown) { +if (firmware_has_feature (FW_FEATURE_SPLPAR )) {int ret;int cpu =smp_processor_id ();int hwcpu =hard_smp_processor_id ();
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 222/752 cifs: validate idmap key payload length
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Qiang <[email protected]>
[ Upstream commit 455488cd5054bcc59db40fa1cc2c004031a5b2a5 ]
The cifs.idmap key type stores its payload length in key->datalen, which is limited to U16_MAX. Accepting a larger key payload truncates the recorded length and can make later users interpret the payload using inconsistent bounds.
Reject oversized preparsed payloads before allocating or copying them. This keeps key->datalen consistent with the stored data for both inline and separately allocated idmap payloads.
--- fs/cifs/cifsacl.c | 3 +++ 1 file changed, 3 insertions(+)
fs/cifs/cifsacl.c +3 -0
@@ -64,6 +64,9 @@ cifs_idmap_key_instantiate(struct key *key, struct key_preparsed_payload *prep) {char *payload; +if (prep->datalen >U16_MAX ) +return -EINVAL ; +/* * If the payload is less than or equal to the size of a pointer, then * an allocation here is wasteful. Just copy the data directly to the
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 223/752 wifi: cfg80211: validate IEs in cfg80211_wext_siwgenie()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deepanshu Kartikey <[email protected]>
[ Upstream commit a2f5286ca4f304d3fd469f01b96b518608912a5c ]
The KASAN allocation trace shows that a malformed IE buffer is stored via SIOCSIWGENIE (cfg80211_wext_siwgenie()) without any validation. The crash trace shows that a subsequent SIOCSIWESSID triggers a connection attempt which calls cfg80211_sme_get_conn_ies() to process the stored IE buffer, causing:
- An out-of-bounds read in skip_ie() which reads ies[pos+1] (the length byte) past the end of the 1-byte buffer.
- An integer underflow in the memcpy size argument when offs returned by ieee80211_ie_split() exceeds ies_len, causing unsigned subtraction to wrap to SIZE_MAX and triggering a fortify panic.
Fix this by validating the IE buffer in cfg80211_wext_siwgenie() before storing it.
--- net/wireless/wext-sme.c | 9 +++++++++ 1 file changed, 9 insertions(+)
net/wireless/wext-sme.c +9 -0
@@ -333,6 +333,15 @@ int cfg80211_wext_siwgenie(struct net_device *dev, goto out;if (ie_len) { +const struct element *elem; + +for_each_element (elem, extra, ie_len) { +/* nothing */ + } + +if (!for_each_element_completed (elem, extra, ie_len)) +return -EINVAL ; + ie =kmemdup (extra, ie_len,GFP_KERNEL );if (!ie) { err = -ENOMEM ;
Signature · 1 line
2.53.0
Re: [PATCH 5.15 223/752] wifi: cfg80211: validate IEs in cfg80211_wext_siwgenie()
Hi Greg/Sasha,
Quoted 42 lines · Greg Kroah-Hartman
5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deepanshu Kartikey <[email protected]>
[ Upstream commit
a2f5286ca4f304d3fd469f01b96b518608912a5c]The KASAN allocation trace shows that a malformed IE buffer is stored via SIOCSIWGENIE (
cfg80211_wext_siwgenie()) without any validation. The crash trace shows that a subsequent SIOCSIWESSID triggers a connection attempt which callscfg80211_sme_get_conn_ies()to process the stored IE buffer, causing:- An out-of-bounds read in
skip_ie()which reads ies[pos+1] (the length byte) past the end of the 1-byte buffer.- An integer underflow in the memcpy size argument when offs returned by
ieee80211_ie_split()exceedsies_len, causing unsigned subtraction to wrap toSIZE_MAXand triggering a fortify panic.Fix this by validating the IE buffer in
cfg80211_wext_siwgenie()before storing it.Reported-by [email protected]Signed-off-by Deepanshu Kartikey <[email protected]>[drop unnecessary ie_len check, update commit message]Signed-off-by Johannes Berg <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- net/wireless/wext-sme.c | 9 +++++++++ 1 file changed, 9 insertions(+)net/wireless/wext-sme.c +0
-0@@ -333,6 +333,15 @@ int cfg80211_wext_siwgenie(struct net_device *dev, goto out;
net/wireless/wext-sme.c int cfg80211_wext_siwgenie(struct net_device *dev, · line 343
Quoted 10 lines
net/wireless/wext-sme.c +8
-0if (ie_len) { +const struct element *elem; + +for_each_element (elem, extra, ie_len) { +/* nothing */ + } + +if (!for_each_element_completed (elem, extra, ie_len)) +return -EINVAL ;
^^
An AI assisted review flagged a lock-cleanup issue in the WEXT IE validation backport. I checked 09c42d99d893 against upstream and 5.15.y at d7aa8488b4a2. The validation is present, but the new return needs an adaptation to the destination's explicit locking.
Upstream a2f5286ca4f uses a scoped guard before validation and can safely return directly (net/wireless/wext-sme.c:314 and 328; intervening code omitted):
guard(wiphy)(wdev->wiphy);
if (!for_each_element_completed(elem, extra, ie_len))
return -EINVAL;5.15.y takes wdev_lock() and copies that direct return (the same file:327 and 342; intervening code omitted):
wdev_lock(wdev);
if (!for_each_element_completed(elem, extra, ie_len))
return -EINVAL;Malformed IE data now returns -EINVAL while still holding wdev->mtx, blocking later operations that need that mutex. The upstream scoped guard releases it automatically; 5.15.y's explicit lock requires its existing out cleanup.
I would suggest keeping the validation and replacing the direct return with err = -EINVAL; goto out; so rejection reaches wdev_unlock().
thanks,
Harshit
Quoted 4 lines
net/wireless/wext-sme.c +1
-0+ ie =kmemdup (extra, ie_len,GFP_KERNEL );if (!ie) { err = -ENOMEM ;
Sasha Levin
maintainerRe: [PATCH 5.15 223/752] wifi: cfg80211: validate IEs in cfg80211_wext_siwgenie()
Quoted 2 lines
I would suggest keeping the validation and replacing the direct return with err =
-EINVAL; goto out; so rejection reacheswdev_unlock().
Agreed. This already shipped in 5.15.222, and the same bare return is in 6.6.158 (where it also leaks the wiphy mutex), 6.1.189 and 5.10.271. 6.12 and newer use guard(wiphy) and are fine.
Could you send that as a stable-only fix for 6.6.y, 6.1.y, 5.15.y and 5.10.y, each with a Fixes: tag for that tree's commit?
Signature · 2 lines
Thanks, Sasha
Greg Kroah-Hartman
maintainerPATCH 224/752 Bluetooth: RFCOMM: validate skb length in rfcomm_recv_frame
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <[email protected]>
[ Upstream commit b230e5bf501c5edaf2eb0991cb862ac142031d4b ]
rfcomm_recv_frame() casts skb->data to struct rfcomm_hdr and dereferences hdr->addr and hdr->ctrl without validating skb->len first. A truncated frame with skb->len less than the minimum header size causes an out-of-bounds read of uninitialized memory. Additionally, a zero-length frame causes skb->len-- to underflow to UINT_MAX, making skb_tail_pointer() read far past the buffer.
Commit 23882b828c3c ("Bluetooth: RFCOMM: validate skb length in MCC handlers") fixed the same class of missing-length-check bugs in the MCC sub-handlers, but the top-level rfcomm_recv_frame() was left unfixed. KMSAN reports:
BUG: KMSAN: uninit-value in rfcomm_run
...
Uninit was created at:
__alloc_skb+0x474/0xb60
vhci_write+0xe9/0x870Fix this by rejecting frames smaller than sizeof(struct rfcomm_hdr) + 1 (the minimum frame must have a 3-byte header and a 1-byte FCS).
--- net/bluetooth/rfcomm/core.c | 5 +++++ 1 file changed, 5 insertions(+)
net/bluetooth/rfcomm/core.c +5 -0
@@ -1813,6 +1813,11 @@ static struct rfcomm_session *rfcomm_recv_frame(struct rfcomm_session *s,return s; } +if (skb->len <sizeof (*hdr) +1 ) { +kfree_skb (skb); +return s; + } + dlci =__get_dlci (hdr->addr); type =__get_type (hdr->ctrl);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 225/752 ALSA: usb-audio: Add quirk for Corsair Virtuoso (later revision)
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Abrahamse <[email protected]>
[ Upstream commit cee046679655b4822f76efc9658f19efee9ac979 ]
Add USB mixer mapping quirk for later revisions of the Corsair Virtuoso headset with USB IDs 0x1b1c:0x0a43 (wired) and 0x1b1c:0x0a44 (wireless). These devices exhibit the same mixer label collision as earlier Virtuoso variants: all controls are labelled "Headset", causing applications like PulseAudio to move the sidetone control instead of the main playback volume.
--- sound/usb/mixer_maps.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/usb/mixer_maps.c +10 -0
@@ -581,6 +581,16 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = { .id = USB_ID(0x1b1c, 0x0a42), .map = corsair_virtuoso_map, }, + { + /* Corsair Virtuoso (wired mode, later revision) */ + .id = USB_ID(0x1b1c, 0x0a43), + .map = corsair_virtuoso_map, + }, + { + /* Corsair Virtuoso (wireless mode, later revision) */ + .id = USB_ID(0x1b1c, 0x0a44), + .map = corsair_virtuoso_map, + }, { /* Corsair HS80 RGB Wireless (wired mode) */ .id = USB_ID(0x1b1c, 0x0a6a),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 226/752 vhost-scsi: flush backend after device ioctls
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jia Jia <[email protected]>
[ Upstream commit 22598f55a4c2b510b3df5e69e563387a963222ae ]
vhost-scsi translates guest response descriptors into userspace iovecs when commands are submitted. Target-core completes those commands asynchronously, so VHOST_SET_MEM_TABLE can replace the memory table while an in-flight command still retains response iovecs translated through the old table.
If the old mapping is reused after VHOST_SET_MEM_TABLE returns, command completion can write the response to an unrelated userspace object.
Flush the vhost-scsi backend after vhost_dev_ioctl() handles a device ioctl. This waits for in-flight commands that can still use the old response iovecs before the ioctl returns.
Message-ID: <[email protected]>
--- drivers/vhost/scsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/vhost/scsi.c +2 -1
@@ -1900,9 +1900,10 @@ vhost_scsi_ioctl(struct file *f,default :mutex_lock (&vs->dev.mutex); r =vhost_dev_ioctl (&vs->dev, ioctl, argp); -/* TODO: flush backend after dev ioctl. */ if (r == -ENOIOCTLCMD ) r =vhost_vring_ioctl (&vs->dev, ioctl, argp); +else +vhost_scsi_flush (vs);mutex_unlock (&vs->dev.mutex);return r; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 227/752 ASoC: rt5645: Perform the initial jack detect at probe
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rudi Heitbaum <[email protected]>
[ Upstream commit 54b279699279411c77c8afbc73b83c70740a7303 ]
The only initial jack detect is the rt5645_irq(0, rt5645) at the end of rt5645_set_jack_detect(). A card described with simple-audio-card has no machine driver to call that, so jack state is only ever sampled from an edge on hp-detect-gpios.
A headphone already in the socket at boot is therefore never noticed, and the card is silent with every mixer control set correctly. rt5645_jack_detect() is what force enables the "LDO2" and "Mic Det Power" supplies that the "HP amp" widget depends on, and what programs RT5645_CHARGE_PUMP away from its reset value, so without it "HP amp" cannot power up. Unplugging and replugging the jack is the only way to recover.
Do the detect at the end of the component probe when the driver owns a hp-detect GPIO and the codec's own jack detect is unused, which is the case that has no other trigger. A machine driver calling rt5645_set_jack_detect() later just repeats it.
--- sound/soc/codecs/rt5645.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/soc/codecs/rt5645.c +4 -0
@@ -3453,6 +3453,10 @@ static int rt5645_probe(struct snd_soc_component *component)if (!rt5645->eq_param)return -ENOMEM ; +/* no machine driver to call rt5645_set_jack_detect(), so detect here */ +if (!rt5645->pdata.jd_mode && rt5645->gpiod_hp_det) +rt5645_irq (0 , rt5645); +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 228/752 netfilter: nfnetlink_log: wait for rcu grace period before freeing pernet state
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 33d1469b0124cc0baaea7a2032123b77a81e0940 ]
sashiko reports: "nfnl_log_net_exit() calls nf_log_unset(), which clears the logger pointer without an RCU grace period. Immediately after, ops_free_list() frees the per-net state while concurrent packets might still be executing nf_log_packet() under rcu_read_lock()."
Clear the pointer via .pre_exit to make sure rcu readers have completed before pernet storage is free'd. The change in nf_log_syslog.c is only done for consistency: it doesn't use pernet data.
--- net/netfilter/nf_log_syslog.c | 4 ++-- net/netfilter/nfnetlink_log.c | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-)
net/netfilter/nf_log_syslog.c +2 -2
@@ -1011,7 +1011,7 @@ static int __net_init nf_log_syslog_net_init(struct net *net)return ret; } -static void __net_exit nf_log_syslog_net_exit(struct net *net) +static void __net_exit nf_log_syslog_net_pre_exit(struct net *net) {nf_log_unset (net, &nf_ip_logger);nf_log_unset (net, &nf_arp_logger);
@@ -1022,7 +1022,7 @@ static void __net_exit nf_log_syslog_net_exit(struct net *net)static struct pernet_operations nf_log_syslog_net_ops = { .init = nf_log_syslog_net_init, - .exit = nf_log_syslog_net_exit, + .pre_exit = nf_log_syslog_net_pre_exit, };static int __init nf_log_syslog_init (void )
net/netfilter/nfnetlink_log.c +9 -4
@@ -1126,21 +1126,26 @@ static int __net_init nfnl_log_net_init(struct net *net)return 0 ; } -static void __net_exit nfnl_log_net_exit(struct net *net) +static void __net_exit nfnl_log_net_pre_exit(struct net *net) { -struct nfnl_log_net *log =nfnl_log_pernet (net); -unsigned int i; -#ifdef CONFIG_PROC_FS remove_proc_entry ("nfnetlink_log" , net->nf.proc_netfilter);#endif nf_log_unset (net, &nfulnl_logger); +} + +static void __net_exit nfnl_log_net_exit(struct net *net) +{ +struct nfnl_log_net *log =nfnl_log_pernet (net); +unsigned int i; +for (i =0 ; i <INSTANCE_BUCKETS ; i++)WARN_ON_ONCE (!hlist_empty (&log->instance_table[i])); }static struct pernet_operations nfnl_log_net_ops = { .init = nfnl_log_net_init, + .pre_exit = nfnl_log_net_pre_exit, .exit = nfnl_log_net_exit, .id = &nfnl_log_net_id, .size =sizeof (struct nfnl_log_net ),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 229/752 clk: at91: pmc: #undef field_{get,prep}() before definition
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit dbfe51513aae6bace00cc390e11cb486a64a63d2 ]
Prepare for the advent of globally available common field_get() and field_prep() macros by undefining the symbols before defining local variants. This prevents redefinition warnings from the C preprocessor when introducing the common macros later.
--- drivers/clk/at91/pmc.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/at91/pmc.h +2 -0
@@ -98,7 +98,9 @@ struct clk_pcr_layout {u32 pid_mask; }; +#undef field_get#define field_get (_mask, _reg) (((_reg) & (_mask)) >> (ffs(_mask) - 1)) +#undef field_prep#define field_prep (_mask, _val) (((_val) << (ffs(_mask) - 1)) & (_mask))#define ndck (a, s) (a[s - 1].id + 1)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 230/752 ppp_async: drop the errored frame instead of resetting its headroom
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vlatko Kosturjak <[email protected]>
[ Upstream commit 8dc5d98a16fa23c00999aecf10018c9f69fa5bf4 ]
ppp_receive_nonmp_frame() prepends a two-byte direction tag before running the pass/active BPF filters:
*(__be16 *)skb_push(skb, 2) = htons(PPP_FILTER_INBOUND_TAG);
Nothing on the receive path guarantees those two bytes of headroom. The frame-error path in ppp_async's process_input_packet() resets a reused skb's headroom to zero while claiming to restore it to a freshly allocated state - but a fresh skb from dev_alloc_skb() carries NET_SKB_PAD:
err:
if (skb) {
/* make skb appear as freshly allocated */
skb_trim(skb, 0);
skb_reserve(skb, - skb_headroom(skb));
}ap->rpkt still points at that skb, so the next frame is reassembled into it with no headroom at all. A peer that sends a bad-FCS frame followed by one beginning ff 03 then leaves a single byte of headroom by the time the filter tag is pushed, which lands one byte below skb->head:
skbuff: skb_under_panic: len:49 put:2 head:ffff888003c10000
data:ffff888003c0ffff tail:0x30 end:0x640 dev:<NULL> kernel BUG at net/core/skbuff.c:214! RIP: 0010:skb_panic+0x13e/0x230 Call Trace: skb_push+0xbd/0x100 ppp_receive_nonmp_frame+0x48a/0x1d10 ppp_input+0x4e9/0x2f80 ppp_async_process+0x2a/0xe0 tasklet_action_common+0x20f/0x8a0 handle_softirqs+0x18e/0x590 Kernel panic - not syncing: Fatal exception in interrupt
Zeroing the headroom violates the NET_SKB_PAD guarantee that dev_alloc_skb() gives the rest of the receive path. Besides the filter panic above, when CCP compression is enabled ppp_decompress_frame() hands skb->data - 2 to ->decompress()/->incomp(), which then reads out of bounds before skb->head for the same reason.
Rather than restore the headroom, drop the errored frame - as ppp_synctty already does on its error path - and clear ap->rpkt so the next frame is reassembled into a fresh skb with proper headroom. This is simpler and fixes both the filter under-panic and the CCP out-of-bounds read.
The original V1 of this patch made room in ppp_receive_nonmp_frame() with skb_cow_head(); Eric pointed out that fixing the root cause in the transport is the right approach.
Found by fuzzing the PPP receive path with a mutating peer on a pty; it is an interesting (remote) DoS: root configures PPP, the peer supplies two crashing frames. The reproducer (repro-ppp-skb.c, unchanged from v1) panics in about a second, and returns cleanly with this applied.
--- drivers/net/ppp/ppp_async.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/net/ppp/ppp_async.c +2 -5
@@ -822,11 +822,8 @@ process_input_packet(struct asyncppp *ap) err:/* frame had an error, remember that, reset SC_TOSS & SC_ESCAPE */ ap->state =SC_PREV_ERROR ; -if (skb) { -/* make skb appear as freshly allocated */ -skb_trim (skb,0 ); -skb_reserve (skb, -skb_headroom (skb)); - } +kfree_skb (skb); + ap->rpkt =NULL ; }/* Called when the tty driver has data for us. Runs parallel with the
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 231/752 mm/damon/core: avoid infinite kdamond_merge_regions() internal loop
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: SJ Park <[email protected]>
commit 123e4619ab6c8ab1c4cb1d7a58311a2af13929cd upstream.
Patch series "mm/damon: unurgent fixes for infinite loop, NULL de-ref and races", v1.1.
Sashiko found a few issues in DAMON that could cause infinite loop, NULL dereference and monitoring results degradation. The first two sounds scary but the infinite loop happens only under unreasonable user setup. The NULL dereference is only in a unit test. Monitoring results degradation is trivial since it is only best-effort, and those happens from only unlikely races. Still those are bugs that better to fix if possible. Fix those.
This patch (of 6):
Due to online parameter update like events, the number of DAMON regions could be higher than the user-set upper limit. kdamond_merge_regions() repeats merge regions until the number meets the limit, while doubling the merge threshold up to the theoretical maximum threshold. It is tried only up to the theoretical maximum threshold because even the aggressive merging can fail from reducing the number of regions under the user-defined upper limit. For example, there could be many user-defined non-contiguous regions that cannot be merged.
The threshold based loop break condition is evaluated by comparing the threshold for the next merging try against the theoretical maximum threshold. If max_thres is larger than UINT_MAX / 2, doubling the threshold could make it overflow, and bypass the loop break condition. In the case, if the number of regions cannot be reduced under the upper limit like explained above, the loop will run infinitely.
Prevent the case by doing the break condition check before doubling the threshold. Also, prevent the threshold exceeding the maximum threshold, as it could overflow and apply the wrong merge threshold.
This issue is unlikely to occur in real world, since having the max_thres higher than UINT_MAX / 2 require unrealistically large aggregation intervals compared to the sampling interval. Also, it requires an unrealistically large number of uncontiguous regions setup. Nonetheless, the consequence is bad and the fix is simple.
The issue was discovered [1] by Sashiko.
--- mm/damon/core.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
mm/damon/core.c +9 -4
@@ -523,15 +523,20 @@ static void kdamond_merge_regions(struct damon_ctx *c, unsigned int threshold, max_thres = c->aggr_interval / (c->sample_interval ? c->sample_interval :1 ); -do { +while (true) { nr_regions =0 ;damon_for_each_target (t, c) {damon_merge_regions_of (t, threshold, sz_limit); nr_regions +=damon_nr_regions (t); } - threshold =max (1 , threshold *2 ); - }while (nr_regions > c->max_nr_regions && - threshold /2 < max_thres); +if (nr_regions <= c->max_nr_regions || + max_thres <= threshold) +break ; +if (threshold < max_thres /2 ) + threshold =max (1 , threshold *2 ); +else + threshold = max_thres; + } }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 232/752 Revert "Bluetooth: btusb: Add ASUS USB-BT600 for Realtek 8761CU"
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
This reverts commit 6f54e3e62b7641ce1210795f49e02dbcf94886e1.
--- drivers/bluetooth/btusb.c | 2 -- 1 file changed, 2 deletions(-)
drivers/bluetooth/btusb.c +0 -2
@@ -531,8 +531,6 @@ static const struct usb_device_id blacklist_table[] = {/* Additional Realtek 8761CU Bluetooth devices */ { USB_DEVICE(0x0b05, 0x1bef), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, - { USB_DEVICE(0x0b05, 0x1d70), .driver_info = BTUSB_REALTEK | - BTUSB_WIDEBAND_SPEECH }, /* Additional Realtek 8821AE Bluetooth devices */ { USB_DEVICE(0x0b05, 0x17dc), .driver_info = BTUSB_REALTEK },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 233/752 Revert "Bluetooth: btusb: Add ASUS USB-BT540 for Realtek 8761CU"
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
This reverts commit 2d3d600a360f46287ca9afc92cc62f84f867ca42.
--- drivers/bluetooth/btusb.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/bluetooth/btusb.c +0 -4
@@ -528,10 +528,6 @@ static const struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x2550, 0x8761), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, - /* Additional Realtek 8761CU Bluetooth devices */ - { USB_DEVICE(0x0b05, 0x1bef), .driver_info = BTUSB_REALTEK | - BTUSB_WIDEBAND_SPEECH }, - /* Additional Realtek 8821AE Bluetooth devices */ { USB_DEVICE(0x0b05, 0x17dc), .driver_info = BTUSB_REALTEK }, { USB_DEVICE(0x13d3, 0x3414), .driver_info = BTUSB_REALTEK },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 234/752 ARM: 9484/1: enable interrupts when unhandled user faults are triggered
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xie Yuanbin <[email protected]>
[ Upstream commit e79ca91165d4fd18549c536abdb86101e889052f ]
PREEMPT_RT requires interrupts to be enabled when sending signals.
When do_DataAbort()/do_PrefetchAbort() triggers unhandled user faults, that is inf->fn() return a non-zero value, and the interrupts are not enabled within the hook function, force_sig_fault() will be called with interrupts disabled.
This can be triggered by user programs executing the bkpt instruction, with kernel config CONFIG_PERF_EVENTS=n.
Enable interrupts in do_DataAbort()/do_PrefetchAbort() when unhandled user faults are triggered to fix the issue.
--- arch/arm/mm/fault.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/mm/fault.c +6 -0
@@ -533,6 +533,9 @@ do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)if (!inf->fn (addr, fsr & ~FSR_LNX_PF , regs))return ; +if (likely (user_mode (regs))) +local_irq_enable (); +pr_alert ("8<--- cut here ---\n" );pr_alert ("Unhandled fault: %s (0x%03x) at 0x%08lx\n" , inf->name, fsr, addr);
@@ -571,6 +574,9 @@ do_PrefetchAbort(unsigned long addr, unsigned int ifsr, struct pt_regs *regs)if (!inf->fn (addr, ifsr |FSR_LNX_PF , regs))return ; +if (likely (user_mode (regs))) +local_irq_enable (); +pr_alert ("8<--- cut here ---\n" );pr_alert ("Unhandled prefetch abort: %s (0x%03x) at 0x%08lx\n" , inf->name, ifsr, addr);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 235/752 EDAC/igen6: Fix interleave boundary condition
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiuxu Zhuo <[email protected]>
[ Upstream commit f4008169bd320eedb9ddf2b39eeb21370ddac278 ]
The address translation logic splits the memory space into interleaved and non-interleaved regions using a boundary at 2 * s_size.
The current check uses '>' and incorrectly classifies the boundary address (2 * s_size) as part of the interleaved region. This leads to incorrect channel/sub-channel selection at the region boundary.
Fix the classification by using '>=' so that the boundary address is handled in the non-interleaved region, matching the hardware layout.
--- drivers/edac/igen6_edac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/igen6_edac.c +1 -1
@@ -493,7 +493,7 @@ static void decode_addr(u64 addr, u32 hash, u64 s_size, int l_map, {int intlv_bit =CHANNEL_HASH_LSB_MASK_BIT (hash) +6 ; -if (addr >2 * s_size) { +if (addr >=2 * s_size) { *sub_addr = addr - s_size; *idx = l_map;return ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 236/752 EDAC/igen6: Fix channel selection hash
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiuxu Zhuo <[email protected]>
[ Upstream commit 540b79536f3a89a66c5b6c490110298d43025618 ]
In channel selection hash mode, the hardware decoding logic always includes the channel interleave bit in XOR operations. However, the hash mask may or may not include this channel interleave bit. When the mask does include this bit, the current igen6_edac code performs XOR on the interleave bit twice, effectively ignoring it - which is incorrect.
Fix this issue by ensuring the hash mask always includes the interleave bit, so XOR is performed on the interleave bit exactly once.
--- drivers/edac/igen6_edac.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/edac/igen6_edac.c +11 -3
@@ -467,14 +467,22 @@ static enum mem_type get_memory_type(u32 mad_inter)static int decode_chan_idx (u64 addr,u64 mask,int intlv_bit) { -u64 hash_addr = addr & mask, hash =0 ; -u64 intlv = (addr >> intlv_bit) &1 ; +u64 hash_addr, hash =0 ;int i; +/* +* In hash mode, the @intlv_bit is the lowest selected bit of @addr +* to be XORed. While @mask may or may not include this @intlv_bit, +* we enforce that @mask includes @intlv_bit to ensure @intlv_bit is +* XORed exactly once. +*/ + mask |=1 << intlv_bit; + hash_addr = addr & mask; +for (i =6 ; i <20 ; i++) hash ^= (hash_addr >> i) &1 ; -return (int )hash ^ intlv; +return (int )hash; }static u64 decode_channel_addr (u64 addr,int intlv_bit)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 237/752 EDAC/igen6: Fix channel address decode for non-hash mode
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiuxu Zhuo <[email protected]>
[ Upstream commit 7b348d0d401d478f1923ba20a34a61681d1f7971 ]
In non-hash mode, decode_channel_addr() and channel index extraction used a hardcoded interleave bit position 6 instead of the actual intlv_bit parameter, causing incorrect channel address decoding.
Fix this by using intlv_bit consistently in both hash and non-hash modes.
--- drivers/edac/igen6_edac.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/edac/igen6_edac.c +5 -6
@@ -507,13 +507,12 @@ static void decode_addr(u64 addr, u32 hash, u64 s_size, int l_map,return ; } -if (CHANNEL_HASH_MODE (hash)) { - *sub_addr =decode_channel_addr (addr, intlv_bit); + *sub_addr =decode_channel_addr (addr, intlv_bit); + +if (CHANNEL_HASH_MODE (hash)) *idx =decode_chan_idx (addr,CHANNEL_HASH_MASK (hash), intlv_bit); - }else { - *sub_addr =decode_channel_addr (addr,6 ); - *idx =GET_BITFIELD (addr,6 ,6 ); - } +else + *idx =GET_BITFIELD (addr, intlv_bit, intlv_bit); }static int igen6_decode (struct decoded_addr *res)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 238/752 EDAC/device_sysfs: Use kstrtouint() for poll_msec to prevent truncation
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jad Keskes <[email protected]>
[ Upstream commit 66cc9dec919dd63d8e4b3d386f7aed3ae684e645 ]
The poll_msec sysfs store file uses simple_strtoul() which accepts an unsigned long, but the target field (poll_msec) is unsigned int. On 64-bit systems, a value > UINT_MAX is silently truncated when stored.
Fix the mismatch by using kstrtouint() instead. This rejects values larger than UINT_MAX at parse time, making truncation impossible. Also add a check for value < 1 to reject the 0-delay case, which would cause the poll work to spin without delay and consume 100% CPU.
--- drivers/edac/edac_device_sysfs.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/edac/edac_device_sysfs.c +9 -2
@@ -90,14 +90,21 @@ static ssize_t edac_device_ctl_poll_msec_store(struct edac_device_ctl_info *ctl_info, const char *data, size_t count) { -unsigned long value; +unsigned int value; +int ret;/* get the value and enforce that it is non-zero, must be at least * one millisecond for the delay period, between scans * Then cancel last outstanding delay for the work request * and set a new one. */ - value =simple_strtoul (data,NULL ,0 ); + ret =kstrtouint (data,0 , &value); +if (ret <0 ) +return ret; + +if (value <1 ) +return -EINVAL ; +edac_device_reset_delay_period (ctl_info, value);return count;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 239/752 drm/virtio: Fix a NULL vs ERR_PTR() bug in virtio_gpu_user_framebuffer_create()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 94579f24e2b526a04eb41050af0ba018c6f528e7 ]
Smatch complains that returning a NULL here will lead to a NULL pointer dereference in drm_mode_addfb2(). Return an error pointer instead.
--- drivers/gpu/drm/virtio/virtgpu_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_display.c +1 -1
@@ -317,7 +317,7 @@ virtio_gpu_user_framebuffer_create(struct drm_device *dev,if (ret) {kfree (virtio_gpu_fb);drm_gem_object_put (obj); -return NULL ; +return ERR_PTR (ret); }return &virtio_gpu_fb->base;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 240/752 nvme-rdma: fix -EIO cleanup order in queue_rq
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xixin Liu <[email protected]>
[ Upstream commit d61828199c6cb4b76d48403c77023cd4bb9d09fc ]
On -EIO, the RDMA queue_rq path reports a host path error and then still cleans up the command and unmaps the SQE DMA. The path error helper completes the request, so that is double cleanup and DMA unmap after the request is already complete.
Unmap the SQE first, then report the host path error. Skip the outer command cleanup on that path.
--- drivers/nvme/host/rdma.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/nvme/host/rdma.c +10 -8
@@ -2051,7 +2051,7 @@ static blk_status_t nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx,struct ib_device *dev;bool queue_ready =test_bit (NVME_RDMA_Q_LIVE , &queue->flags);blk_status_t ret; -int err; +int err =0 ;WARN_ON_ONCE (rq->tag <0 );
@@ -2107,16 +2107,18 @@ static blk_status_t nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx, err_unmap:nvme_rdma_unmap_data (queue, rq); err: -if (err == -EIO ) - ret =nvme_host_path_error (rq); -else if (err == -ENOMEM || err == -EAGAIN ) - ret =BLK_STS_RESOURCE ; -else - ret =BLK_STS_IOERR ; -nvme_cleanup_cmd (rq); +if (err != -EIO ) { +nvme_cleanup_cmd (rq); +if (err == -ENOMEM || err == -EAGAIN ) + ret =BLK_STS_RESOURCE ; +else + ret =BLK_STS_IOERR ; + } unmap_qe:ib_dma_unmap_single (dev, req->sqe.dma,sizeof (struct nvme_command ),DMA_TO_DEVICE ); +if (err == -EIO ) +return nvme_host_path_error (rq);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 241/752 selftests/cgroup: Fix cg_run_in_subcgroups ignoring arg parameter
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongfu Li <[email protected]>
[ Upstream commit a8c6daab4b0e276508b7ffdd66c60fd3020a9178 ]
cg_run_in_subcgroups() discards its arg and always passes NULL to cg_run(), turning the (void *)100 from test_kmem_dead_cgroups() into NULL so no allocation occurs.
This makes test_kmem_dead_cgroups() falsely pass without exercising the "dying cgroup with charged slab" scenario it intends to test.
Pass the arg through to cg_run() to fix this.
--- tools/testing/selftests/cgroup/test_kmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/cgroup/test_kmem.c +1 -1
@@ -140,7 +140,7 @@ static int cg_run_in_subcgroups(const char *parent,return -1 ; } -if (cg_run (child, fn,NULL )) { +if (cg_run (child, fn, arg)) {cg_destroy (child);free (child);return -1 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 242/752 net/sched: act_api: budget all shared attributes in notify skbs
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Victor Nogueira <[email protected]>
[ Upstream commit 13eb543cebef6d6c3ec42e31afe3856f51b7126b ]
tcf_action_shared_attrs_size() is supposed to return an upper bound on the netlink attributes every action dump emits outside of TCA_ACT_OPTIONS, so that tcf_add_notify_msg(), tcf_del_notify_msg() and friends can allocate an skb large enough for the reply. It has fallen behind the dump path and is now an underestimate for every single action.
Attributes, such as, TCA_ACT_IN_HW_COUNT and TCA_STATS_BASIC_HW are emitted unconditionally and never accounted for. TCA_STATS_PKT64, TCA_ACT_USED_HW_STATS, TCA_STATS_RATE_EST, TCA_STATS_RATE_EST64 require specific conditions, but are also not accounted for.
Fix the issue by budgeting all of them so that we have a legitimate upper bound. Even tough for of them require specific conditions, they are cheap so, to avoid overcomplicating, we opted to account for them unconditionally as well to account for a real worst case scenario.
--- net/sched/act_api.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
net/sched/act_api.c +11 -2
@@ -208,12 +208,21 @@ static size_t tcf_action_shared_attrs_size(const struct tc_action *act) +nla_total_size (IFNAMSIZ )/* TCA_ACT_KIND */ + cookie_len/* TCA_ACT_COOKIE */ +nla_total_size (sizeof (struct nla_bitfield32 ))/* TCA_ACT_HW_STATS */ +/* TCA_ACT_USED_HW_STATS */ + +nla_total_size (sizeof (struct nla_bitfield32 )) + +nla_total_size (sizeof (u32))/* TCA_ACT_IN_HW_COUNT */ +nla_total_size (0 )/* TCA_ACT_STATS nested */ +nla_total_size (sizeof (struct nla_bitfield32 ))/* TCA_ACT_FLAGS */ /* TCA_STATS_BASIC */ +nla_total_size_64bit (sizeof (struct gnet_stats_basic )) -/* TCA_STATS_PKT64 */ - +nla_total_size_64bit (sizeof (u64)) +/* TCA_STATS_BASIC_HW */ + +nla_total_size_64bit (sizeof (struct gnet_stats_basic )) +/* TCA_STATS_PKT64, emitted by both of the basic copies above */ + +2 *nla_total_size_64bit (sizeof (u64)) +/* TCA_STATS_RATE_EST */ + +nla_total_size_64bit (sizeof (struct gnet_stats_rate_est )) +/* TCA_STATS_RATE_EST64 */ + +nla_total_size_64bit (sizeof (struct gnet_stats_rate_est64 ))/* TCA_STATS_QUEUE */ +nla_total_size_64bit (sizeof (struct gnet_stats_queue )) +nla_total_size (0 )/* TCA_OPTIONS nested */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 243/752 net/sched: act_api: size the RTM_GETACTION reply from the actions
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Victor Nogueira <[email protected]>
[ Upstream commit e9ca46ebc3262b498626c4095826b8fa034bbf21 ]
tca_action_gd() already walks every requested action and accumulates attr_size += tcf_action_fill_size(act), then wraps the result in tcf_action_full_attrs_size(). For RTM_DELACTION that value is handed to tcf_del_notify_msg(), which allocates max(attr_size, NLMSG_GOODSIZE). For RTM_GETACTION it is silently discarded and tcf_get_notify() allocates a fixed NLMSG_GOODSIZE skb instead.
Any action whose dump exceeds that fixed budget therefore cannot be read back. For example, act_pedit overruns the budget with 32 actions of four munge keys each, act_police with 32 policers once the optional rate/peakrate/result/avrate attributes are present
Fix this by passing attr_size through and allocate the reply the way the add and delete paths do.
Note on exposure: RTM_GETACTION is the only one of the three action commands that is not capability checked - tc_ctl_action() requires CAP_NET_ADMIN for RTM_NEWACTION and RTM_DELACTION only - so this turns a fixed NLMSG_GOODSIZE reply into a user sized allocation on an unprivileged path. It is bounded by TCA_ACT_MAX_PRIO actions per request, and tca_action_gd() does not reject duplicate indices, so a single large action can be requested 32 times; an act_bpf program near BPF_MAXINSNS is about 32KB of dump, or roughly 1MB for one request. Creating such an action still requires CAP_NET_ADMIN, and the add and delete paths have sized their skbs this way since the Fixes commit. Should this ever need bounding, GFP_KERNEL_ACCOUNT would charge the reply to the caller's memcg.
--- net/sched/act_api.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/sched/act_api.c +4 -3
@@ -1264,12 +1264,12 @@ static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[],static int tcf_get_notify (struct net *net,u32 portid,struct nlmsghdr *n, -struct tc_action *actions[],int event, +struct tc_action *actions[],size_t attr_size,int event,struct netlink_ext_ack *extack) {struct sk_buff *skb; - skb =alloc_skb (NLMSG_GOODSIZE ,GFP_KERNEL ); + skb =alloc_skb (max (attr_size,NLMSG_GOODSIZE ),GFP_KERNEL );if (!skb)return -ENOBUFS ; if (tca_get_fill(skb, actions, portid, n->nlmsg_seq, 0, event,
@@ -1499,7 +1499,8 @@ tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n, attr_size =tcf_action_full_attrs_size (attr_size);if (event ==RTM_GETACTION ) - ret =tcf_get_notify (net, portid, n, actions, event, extack); + ret =tcf_get_notify (net, portid, n, actions, attr_size, event, + extack);else {/* delete */ ret =tcf_del_notify (net, n, actions, portid, attr_size, extack);if (ret)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 244/752 sctp: fix a TOCTOU race in SCTP_CMD_TIMER_START
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit 2188569e7e1b0bc3f3b557dc97ab7a02befc11c8 ]
The SCTP_CMD_TIMER_START handler checks timer_pending() before calling timer_reduce(). The timer can expire and detach between these operations, causing timer_reduce() to rearm the timer without taking the association reference required for the newly armed timer.
The timer callback later unconditionally drops its association reference, which can leave the association reference count unbalanced and result in use-after-free during association teardown.
Use the return value of timer_reduce() to determine whether the timer was actually armed. Take the association reference only when timer_reduce() successfully starts a new timer, closing the race between checking the timer state and rearming it.
This issue was reported by Nico Yip (@_cyeaa_) working with TrendAI Zero Day Initiative.
--- net/sctp/sm_sideeffect.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
net/sctp/sm_sideeffect.c +1 -10
@@ -1540,17 +1540,8 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type, timeout = asoc->timeouts[cmd->obj.to];BUG_ON (!timeout); -/* -* SCTP has a hard time with timer starts. Because we process -* timer starts as side effects, it can be hard to tell if we -* have already started a timer or not, which leads to BUG -* halts when we call add_timer. So here, instead of just starting -* a timer, if the timer is already started, and just mod -* the timer with the shorter of the two expiration times -*/ -if (!timer_pending (timer)) +if (!timer_reduce (timer, jiffies + timeout))sctp_association_hold (asoc); -timer_reduce (timer, jiffies + timeout);break ;case SCTP_CMD_TIMER_RESTART :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 245/752 smb: client: transport: Fix debug printing in __release_mid()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit d83a21bb26015bfdd79b0440fe816b271b8bbab3 ]
Long time ago during upgrading printk():s to the respective pr_<level>() calls one misconversion happened and nobody has noticed that. So, previously printk(KERN_DEBUG) + printk() worked as one long debug print since the trailing '\n' is only present in the followup printk() format string. The culprit change missed that and split the message to two on the different levels. Restore the original behaviour to make users be less confused in the most likely never happen cases of partially getting that message.
--- fs/cifs/transport.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
fs/cifs/transport.c +5 -6
@@ -141,12 +141,11 @@ void _cifs_mid_q_entry_release(struct kref *refcount)trace_smb3_slow_rsp (smb_cmd, midEntry->mid, midEntry->pid, midEntry->when_sent, midEntry->when_received);if (cifsFYI &CIFS_TIMER ) { -pr_debug ("slow rsp: cmd %d mid %llu" , - midEntry->command, midEntry->mid); -cifs_info ("A: 0x%lx S: 0x%lx R: 0x%lx\n" , - now - midEntry->when_alloc, - now - midEntry->when_sent, - now - midEntry->when_received); +pr_debug ("slow rsp: cmd %d mid %llu A: 0x%lx S: 0x%lx R: 0x%lx\n" , + midEntry->command, midEntry->mid, + now - midEntry->when_alloc, + now - midEntry->when_sent, + now - midEntry->when_received); } }#endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 246/752 sctp: fix soft lockup from unpadded ASCONF-ACK parameter iteration
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henry Martin <[email protected]>
[ Upstream commit 2cb0b0b1ed69430bf73740377ea0a1c44c50db63 ]
sctp_verify_asconf() walks ASCONF-ACK parameters with sctp_walk_params(), which advances by SCTP_PAD4(length), while the consumer sctp_get_asconf_response() iterates the same parameters advancing by the raw length, without padding. A single odd-length parameter desynchronises the two walks and makes the consumer interpret attacker-controlled bytes at a misaligned offset.
When those bytes yield a length of zero, the while loop over asconf_ack_len makes no progress, spinning forever in softirq context, and the watchdog reports a soft lockup. All reads stay within the received skb, so the lockup is a pure remote denial of service. A remote peer can trigger it with a crafted ASCONF-ACK on an ADD-IP enabled association with an outstanding ASCONF (RFC 5061 section 4.1.2 requires the chunk to be authenticated, but the predefined empty key id 0 allows the peer to compute the same association HMAC from publicly exchanged parameters, so the gate does not help).
The SCTP_PARAM_ERR_CAUSE case of sctp_verify_asconf() also performs no length check, letting a parameter without a complete error header reach the consumer, which reads errhdr.cause past the end of the parameter, an out-of-bounds read.
Reject SCTP_PARAM_ERR_CAUSE parameters shorter than sizeof(struct sctp_addip_param) + sizeof(struct sctp_errhdr) at the verifier, and advance the consumer iterator with the same padding rule as the verifier to keep the two walks in lockstep. The verifier change guarantees a complete error header in every ERR_CAUSE parameter the consumer can see, so the consumer's asconf_ack_len check is dropped and it returns err_param->cause directly. The consumer padding fix is still required because odd lengths remain valid for SCTP_PARAM_ERR_CAUSE per RFC 5061.
The issue was found by ZeroHive, a vulnerability hunting agent at Tencent Yunding Lab.
--- net/sctp/sm_make_chunk.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
net/sctp/sm_make_chunk.c +6 -8
@@ -3238,6 +3238,9 @@ bool sctp_verify_asconf(const struct sctp_association *asoc, *errp = param.p;switch (param.p->type) {case SCTP_PARAM_ERR_CAUSE : +if (length <sizeof (struct sctp_addip_param ) + +sizeof (struct sctp_errhdr )) +return false;break ;case SCTP_PARAM_IPV4_ADDRESS :if (length !=sizeof (struct sctp_ipv4addr_param ))
@@ -3471,20 +3474,15 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack,case SCTP_PARAM_ERR_CAUSE : length =sizeof (*asconf_ack_param); err_param = (void *)asconf_ack_param + length; - asconf_ack_len -= length; -if (asconf_ack_len >0 ) -return err_param->cause; -else -return SCTP_ERROR_INV_PARAM ; -break ; +return err_param->cause;default :return SCTP_ERROR_INV_PARAM ; } } length =ntohs (asconf_ack_param->param_hdr.length); - asconf_ack_param = (void *)asconf_ack_param + length; - asconf_ack_len -= length; + asconf_ack_param = (void *)asconf_ack_param +SCTP_PAD4 (length); + asconf_ack_len -=SCTP_PAD4 (length); }return err_code;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 247/752 net: amd-xgbe: discard rx packets with bad FCS
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Nugraha <[email protected]>
[ Upstream commit ac8d6b28d48c5d951dcd923d33e461588e762a6d ]
amd-xgbe driver currently sets the MAC_RCR.DCRCC bit whenever RX is enabled. This disables hardware FCS validation, causing packets with bad FCS to be accepted unconditionally.
This change unsets DCRCC so that packets with bad FCS will be dropped, in-line with typical behaviours of many other network controllers.
Tests:
- Verified that packets with bad FCS are now dropped.
- Verified that receiving packets with bad FCS will increment the rx_crc_errors counter.
--- drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-dev.c +1 -2
@@ -3388,7 +3388,7 @@ static void xgbe_enable_rx(struct xgbe_prv_data *pdata)XGMAC_IOWRITE (pdata,MAC_RQC0R , reg_val);/* Enable MAC Rx */ -XGMAC_IOWRITE_BITS (pdata,MAC_RCR ,DCRCC ,1 ); +XGMAC_IOWRITE_BITS (pdata,MAC_RCR ,DCRCC ,0 );XGMAC_IOWRITE_BITS (pdata,MAC_RCR ,CST ,1 );XGMAC_IOWRITE_BITS (pdata,MAC_RCR ,ACS ,1 );XGMAC_IOWRITE_BITS (pdata,MAC_RCR ,RE ,1 );
@@ -3399,7 +3399,6 @@ static void xgbe_disable_rx(struct xgbe_prv_data *pdata)unsigned int i;/* Disable MAC Rx */ -XGMAC_IOWRITE_BITS (pdata,MAC_RCR ,DCRCC ,0 );XGMAC_IOWRITE_BITS (pdata,MAC_RCR ,CST ,0 );XGMAC_IOWRITE_BITS (pdata,MAC_RCR ,ACS ,0 );XGMAC_IOWRITE_BITS (pdata,MAC_RCR ,RE ,0 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 248/752 watchdog: msc313e: Fix NULL pointer dereference in PM callbacks
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tzung-Bi Shih <[email protected]>
[ Upstream commit e3eceb76515910746e6268c4e4ac1c07516ebd7b ]
msc313e_wdt_probe() doesn't set the driver data for the platform device. As a result, dev_get_drvdata() in msc313e_wdt_suspend() and msc313e_wdt_resume() will return NULL, leading to a NULL pointer dereference afterward.
Set the platform device driver data in msc313e_wdt_probe().
--- drivers/watchdog/msc313e_wdt.c | 1 + 1 file changed, 1 insertion(+)
drivers/watchdog/msc313e_wdt.c +1 -0
@@ -121,6 +121,7 @@ static int msc313e_wdt_probe(struct platform_device *pdev) priv->wdev.timeout =MSC313E_WDT_DEFAULT_TIMEOUT ;watchdog_set_drvdata (&priv->wdev, priv); +platform_set_drvdata (pdev, priv);watchdog_init_timeout (&priv->wdev, timeout, dev);watchdog_stop_on_reboot (&priv->wdev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 249/752 OPP: of: Fix potential multiplication overflow when calculating freq
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
[ Upstream commit e11811a552252740bd396ec38378e9570ee16578 ]
The multiplication be32_to_cpup(val++) * 1000 is performed using 32 bit unsigned integers and hence uses a 32 bit multiplication; this will overflow if be32_to_cpup(val++) is greater than 4294967 (which is very unlikely at present). The result is assigned to an unsigned long (which is a 64 bit value on 64 bit systems), so fix this potential overflow by casting the first operand of the multiplication to an unsigned int.
--- drivers/opp/of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/opp/of.c +1 -1
@@ -1021,7 +1021,7 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table) val = prop->value;while (nr) { -unsigned long freq =be32_to_cpup (val++) *1000 ; +unsigned long freq = (unsigned long )be32_to_cpup (val++) *1000 ;unsigned long volt =be32_to_cpup (val++); ret =_opp_add_v1 (opp_table, dev, freq, volt, false);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 250/752 ALSA: pcm: Serialize PCM mmap with buffer reallocation to fix page UAF
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yilin Zhang <[email protected]>
[ Upstream commit 9b110a9dcecc59516c77cb3c0caf1f492f75df2d ]
snd_pcm_hw_params() and snd_pcm_hw_free() guard buffer reallocation with an mmap_count check performed under the PCM stream lock, but the lock is released long before the buffer is actually freed:snd_pcm_sync_stop(), constraint refinement and do_free_pages() all happen in between. snd_pcm_mmap_data(), on the other hand, takes no lock at all: it validates against the old buffer's state and dma_bytes, remaps its pages into the VMA, and only then increments mmap_count.
A concurrent mmap() can therefore slip in between the check and the free. remap_pfn_range() installs writable PTEs for the old buffer's pages without taking page references, and the subsequent do_free_pages() returns those pages to the page allocator while the VMA still maps them. This leaves a stale, writable mapping of freed
pages: a page-level use-after-free that can be leveraged for local privilege escalation.
Make snd_pcm_mmap_data() participate in the buffer-access scheme introduced for hw_params/hw_free: acquire runtime->buffer_accessing before validating and remapping, and release it afterwards. Buffer reallocation already fails with -EBUSY while accessors are active, and the mmap side now fails with -EBUSY while a reallocation is in progress, so the validate/remap sequence and the check/free sequence can no longer interleave.
A reproducer that turns this race into a stale writable mapping of the freed DMA buffer pages is available on request.
--- sound/core/pcm_native.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-)
sound/core/pcm_native.c +25 -10
@@ -3912,20 +3912,33 @@ int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file,return -EINVAL ; } runtime = substream->runtime; -if (runtime->state ==SNDRV_PCM_STATE_OPEN ) -return -EBADFD ; -if (!(runtime->info &SNDRV_PCM_INFO_MMAP )) -return -ENXIO ; +/* don't race with buffer reallocation in hw_params/hw_free */ +if (!atomic_inc_unless_negative (&runtime->buffer_accessing)) +return -EBUSY ; +if (runtime->state ==SNDRV_PCM_STATE_OPEN ) { + err = -EBADFD ; + goto out; + } +if (!(runtime->info &SNDRV_PCM_INFO_MMAP )) { + err = -ENXIO ; + goto out; + }if (runtime->access ==SNDRV_PCM_ACCESS_RW_INTERLEAVED || - runtime->access ==SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ) -return -EINVAL ; + runtime->access ==SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ) { + err = -EINVAL ; + goto out; + } size = area->vm_end - area->vm_start; offset = area->vm_pgoff <<PAGE_SHIFT ; dma_bytes =PAGE_ALIGN (runtime->dma_bytes); -if ((size_t )size > dma_bytes) -return -EINVAL ; -if (offset > dma_bytes - size) -return -EINVAL ; +if ((size_t )size > dma_bytes) { + err = -EINVAL ; + goto out; + } +if (offset > dma_bytes - size) { + err = -EINVAL ; + goto out; + } area->vm_ops = &snd_pcm_vm_ops_data; area->vm_private_data = substream;
@@ -3935,6 +3948,8 @@ int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, err =snd_pcm_lib_default_mmap (substream, area);if (!err)atomic_inc (&substream->mmap_count); +out: +atomic_dec (&runtime->buffer_accessing);return err; }EXPORT_SYMBOL (snd_pcm_mmap_data);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 251/752 ksmbd: rate limit unmapped SID errors
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit feca5e70fc963b088377b20879e8cd8237c2fd7d ]
A client can include many structurally valid but unmapped SIDs in a DACL. Logging every mapping failure lets one request generate hundreds of kernel error messages.
Rate limit the message to prevent an authenticated client from flooding the kernel log.
--- fs/ksmbd/smbacl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ksmbd/smbacl.c +2 -2
@@ -509,8 +509,8 @@ static void parse_dacl(struct user_namespace *user_ns, temp_fattr.cf_uid =INVALID_UID ; ret =sid_to_id (user_ns, &ppace[i]->sid,SIDOWNER , &temp_fattr);if (ret ||uid_eq (temp_fattr.cf_uid,INVALID_UID )) { -pr_err ("%s: Error %d mapping Owner SID to uid\n" , - __func__, ret); +pr_err_ratelimited ("%s: Error %d mapping Owner SID to uid\n" , + __func__, ret);continue ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 252/752 Bluetooth: L2CAP: fix chan mode for LE_CONN_REQ + EXT_FLOWCTL pchan
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pauli Virtanen <[email protected]>
[ Upstream commit 4ef05db5b08b176a551b4a6287372045998806b0 ]
l2cap_new_connection() sets default value of channel mode to match the parent channel. l2cap_le_connect_req() left this at the default, and created L2CAP_MODE_EXT_FLOWCTL channels if listening pchan has that mode. This causes FLAG_DEFER_SETUP channels to reply to L2CAP_LE_CONN_REQ with L2CAP_ECRED_CONN_RSP, which is incorrect.
It can also result to stack OOB write (of l2cap_alloc_cid determined values) in l2cap_ecred_rsp_defer(), as l2cap_le_connect_req() does not limit maximum number of deferred channels or check for duplicate ident.
Fix by setting chan->mode correctly in l2cap_le_connect_req().
Also check channel mode in l2cap_ecred_rsp_defer(), and do WARN_ON_ONCE instead of OOB write to make it less brittle.
--- net/bluetooth/l2cap_core.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/bluetooth/l2cap_core.c +8 -0
@@ -4035,6 +4035,9 @@ static void l2cap_ecred_rsp_defer(struct l2cap_chan *chan, void *data) {struct l2cap_ecred_rsp_data *rsp = data; +if (chan->mode !=L2CAP_MODE_EXT_FLOWCTL ) +return ; +/* Check if channel for outgoing connection or if it wasn't deferred * since in those cases it must be skipped. */
@@ -4045,6 +4048,10 @@ static void l2cap_ecred_rsp_defer(struct l2cap_chan *chan, void *data)/* Reset ident so only one response is sent */ chan->ident =0 ; +/* Unreachable, check in l2cap_ecred_conn_req. If reached, drop rest */ +if (WARN_ON_ONCE (rsp->count >=ARRAY_SIZE (rsp->pdu.scid))) + rsp->pdu.rsp.result =cpu_to_le16 (L2CAP_CR_LE_NO_MEM ); +/* Include all channels pending with the same ident */ if (!rsp->pdu.rsp.result) rsp->pdu.rsp.dcid[rsp->count++] =cpu_to_le16 (chan->scid);
@@ -6014,6 +6021,7 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn,__set_chan_timer (chan, chan->ops->get_sndtimeo (chan)); chan->ident = cmd->ident; + chan->mode =L2CAP_MODE_LE_FLOWCTL ;if (test_bit (FLAG_DEFER_SETUP , &chan->flags)) {l2cap_state_change (chan,BT_CONNECT2 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 253/752 Bluetooth: L2CAP: clear FLAG_DEFER_SETUP only for same PID/PSM
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pauli Virtanen <[email protected]>
[ Upstream commit 0d77683237270702fa93489ca759c89b4e970554 ]
l2cap_ecred_defer_connect() clears FLAG_DEFER_SETUP also for channels with different PID/PSM, which will not be added to the same ECRED_CONN_REQ in any case. Consequently, only one ECRED connection group can work at a time although it appears intended they would be separate for each PID/PSM combination.
Fix by clearing FLAG_DEFER_SETUP only for the connections that could be added in the request. Retain test_bit(FLAG_DEFER_SETUP) before calling get_peer_pid as it may be NULL otherwise.
--- net/bluetooth/l2cap_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/bluetooth/l2cap_core.c +4 -1
@@ -1451,7 +1451,7 @@ static void l2cap_ecred_defer_connect(struct l2cap_chan *chan, void *data)if (chan == conn->chan)return ; -if (!test_and_clear_bit (FLAG_DEFER_SETUP , &chan->flags)) +if (!test_bit (FLAG_DEFER_SETUP , &chan->flags))return ; pid = chan->ops->get_peer_pid (chan);
@@ -1461,6 +1461,9 @@ static void l2cap_ecred_defer_connect(struct l2cap_chan *chan, void *data) chan->mode != L2CAP_MODE_EXT_FLOWCTL || chan->state != BT_CONNECT)return ; +if (!test_and_clear_bit (FLAG_DEFER_SETUP , &chan->flags)) +return ; +if (test_and_set_bit (FLAG_ECRED_CONN_REQ_SENT , &chan->flags))return ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 254/752 Bluetooth: hci_mrvl: Fix wrong return value check of wait_on_bit_timeout()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gongwei Li <[email protected]>
[ Upstream commit 2deb76c21b81e42b3282224f7dd2046fe73fd1e0 ]
wait_on_bit_timeout() returns 0 if the bit was cleared, -EINTR if the process received a signal and the mode permitted wake up on that signal, or -EAGAIN if the timeout elapsed. It never returns 1.
Hence the check "err == 1" in mrvl_load_firmware() is dead code: when the waiting task is interrupted by a signal (-EINTR), the code falls into the "else if (err)" branch and misreports it as "Firmware request timeout" with -ETIMEDOUT instead of propagating -EINTR.
Fix this by testing for -EINTR so that an interrupted firmware load is properly detected and reported.
--- drivers/bluetooth/hci_mrvl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/bluetooth/hci_mrvl.c +1 -2
@@ -297,9 +297,8 @@ static int mrvl_load_firmware(struct hci_dev *hdev, const char *name) err =wait_on_bit_timeout (&mrvl->flags,STATE_FW_REQ_PENDING ,TASK_INTERRUPTIBLE ,msecs_to_jiffies (2000 )); -if (err ==1 ) { +if (err == -EINTR ) {bt_dev_err (hdev,"Firmware load interrupted" ); - err = -EINTR ;break ; }else if (err) {bt_dev_err (hdev,"Firmware request timeout" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 255/752 ASoC: ab8500: Reset the audio block before configuring it
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
[ Upstream commit 8e839bca7793a0b03c005f4b2b0825464290d425 ]
ResetAudn is active low, but the codec probe only deasserts it. It also clears Clk32kOut2Dis despite claiming to disable that output, and writes codec registers before releasing reset.
Pulse ResetAudn before the first audio-bank access and leave the unused 32 kHz output disabled.
--- sound/soc/codecs/ab8500-codec.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
sound/soc/codecs/ab8500-codec.c +13 -13
@@ -1919,18 +1919,18 @@ enum ab8500_filter {static int ab8500_audio_init_audioblock (struct snd_soc_component *component) {int status; +u8 mask =AB8500_STW4500CTRL3_CLK32KOUT2DIS | +AB8500_STW4500CTRL3_RESETAUDN ;dev_dbg (component->dev,"%s: Enter.\n" , __func__); -/* Reset audio-registers and disable 32kHz-clock output 2 */ - status =ab8500_sysctrl_write (AB8500_STW4500CTRL3 , -AB8500_STW4500CTRL3_CLK32KOUT2DIS | -AB8500_STW4500CTRL3_RESETAUDN , -AB8500_STW4500CTRL3_RESETAUDN ); +/* Reset the audio registers and disable the unused 32 kHz output. */ + status =ab8500_sysctrl_write (AB8500_STW4500CTRL3 , mask, +AB8500_STW4500CTRL3_CLK32KOUT2DIS );if (status <0 )return status; -return 0 ; +return ab8500_sysctrl_write (AB8500_STW4500CTRL3 , mask, mask); } static int ab8500_audio_setup_mics(struct snd_soc_component *component,
@@ -2463,6 +2463,13 @@ static int ab8500_codec_probe(struct snd_soc_component *component)ab8500_codec_of_probe (dev, np, &codec_pdata); + status =ab8500_audio_init_audioblock (component); +if (status <0 ) { +dev_err (dev,"%s: failed to init audio-block (%d)!\n" , + __func__, status); +return status; + } + status =ab8500_audio_setup_mics (component, &codec_pdata.amics);if (status <0 ) {pr_err ("%s: Failed to setup mics (%d)!\n" , __func__, status);
@@ -2475,13 +2482,6 @@ static int ab8500_codec_probe(struct snd_soc_component *component)return status; } - status =ab8500_audio_init_audioblock (component); -if (status <0 ) { -dev_err (dev,"%s: failed to init audio-block (%d)!\n" , - __func__, status); -return status; - } -/* Override HW-defaults */ snd_soc_component_write (component,AB8500_ANACONF5 ,BIT (AB8500_ANACONF5_HSAUTOEN ));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 256/752 ASoC: ab8500: Repair the DAPM capture graph
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
[ Upstream commit 103fe1a37f040ef6ac9ed1cf33be786149d2bb15 ]
The capture stream routes point away from the stream widget. Digital microphone mux routes are unconditional and bypass their enable bits, and several widgets independently own shared AD path enable bits. The dummy ADC and DAC widgets hide the resulting power graph errors.
Connect each real AIF widget to the stream and main supply, use the mux item names on digital microphone routes, and model shared AD enables as supplies. Also make the ANC DAPM switch writable.
--- sound/soc/codecs/ab8500-codec.c | 120 +++++++++++++++----------------- 1 file changed, 56 insertions(+), 64 deletions(-)
sound/soc/codecs/ab8500-codec.c +56 -64
@@ -305,7 +305,7 @@ static const struct snd_kcontrol_new dapm_anc_in_select[] = {/* ANC - Enable/Disable */ static const struct snd_kcontrol_new dapm_anc_enable[] = {SOC_DAPM_SINGLE ("Switch" ,AB8500_ANCCONF1 , -AB8500_ANCCONF1_ENANC ,0 ,0 ), +AB8500_ANCCONF1_ENANC ,1 ,0 ), };/* ANC to Earpiece - Mute */
@@ -387,12 +387,6 @@ static const struct snd_soc_dapm_widget ab8500_dapm_widgets[] = {/* DA/AD */ -SND_SOC_DAPM_INPUT ("ADC Input" ), -SND_SOC_DAPM_ADC ("ADC" ,"ab8500_0c" ,SND_SOC_NOPM ,0 ,0 ), - -SND_SOC_DAPM_DAC ("DAC" ,NULL ,SND_SOC_NOPM ,0 ,0 ), -SND_SOC_DAPM_OUTPUT ("DAC Output" ), -SND_SOC_DAPM_AIF_IN ("DA_IN1" ,NULL ,0 ,SND_SOC_NOPM ,0 ,0 ),SND_SOC_DAPM_AIF_IN ("DA_IN2" ,NULL ,0 ,SND_SOC_NOPM ,0 ,0 ), SND_SOC_DAPM_AIF_IN("DA_IN3", NULL, 0, SND_SOC_NOPM, 0, 0),
@@ -584,9 +578,8 @@ static const struct snd_soc_dapm_widget ab8500_dapm_widgets[] = {SND_SOC_DAPM_MIXER ("AD3 Channel Volume" ,SND_SOC_NOPM ,0 ,0 ,NULL ,0 ), -SND_SOC_DAPM_MIXER ("AD3 Enable" , -AB8500_ADPATHENA ,AB8500_ADPATHENA_ENAD34 ,0 , - NULL, 0), +SND_SOC_DAPM_SUPPLY ("AD34 Enable" ,AB8500_ADPATHENA , + AB8500_ADPATHENA_ENAD34, 0, NULL, 0),/* Mic 2 */
@@ -645,9 +638,8 @@ static const struct snd_soc_dapm_widget ab8500_dapm_widgets[] = { SND_SOC_NOPM, 0, 0, NULL, 0), -SND_SOC_DAPM_MIXER ("AD12 Enable" , -AB8500_ADPATHENA ,AB8500_ADPATHENA_ENAD12 ,0 , - NULL, 0), +SND_SOC_DAPM_SUPPLY ("AD12 Enable" ,AB8500_ADPATHENA , + AB8500_ADPATHENA_ENAD12, 0, NULL, 0),/* HD Capture path */
@@ -661,12 +653,8 @@ static const struct snd_soc_dapm_widget ab8500_dapm_widgets[] = {SND_SOC_DAPM_MIXER ("AD6 Channel Volume" ,SND_SOC_NOPM ,0 ,0 ,NULL ,0 ), -SND_SOC_DAPM_MIXER ("AD57 Enable" , -AB8500_ADPATHENA ,AB8500_ADPATHENA_ENAD5768 ,0 , -NULL ,0 ), -SND_SOC_DAPM_MIXER ("AD68 Enable" , -AB8500_ADPATHENA ,AB8500_ADPATHENA_ENAD5768 ,0 , - NULL, 0), +SND_SOC_DAPM_SUPPLY ("AD5768 Enable" ,AB8500_ADPATHENA , + AB8500_ADPATHENA_ENAD5768, 0, NULL, 0),/* Digital Microphone path */
@@ -698,10 +686,6 @@ static const struct snd_soc_dapm_widget ab8500_dapm_widgets[] = {SND_SOC_DAPM_MIXER ("AD4 Channel Volume" ,SND_SOC_NOPM ,0 ,0 ,NULL ,0 ), -SND_SOC_DAPM_MIXER ("AD4 Enable" , -AB8500_ADPATHENA ,AB8500_ADPATHENA_ENAD34 , -0 ,NULL ,0 ), -/* Acoustical Noise Cancellation path */ SND_SOC_DAPM_INPUT("ANC Configure Input"),
@@ -749,24 +733,17 @@ static const struct snd_soc_dapm_route ab8500_dapm_routes[] = { {"Main Supply", NULL, "Audio Power"}, {"Main Supply", NULL, "Audio Analog Power"}, - {"DAC", NULL, "ab8500_0p"}, - {"DAC", NULL, "Main Supply"}, - {"ADC", NULL, "ab8500_0c"}, - {"ADC", NULL, "Main Supply"}, -/* ANC Configure */ {"ANC Configure Input", NULL, "Main Supply"}, {"ANC Configure Output", NULL, "ANC Configure Input"}, -/* AD/DA */ - {"ADC", NULL, "ADC Input"}, - {"DAC Output", NULL, "DAC"}, -/* Powerup charge pump if DA1/2 is in use */ {"DA_IN1", NULL, "ab8500_0p"}, + {"DA_IN1", NULL, "Main Supply"}, {"DA_IN1", NULL, "Charge Pump"}, {"DA_IN2", NULL, "ab8500_0p"}, + {"DA_IN2", NULL, "Main Supply"}, {"DA_IN2", NULL, "Charge Pump"}, /* Headset path */
@@ -801,8 +778,10 @@ static const struct snd_soc_dapm_route ab8500_dapm_routes[] = {/* HF or LineOut path */ {"DA_IN3", NULL, "ab8500_0p"}, + {"DA_IN3", NULL, "Main Supply"}, {"DA3 Channel Volume", NULL, "DA_IN3"}, {"DA_IN4", NULL, "ab8500_0p"}, + {"DA_IN4", NULL, "Main Supply"}, {"DA4 Channel Volume", NULL, "DA_IN4"}, {"Speaker Left Source", "Audio Path", "DA3 Channel Volume"},
@@ -860,8 +839,10 @@ static const struct snd_soc_dapm_route ab8500_dapm_routes[] = {/* Vibrator path */ {"DA_IN5", NULL, "ab8500_0p"}, + {"DA_IN5", NULL, "Main Supply"}, {"DA5 Channel Volume", NULL, "DA_IN5"}, {"DA_IN6", NULL, "ab8500_0p"}, + {"DA_IN6", NULL, "Main Supply"}, {"DA6 Channel Volume", NULL, "DA_IN6"}, {"VIB1 DAC", NULL, "DA5 Channel Volume"},
@@ -903,13 +884,15 @@ static const struct snd_soc_dapm_route ab8500_dapm_routes[] = { {"AD1 Channel Volume", NULL, "AD1 Source Select"}, {"AD2 Channel Volume", NULL, "AD2 Source Select"}, - {"AD12 Enable", NULL, "AD1 Channel Volume"}, - {"AD12 Enable", NULL, "AD2 Channel Volume"}, + {"AD1 Channel Volume", NULL, "AD12 Enable"}, + {"AD2 Channel Volume", NULL, "AD12 Enable"}, - {"AD_OUT1", NULL, "ab8500_0c"}, - {"AD_OUT1", NULL, "AD12 Enable"}, - {"AD_OUT2", NULL, "ab8500_0c"}, - {"AD_OUT2", NULL, "AD12 Enable"}, + {"ab8500_0c", NULL, "AD_OUT1"}, + {"AD_OUT1", NULL, "Main Supply"}, + {"AD_OUT1", NULL, "AD1 Channel Volume"}, + {"ab8500_0c", NULL, "AD_OUT2"}, + {"AD_OUT2", NULL, "Main Supply"}, + {"AD_OUT2", NULL, "AD2 Channel Volume"}, /* Mic 1 */
@@ -926,11 +909,11 @@ static const struct snd_soc_dapm_route ab8500_dapm_routes[] = { {"AD3 Source Select", "Mic 1", "MIC1 ADC"}, {"AD3 Channel Volume", NULL, "AD3 Source Select"}, + {"AD3 Channel Volume", NULL, "AD34 Enable"}, - {"AD3 Enable", NULL, "AD3 Channel Volume"}, - - {"AD_OUT3", NULL, "ab8500_0c"}, - {"AD_OUT3", NULL, "AD3 Enable"}, + {"ab8500_0c", NULL, "AD_OUT3"}, + {"AD_OUT3", NULL, "Main Supply"}, + {"AD_OUT3", NULL, "AD3 Channel Volume"}, /* HD Capture path */
@@ -939,14 +922,15 @@ static const struct snd_soc_dapm_route ab8500_dapm_routes[] = { {"AD5 Channel Volume", NULL, "AD5 Source Select"}, {"AD6 Channel Volume", NULL, "AD6 Source Select"}, + {"AD5 Channel Volume", NULL, "AD5768 Enable"}, + {"AD6 Channel Volume", NULL, "AD5768 Enable"}, - {"AD57 Enable", NULL, "AD5 Channel Volume"}, - {"AD68 Enable", NULL, "AD6 Channel Volume"}, - - {"AD_OUT57", NULL, "ab8500_0c"}, - {"AD_OUT57", NULL, "AD57 Enable"}, - {"AD_OUT68", NULL, "ab8500_0c"}, - {"AD_OUT68", NULL, "AD68 Enable"}, + {"ab8500_0c", NULL, "AD_OUT57"}, + {"AD_OUT57", NULL, "Main Supply"}, + {"AD_OUT57", NULL, "AD5 Channel Volume"}, + {"ab8500_0c", NULL, "AD_OUT68"}, + {"AD_OUT68", NULL, "Main Supply"}, + {"AD_OUT68", NULL, "AD6 Channel Volume"}, /* Digital Microphone path */
@@ -957,17 +941,25 @@ static const struct snd_soc_dapm_route ab8500_dapm_routes[] = { {"DMic 5", NULL, "V-DMIC"}, {"DMic 6", NULL, "V-DMIC"}, - {"AD1 Source Select", NULL, "DMic 1"}, - {"AD2 Source Select", NULL, "DMic 2"}, - {"AD3 Source Select", NULL, "DMic 3"}, - {"AD5 Source Select", NULL, "DMic 5"}, - {"AD6 Source Select", NULL, "DMic 6"}, + {"DMIC1", NULL, "DMic 1"}, + {"DMIC2", NULL, "DMic 2"}, + {"DMIC3", NULL, "DMic 3"}, + {"DMIC4", NULL, "DMic 4"}, + {"DMIC5", NULL, "DMic 5"}, + {"DMIC6", NULL, "DMic 6"}, + + {"AD1 Source Select", "DMic 1", "DMIC1"}, + {"AD2 Source Select", "DMic 2", "DMIC2"}, + {"AD3 Source Select", "DMic 3", "DMIC3"}, + {"AD5 Source Select", "DMic 5", "DMIC5"}, + {"AD6 Source Select", "DMic 6", "DMIC6"}, - {"AD4 Channel Volume", NULL, "DMic 4"}, - {"AD4 Enable", NULL, "AD4 Channel Volume"}, + {"AD4 Channel Volume", NULL, "DMIC4"}, + {"AD4 Channel Volume", NULL, "AD34 Enable"}, - {"AD_OUT4", NULL, "ab8500_0c"}, - {"AD_OUT4", NULL, "AD4 Enable"}, + {"ab8500_0c", NULL, "AD_OUT4"}, + {"AD_OUT4", NULL, "Main Supply"}, + {"AD_OUT4", NULL, "AD4 Channel Volume"}, /* LineIn Bypass path */
@@ -992,13 +984,13 @@ static const struct snd_soc_dapm_route ab8500_dapm_routes[] = {/* Sidetone Filter path */ - {"Sidetone Left Source", "LineIn Left", "AD12 Enable"}, - {"Sidetone Left Source", "LineIn Right", "AD12 Enable"}, - {"Sidetone Left Source", "Mic 1", "AD3 Enable"}, + {"Sidetone Left Source", "LineIn Left", "AD1 Channel Volume"}, + {"Sidetone Left Source", "LineIn Right", "AD2 Channel Volume"}, + {"Sidetone Left Source", "Mic 1", "AD3 Channel Volume"}, {"Sidetone Left Source", "Headset Left", "DA_IN1"}, - {"Sidetone Right Source", "LineIn Right", "AD12 Enable"}, - {"Sidetone Right Source", "Mic 1", "AD3 Enable"}, - {"Sidetone Right Source", "DMic 4", "AD4 Enable"}, + {"Sidetone Right Source", "LineIn Right", "AD2 Channel Volume"}, + {"Sidetone Right Source", "Mic 1", "AD3 Channel Volume"}, + {"Sidetone Right Source", "DMic 4", "AD4 Channel Volume"}, {"Sidetone Right Source", "Headset Right", "DA_IN2"}, {"STFIR1 Control", NULL, "Sidetone Left Source"},
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 257/752 ASoC: ab8500: Update to modern clocking terminology
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
[ Upstream commit ef92ed2623ead917e4f10465451aa12cd7977241 ]
As part of moving to remove the old style defines for the bus clocks update the ab8500 driver to use more modern terminology for clocking.
Stable-dep-of: f98785adf004 ("ASoC: ab8500: Correct digital interface format setup")
--- sound/soc/codecs/ab8500-codec.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
sound/soc/codecs/ab8500-codec.c +10 -10
@@ -2096,26 +2096,26 @@ static int ab8500_codec_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)BIT (AB8500_DIGIFCONF3_IF0MASTER ); val =0 ; -switch (fmt &SND_SOC_DAIFMT_MASTER_MASK ) { -case SND_SOC_DAIFMT_CBM_CFM :/* codec clk & FRM master */ +switch (fmt &SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK ) { +case SND_SOC_DAIFMT_CBP_CFP :dev_dbg (dai->component->dev, -"%s: IF0 Master-mode: AB8500 master.\n" , __func__); +"%s: IF0 Master-mode: AB8500 provider.\n" , __func__); val |=BIT (AB8500_DIGIFCONF3_IF0MASTER );break ; -case SND_SOC_DAIFMT_CBS_CFS :/* codec clk & FRM slave */ +case SND_SOC_DAIFMT_CBC_CFC :dev_dbg (dai->component->dev, -"%s: IF0 Master-mode: AB8500 slave.\n" , __func__); +"%s: IF0 Master-mode: AB8500 consumer.\n" , __func__);break ; -case SND_SOC_DAIFMT_CBS_CFM :/* codec clk slave & FRM master */ -case SND_SOC_DAIFMT_CBM_CFS :/* codec clk master & frame slave */ +case SND_SOC_DAIFMT_CBC_CFP : +case SND_SOC_DAIFMT_CBP_CFC :dev_err (dai->component->dev, -"%s: ERROR: The device is either a master or a slave.\n" , +"%s: ERROR: The device is either a provider or a consumer.\n" , __func__); fallthrough;default :dev_err (dai->component->dev, -"%s: ERROR: Unsupporter master mask 0x%x\n" , - __func__, fmt &SND_SOC_DAIFMT_MASTER_MASK ); +"%s: ERROR: Unsupporter clocking mask 0x%x\n" , + __func__, fmt &SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK );return -EINVAL ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 258/752 ASoC: ab8500: Correct digital interface format setup
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
[ Upstream commit f98785adf004db6b1c9f4cea9dadae7b800db72f ]
The codec programs I2S as an undelayed left-aligned format, although the hardware manual defines delayed left-aligned as I2S compatible. It also enables the master generator when the codec is a clock consumer, changes registers before the complete format has been validated, and discards register I/O errors.
Build all three interface register values before writing them, use the required one-bit I2S delay, only run the master generator for a provider configuration, and propagate write failures.
--- sound/soc/codecs/ab8500-codec.c | 175 ++++++++++++-------------------- 1 file changed, 64 insertions(+), 111 deletions(-)
sound/soc/codecs/ab8500-codec.c +64 -111
@@ -2018,149 +2018,91 @@ static int ab8500_audio_set_ear_cmv(struct snd_soc_component *component,return 0 ; } -static int ab8500_audio_set_bit_delay (struct snd_soc_dai *dai, -unsigned int delay) -{ -unsigned int mask, val; -struct snd_soc_component *component = dai->component; - - mask =BIT (AB8500_DIGIFCONF2_IF0DEL ); - val =0 ; - -switch (delay) { -case 0 : -break ; -case 1 : - val |=BIT (AB8500_DIGIFCONF2_IF0DEL ); -break ; -default : -dev_err (dai->component->dev, -"%s: ERROR: Unsupported bit-delay (0x%x)!\n" , - __func__, delay); -return -EINVAL ; - } - -dev_dbg (dai->component->dev,"%s: IF0 Bit-delay: %d bits.\n" , - __func__, delay); -snd_soc_component_update_bits (component,AB8500_DIGIFCONF2 , mask, val); - -return 0 ; -} - -/* Gates clocking according format mask */ -static int ab8500_codec_set_dai_clock_gate (struct snd_soc_component *component, -unsigned int fmt) -{ -unsigned int mask; -unsigned int val; - - mask =BIT (AB8500_DIGIFCONF1_ENMASTGEN ) | -BIT (AB8500_DIGIFCONF1_ENFSBITCLK0 ); - - val =BIT (AB8500_DIGIFCONF1_ENMASTGEN ); - -switch (fmt &SND_SOC_DAIFMT_CLOCK_MASK ) { -case SND_SOC_DAIFMT_CONT :/* continuous clock */ -dev_dbg (component->dev,"%s: IF0 Clock is continuous.\n" , - __func__); - val |=BIT (AB8500_DIGIFCONF1_ENFSBITCLK0 ); -break ; -case SND_SOC_DAIFMT_GATED :/* clock is gated */ -dev_dbg (component->dev,"%s: IF0 Clock is gated.\n" , - __func__); -break ; -default : -dev_err (component->dev, -"%s: ERROR: Unsupported clock mask (0x%x)!\n" , - __func__, fmt &SND_SOC_DAIFMT_CLOCK_MASK ); -return -EINVAL ; - } - -snd_soc_component_update_bits (component,AB8500_DIGIFCONF1 , mask, val); - -return 0 ; -} -static int ab8500_codec_set_dai_fmt (struct snd_soc_dai *dai,unsigned int fmt) { -unsigned int mask; -unsigned int val;struct snd_soc_component *component = dai->component; -int status; +unsigned int conf1_mask, conf1_val =0 ; +unsigned int conf2_mask, conf2_val =0 ; +unsigned int conf3_mask, conf3_val =0 ; +bool provider = false; +int ret;dev_dbg (component->dev,"%s: Enter (fmt = 0x%x)\n" , __func__, fmt); - mask =BIT (AB8500_DIGIFCONF3_IF1DATOIF0AD ) | + conf3_mask =BIT (AB8500_DIGIFCONF3_IF1DATOIF0AD ) |BIT (AB8500_DIGIFCONF3_IF1CLKTOIF0CLK ) |BIT (AB8500_DIGIFCONF3_IF0BFIFOEN ) |BIT (AB8500_DIGIFCONF3_IF0MASTER ); - val =0 ;switch (fmt &SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK ) {case SND_SOC_DAIFMT_CBP_CFP : -dev_dbg (dai->component->dev, +dev_dbg (component->dev,"%s: IF0 Master-mode: AB8500 provider.\n" , __func__); - val |=BIT (AB8500_DIGIFCONF3_IF0MASTER ); + conf3_val |=BIT (AB8500_DIGIFCONF3_IF0MASTER ); + provider = true;break ;case SND_SOC_DAIFMT_CBC_CFC : -dev_dbg (dai->component->dev, +dev_dbg (component->dev,"%s: IF0 Master-mode: AB8500 consumer.\n" , __func__);break ;case SND_SOC_DAIFMT_CBC_CFP :case SND_SOC_DAIFMT_CBP_CFC : -dev_err (dai->component->dev, +dev_err (component->dev,"%s: ERROR: The device is either a provider or a consumer.\n" , __func__); fallthrough;default : -dev_err (dai->component->dev, -"%s: ERROR: Unsupporter clocking mask 0x%x\n" , +dev_err (component->dev, +"%s: ERROR: Unsupported clocking mask 0x%x\n" , __func__, fmt &SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK );return -EINVAL ; } -snd_soc_component_update_bits (component,AB8500_DIGIFCONF3 , mask, val); - -/* Set clock gating */ - status =ab8500_codec_set_dai_clock_gate (component, fmt); -if (status) { -dev_err (dai->component->dev, -"%s: ERROR: Failed to set clock gate (%d).\n" , - __func__, status); -return status; + conf1_mask =BIT (AB8500_DIGIFCONF1_ENMASTGEN ) | +BIT (AB8500_DIGIFCONF1_ENFSBITCLK0 ); +switch (fmt &SND_SOC_DAIFMT_CLOCK_MASK ) { +case SND_SOC_DAIFMT_CONT : +if (provider) + conf1_val = conf1_mask; +break ; +case SND_SOC_DAIFMT_GATED : +if (provider) + conf1_val =BIT (AB8500_DIGIFCONF1_ENMASTGEN ); +break ; +default : +dev_err (component->dev,"%s: Unsupported clock mask 0x%x\n" , + __func__, fmt &SND_SOC_DAIFMT_CLOCK_MASK ); +return -EINVAL ; } -/* Setting data transfer format */ - - mask =BIT (AB8500_DIGIFCONF2_IF0FORMAT0 ) | -BIT (AB8500_DIGIFCONF2_IF0FORMAT1 ) | -BIT (AB8500_DIGIFCONF2_FSYNC0P ) | -BIT (AB8500_DIGIFCONF2_BITCLK0P ); - val =0 ; + conf2_mask =BIT (AB8500_DIGIFCONF2_IF0FORMAT0 ) | +BIT (AB8500_DIGIFCONF2_IF0FORMAT1 ) | +BIT (AB8500_DIGIFCONF2_IF0DEL ) | +BIT (AB8500_DIGIFCONF2_FSYNC0P ) | +BIT (AB8500_DIGIFCONF2_BITCLK0P );switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {case SND_SOC_DAIFMT_I2S :/* I2S mode */ -dev_dbg (dai->component->dev,"%s: IF0 Protocol: I2S\n" , __func__); - val |=BIT (AB8500_DIGIFCONF2_IF0FORMAT1 ); -ab8500_audio_set_bit_delay (dai,0 ); +dev_dbg (component->dev,"%s: IF0 Protocol: I2S\n" , __func__); + conf2_val |=BIT (AB8500_DIGIFCONF2_IF0FORMAT1 ) | +BIT (AB8500_DIGIFCONF2_IF0DEL );break ;case SND_SOC_DAIFMT_DSP_A :/* L data MSB after FRM LRC */ -dev_dbg (dai->component->dev, +dev_dbg (component->dev,"%s: IF0 Protocol: DSP A (TDM)\n" , __func__); - val |=BIT (AB8500_DIGIFCONF2_IF0FORMAT0 ); -ab8500_audio_set_bit_delay (dai,1 ); + conf2_val |=BIT (AB8500_DIGIFCONF2_IF0FORMAT0 ) | +BIT (AB8500_DIGIFCONF2_IF0DEL );break ;case SND_SOC_DAIFMT_DSP_B :/* L data MSB during FRM LRC */ -dev_dbg (dai->component->dev, +dev_dbg (component->dev,"%s: IF0 Protocol: DSP B (TDM)\n" , __func__); - val |=BIT (AB8500_DIGIFCONF2_IF0FORMAT0 ); -ab8500_audio_set_bit_delay (dai,0 ); + conf2_val |=BIT (AB8500_DIGIFCONF2_IF0FORMAT0 );break ;default : -dev_err (dai->component->dev, +dev_err (component->dev,"%s: ERROR: Unsupported format (0x%x)!\n" , __func__, fmt &SND_SOC_DAIFMT_FORMAT_MASK );return -EINVAL ;
@@ -2168,39 +2110,50 @@ static int ab8500_codec_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)switch (fmt &SND_SOC_DAIFMT_INV_MASK ) {case SND_SOC_DAIFMT_NB_NF :/* normal bit clock + frame */ -dev_dbg (dai->component->dev, +dev_dbg (component->dev,"%s: IF0: Normal bit clock, normal frame\n" , __func__);break ;case SND_SOC_DAIFMT_NB_IF :/* normal BCLK + inv FRM */ -dev_dbg (dai->component->dev, +dev_dbg (component->dev,"%s: IF0: Normal bit clock, inverted frame\n" , __func__); - val |=BIT (AB8500_DIGIFCONF2_FSYNC0P ); + conf2_val |=BIT (AB8500_DIGIFCONF2_FSYNC0P );break ;case SND_SOC_DAIFMT_IB_NF :/* invert BCLK + nor FRM */ -dev_dbg (dai->component->dev, +dev_dbg (component->dev,"%s: IF0: Inverted bit clock, normal frame\n" , __func__); - val |=BIT (AB8500_DIGIFCONF2_BITCLK0P ); + conf2_val |=BIT (AB8500_DIGIFCONF2_BITCLK0P );break ;case SND_SOC_DAIFMT_IB_IF :/* invert BCLK + FRM */ -dev_dbg (dai->component->dev, +dev_dbg (component->dev,"%s: IF0: Inverted bit clock, inverted frame\n" , __func__); - val |=BIT (AB8500_DIGIFCONF2_FSYNC0P ); - val |=BIT (AB8500_DIGIFCONF2_BITCLK0P ); + conf2_val |=BIT (AB8500_DIGIFCONF2_FSYNC0P ) | +BIT (AB8500_DIGIFCONF2_BITCLK0P );break ;default : -dev_err (dai->component->dev, +dev_err (component->dev,"%s: ERROR: Unsupported INV mask 0x%x\n" , __func__, fmt &SND_SOC_DAIFMT_INV_MASK );return -EINVAL ; } -snd_soc_component_update_bits (component,AB8500_DIGIFCONF2 , mask, val); + ret =snd_soc_component_update_bits (component,AB8500_DIGIFCONF3 , + conf3_mask, conf3_val); +if (ret <0 ) +return ret; -return 0 ; + ret =snd_soc_component_update_bits (component,AB8500_DIGIFCONF1 , + conf1_mask, conf1_val); +if (ret <0 ) +return ret; + + ret =snd_soc_component_update_bits (component,AB8500_DIGIFCONF2 , + conf2_mask, conf2_val); + +return ret <0 ? ret :0 ; } static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 259/752 ASoC: ab8500: Validate and program TDM slots correctly
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
[ Upstream commit 85cef7e2004ef5c1a715feaddb55d3f3d27bac0a ]
The interface clock ratio is selected from the slot count alone, ffs() and fls() produce one-based hardware slot numbers, eight-channel mode does not program any mappings, and all register errors are ignored. Invalid masks can also leave a partially programmed interface.
Validate the complete configuration first, derive the supported BCLK ratio from slots times slot width, use zero-based slot indices, program deterministic eight-channel maps, and propagate register failures.
--- sound/soc/codecs/ab8500-codec.c | 216 ++++++++++++++++++-------------- 1 file changed, 123 insertions(+), 93 deletions(-)
sound/soc/codecs/ab8500-codec.c +123 -93
@@ -2161,23 +2161,27 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai, int slots, int slot_width) {struct snd_soc_component *component = dai->component; -unsigned int val, mask, slot, slots_active; +unsigned int active_mask, clock_ratio, slot, value, ad_out, reg; +unsigned int tx_active, rx_active; +unsigned int conf1_val, conf2_val; +unsigned int mask; +int channel, ret; mask =BIT (AB8500_DIGIFCONF2_IF0WL0 ) |BIT (AB8500_DIGIFCONF2_IF0WL1 ); - val =0 ; + conf2_val =0 ;switch (slot_width) {case 16 :break ;case 20 : - val |=BIT (AB8500_DIGIFCONF2_IF0WL0 ); + conf2_val |=BIT (AB8500_DIGIFCONF2_IF0WL0 );break ;case 24 : - val |=BIT (AB8500_DIGIFCONF2_IF0WL1 ); + conf2_val |=BIT (AB8500_DIGIFCONF2_IF0WL1 );break ;case 32 : - val |=BIT (AB8500_DIGIFCONF2_IF0WL1 ) | + conf2_val |=BIT (AB8500_DIGIFCONF2_IF0WL1 ) |BIT (AB8500_DIGIFCONF2_IF0WL0 );break ;default :
@@ -2186,27 +2190,11 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai,return -EINVAL ; } -dev_dbg (dai->component->dev,"%s: IF0 slot-width: %d bits.\n" , - __func__, slot_width); -snd_soc_component_update_bits (component,AB8500_DIGIFCONF2 , mask, val); - -/* Setup TDM clocking according to slot count */ -dev_dbg (dai->component->dev,"%s: Slots, total: %d\n" , __func__, slots); - mask =BIT (AB8500_DIGIFCONF1_IF0BITCLKOS0 ) | -BIT (AB8500_DIGIFCONF1_IF0BITCLKOS1 );switch (slots) {case 2 : - val =AB8500_MASK_NONE ; -break ;case 4 : - val =BIT (AB8500_DIGIFCONF1_IF0BITCLKOS0 ); -break ;case 8 : - val =BIT (AB8500_DIGIFCONF1_IF0BITCLKOS1 ); -break ;case 16 : - val =BIT (AB8500_DIGIFCONF1_IF0BITCLKOS0 ) | -BIT (AB8500_DIGIFCONF1_IF0BITCLKOS1 );break ;default : dev_err(dai->component->dev,
@@ -2214,92 +2202,134 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai, __func__, slots);return -EINVAL ; } -snd_soc_component_update_bits (component,AB8500_DIGIFCONF1 , mask, val); - -/* Setup TDM DA according to active tx slots */ -if (tx_mask & ~0xff ) -return -EINVAL ; - - mask =AB8500_DASLOTCONFX_SLTODAX_MASK ; - tx_mask = tx_mask <<AB8500_DA_DATA0_OFFSET ; - slots_active =hweight32 (tx_mask); - -dev_dbg (dai->component->dev,"%s: Slots, active, TX: %d\n" , __func__, - slots_active); - -switch (slots_active) { -case 0 : + clock_ratio = slots * slot_width; +switch (clock_ratio) { +case 32 : + conf1_val =0 ;break ; -case 1 : - slot =ffs (tx_mask); -snd_soc_component_update_bits (component,AB8500_DASLOTCONF1 , mask, slot); -snd_soc_component_update_bits (component,AB8500_DASLOTCONF3 , mask, slot); -snd_soc_component_update_bits (component,AB8500_DASLOTCONF2 , mask, slot); -snd_soc_component_update_bits (component,AB8500_DASLOTCONF4 , mask, slot); +case 64 : + conf1_val =BIT (AB8500_DIGIFCONF1_IF0BITCLKOS0 );break ; -case 2 : - slot =ffs (tx_mask); -snd_soc_component_update_bits (component,AB8500_DASLOTCONF1 , mask, slot); -snd_soc_component_update_bits (component,AB8500_DASLOTCONF3 , mask, slot); - slot =fls (tx_mask); -snd_soc_component_update_bits (component,AB8500_DASLOTCONF2 , mask, slot); -snd_soc_component_update_bits (component,AB8500_DASLOTCONF4 , mask, slot); +case 128 : + conf1_val =BIT (AB8500_DIGIFCONF1_IF0BITCLKOS1 );break ; -case 8 : -dev_dbg (dai->component->dev, -"%s: In 8-channel mode DA-from-slot mapping is set manually." , - __func__); +case 256 : + conf1_val =BIT (AB8500_DIGIFCONF1_IF0BITCLKOS0 ) | +BIT (AB8500_DIGIFCONF1_IF0BITCLKOS1 );break ;default : -dev_err (dai->component->dev, -"%s: Unsupported number of active TX-slots (%d)!\n" , - __func__, slots_active); +dev_err (component->dev,"%s: Unsupported BCLK ratio (%u)!\n" , + __func__, clock_ratio);return -EINVAL ; } -/* Setup TDM AD according to active RX-slots */ + active_mask =GENMASK (min (slots,8 ) -1 ,0 ); +if ((tx_mask | rx_mask) & ~active_mask) { +dev_err (component->dev,"%s: Slot mask exceeds slot count\n" , + __func__); +return -EINVAL ; + } -if (rx_mask & ~0xff ) + tx_active =hweight32 (tx_mask); + rx_active =hweight32 (rx_mask); +if (tx_active !=0 && tx_active !=1 && tx_active !=2 && + tx_active !=8 ) { +dev_err (component->dev,"%s: Unsupported active TX slots (%u)!\n" , + __func__, tx_active); +return -EINVAL ; + } +if (rx_active !=0 && rx_active !=1 && rx_active !=2 && + rx_active !=8 ) { +dev_err (component->dev,"%s: Unsupported active RX slots (%u)!\n" , + __func__, rx_active);return -EINVAL ; + } + +dev_dbg (component->dev, +"%s: %d slots of %d bits, TX active: %u, RX active: %u\n" , + __func__, slots, slot_width, tx_active, rx_active); - rx_mask = rx_mask <<AB8500_AD_DATA0_OFFSET ; - slots_active =hweight32 (rx_mask); + ret =snd_soc_component_update_bits (component,AB8500_DIGIFCONF2 , + mask, conf2_val); +if (ret <0 ) +return ret; -dev_dbg (dai->component->dev,"%s: Slots, active, RX: %d\n" , __func__, - slots_active); + mask =BIT (AB8500_DIGIFCONF1_IF0BITCLKOS0 ) | +BIT (AB8500_DIGIFCONF1_IF0BITCLKOS1 ); + ret =snd_soc_component_update_bits (component,AB8500_DIGIFCONF1 , + mask, conf1_val); +if (ret <0 ) +return ret; -switch (slots_active) { -case 0 : -break ; -case 1 : - slot =ffs (rx_mask); -snd_soc_component_update_bits (component,AB8500_ADSLOTSEL (slot), -AB8500_MASK_SLOT (slot), -AB8500_ADSLOTSELX_AD_OUT_TO_SLOT (AB8500_AD_OUT3 , slot)); -break ; -case 2 : - slot =ffs (rx_mask); -snd_soc_component_update_bits (component, -AB8500_ADSLOTSEL (slot), -AB8500_MASK_SLOT (slot), -AB8500_ADSLOTSELX_AD_OUT_TO_SLOT (AB8500_AD_OUT3 , slot)); - slot =fls (rx_mask); -snd_soc_component_update_bits (component, -AB8500_ADSLOTSEL (slot), -AB8500_MASK_SLOT (slot), -AB8500_ADSLOTSELX_AD_OUT_TO_SLOT (AB8500_AD_OUT2 , slot)); -break ; -case 8 : -dev_dbg (dai->component->dev, -"%s: In 8-channel mode AD-to-slot mapping is set manually." , - __func__); -break ; -default : -dev_err (dai->component->dev, -"%s: Unsupported number of active RX-slots (%d)!\n" , - __func__, slots_active); -return -EINVAL ; + mask =AB8500_DASLOTCONFX_SLTODAX_MASK ; +if (tx_active ==1 || tx_active ==2 ) { + slot =__ffs (tx_mask) +AB8500_DA_DATA0_OFFSET ; + reg =AB8500_DASLOTCONF1 ; + ret =snd_soc_component_update_bits (component, reg, mask, slot); +if (ret <0 ) +return ret; + reg =AB8500_DASLOTCONF3 ; + ret =snd_soc_component_update_bits (component, reg, mask, slot); +if (ret <0 ) +return ret; + +if (tx_active ==2 ) + slot =__fls (tx_mask) +AB8500_DA_DATA0_OFFSET ; + reg =AB8500_DASLOTCONF2 ; + ret =snd_soc_component_update_bits (component, reg, mask, slot); +if (ret <0 ) +return ret; + reg =AB8500_DASLOTCONF4 ; + ret =snd_soc_component_update_bits (component, reg, mask, slot); +if (ret <0 ) +return ret; + }else if (tx_active ==8 ) { + channel =0 ; +for (slot =0 ; slot <8 ; slot++) { +if (!(tx_mask &BIT (slot))) +continue ; + reg =AB8500_DASLOTCONF1 + channel++; + value = slot +AB8500_DA_DATA0_OFFSET ; + ret =snd_soc_component_update_bits (component, reg, mask, value); +if (ret <0 ) +return ret; + } + } + +if (rx_active ==1 || rx_active ==2 ) { + slot =__ffs (rx_mask) +AB8500_AD_DATA0_OFFSET ; + value =AB8500_ADSLOTSELX_AD_OUT_TO_SLOT (AB8500_AD_OUT3 , + slot); + reg =AB8500_ADSLOTSEL (slot); + mask =AB8500_MASK_SLOT (slot); + ret =snd_soc_component_update_bits (component, reg, mask, value); +if (ret <0 ) +return ret; + +if (rx_active ==2 ) { + slot =__fls (rx_mask) +AB8500_AD_DATA0_OFFSET ; + value =AB8500_ADSLOTSELX_AD_OUT_TO_SLOT (AB8500_AD_OUT2 , + slot); + reg =AB8500_ADSLOTSEL (slot); + mask =AB8500_MASK_SLOT (slot); + ret =snd_soc_component_update_bits (component, reg, mask, value); +if (ret <0 ) +return ret; + } + }else if (rx_active ==8 ) { + channel =0 ; +for (slot =0 ; slot <8 ; slot++) { +if (!(rx_mask &BIT (slot))) +continue ; + ad_out =AB8500_AD_OUT1 + channel++; + value =AB8500_ADSLOTSELX_AD_OUT_TO_SLOT (ad_out, slot); + reg =AB8500_ADSLOTSEL (slot); + mask =AB8500_MASK_SLOT (slot); + ret =snd_soc_component_update_bits (component, reg, mask, value); +if (ret <0 ) +return ret; + } }return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 260/752 tty: make tty_ldisc_ops::hangup return void
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Slaby <[email protected]>
[ Upstream commit 28f194da4a2c4d431552025a4386edaffab181bd ]
The documentation says that the return value of tty_ldisc_ops::hangup hook is ignored. And it really is, so there is no point for its return type to be int. Switch it to void and all the hooks too.
Stable-dep-of: 9feb069e5ed0 ("ppp: ppp_async: simplify tty disc_data access")
--- Documentation/driver-api/serial/tty.rst | 2 +- drivers/input/serio/serport.c | 3 +-- drivers/net/can/slcan.c | 3 +-- drivers/net/ppp/ppp_async.c | 3 +-- drivers/net/ppp/ppp_synctty.c | 3 +-- drivers/net/slip/slip.c | 3 +-- include/linux/tty_ldisc.h | 2 +- sound/soc/codecs/cx20442.c | 3 +-- sound/soc/ti/ams-delta.c | 3 +-- 9 files changed, 9 insertions(+), 16 deletions(-)
Documentation/driver-api/serial/tty.rst +1 -1
@@ -58,7 +58,7 @@ close() This is called on a terminal when the line hangup() Called when the tty line is hung up. The line discipline should cease I/O to the tty. No further calls into the ldisc code will occur. - The return value is ignored. Can sleep. + Can sleep. read() (optional) A process requests reading data from the line. Multiple read calls may occur in parallel
drivers/input/serio/serport.c +1 -2
@@ -244,7 +244,7 @@ static int serport_ldisc_compat_ioctl(struct tty_struct *tty, }#endif -static int serport_ldisc_hangup (struct tty_struct *tty) +static void serport_ldisc_hangup (struct tty_struct *tty) {struct serport *serport = (struct serport *) tty->disc_data;unsigned long flags;
@@ -254,7 +254,6 @@ static int serport_ldisc_hangup(struct tty_struct *tty)spin_unlock_irqrestore (&serport->lock, flags);wake_up_interruptible (&serport->wait); -return 0 ; }static void serport_ldisc_write_wakeup (struct tty_struct * tty)
drivers/net/can/slcan.c +1 -2
@@ -663,10 +663,9 @@ static void slcan_close(struct tty_struct *tty)/* This will complete via sl_free_netdev */ } -static int slcan_hangup (struct tty_struct *tty) +static void slcan_hangup (struct tty_struct *tty) {slcan_close (tty); -return 0 ; }/* Perform I/O control on an active SLCAN channel. */
drivers/net/ppp/ppp_async.c +1 -2
@@ -247,10 +247,9 @@ ppp_asynctty_close(struct tty_struct *tty)* Wait for I/O to driver to complete and unregister PPP channel. * This is already done by the close routine, so just call that. */ -static int ppp_asynctty_hangup (struct tty_struct *tty) +static void ppp_asynctty_hangup (struct tty_struct *tty) {ppp_asynctty_close (tty); -return 0 ; }/*
drivers/net/ppp/ppp_synctty.c +1 -2
@@ -245,10 +245,9 @@ ppp_sync_close(struct tty_struct *tty)* Wait for I/O to driver to complete and unregister PPP channel. * This is already done by the close routine, so just call that. */ -static int ppp_sync_hangup (struct tty_struct *tty) +static void ppp_sync_hangup (struct tty_struct *tty) {ppp_sync_close (tty); -return 0 ; }/*
drivers/net/slip/slip.c +1 -2
@@ -916,10 +916,9 @@ static void slip_close(struct tty_struct *tty)/* sl_uninit() has dropped the slip_devs[] entry by now */ } -static int slip_hangup (struct tty_struct *tty) +static void slip_hangup (struct tty_struct *tty) {slip_close (tty); -return 0 ; }/************************************************************************ * STANDARD SLIP ENCAPSULATION *
include/linux/tty_ldisc.h +1 -1
@@ -200,7 +200,7 @@ struct tty_ldisc_ops {void (*set_termios)(struct tty_struct *tty,struct ktermios *old);__poll_t (*poll)(struct tty_struct *,struct file *,struct poll_table_struct *); -int (*hangup)(struct tty_struct *tty); +void (*hangup)(struct tty_struct *tty);/* * The following routines are called from below.
sound/soc/codecs/cx20442.c +1 -2
@@ -252,10 +252,9 @@ static void v253_close(struct tty_struct *tty) }/* Line discipline .hangup() */ -static int v253_hangup (struct tty_struct *tty) +static void v253_hangup (struct tty_struct *tty) {v253_close (tty); -return 0 ; }/* Line discipline .receive_buf() */
sound/soc/ti/ams-delta.c +1 -2
@@ -332,10 +332,9 @@ static void cx81801_close(struct tty_struct *tty) }/* Line discipline .hangup() */ -static int cx81801_hangup (struct tty_struct *tty) +static void cx81801_hangup (struct tty_struct *tty) {cx81801_close (tty); -return 0 ; }/* Line discipline .receive_buf() */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 261/752 ppp: ppp_async: simplify tty disc_data access
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qingfang Deng <[email protected]>
[ Upstream commit 9feb069e5ed03582fbf6272539f1caa2a17dc6d5 ]
tty_ldisc_hangup() invokes the hangup callback while holding only a read lock on tty->ldisc_sem, so it can run concurrently with other line discipline callbacks. This currently forces async PPP to maintain separate lifetime protection around tty->disc_data.
Line discipline close is called under the write lock during hangup processing. Remove the hangup callback and rely on close for teardown, as done for SLIP by commit 23c53269f2ba ("slip: remove slip_hangup() to fix use-after-free in slip_receive_buf()"). This serializes teardown with all other line discipline operations.
disc_data_lock, refcount and completion are redundant with that serialization. Remove them and access tty->disc_data directly.
This also eliminates a lockdep warning reported by syzbot. The warning does not indicate a real deadlock because the write side runs only in process context with hardirqs disabled.
--- drivers/net/ppp/ppp_async.c | 82 ++++--------------------------------- 1 file changed, 7 insertions(+), 75 deletions(-)
drivers/net/ppp/ppp_async.c +7 -75
@@ -65,8 +65,6 @@ struct asyncppp {struct tasklet_struct tsk; -refcount_t refcnt; -struct completion dead;struct ppp_channel chan;/* interface to generic ppp layer */ unsigned char obuf[OBUFSIZE ]; };
@@ -115,38 +113,6 @@ static const struct ppp_channel_ops async_ops = {* Routines implementing the PPP line discipline. */ -/* -* We have a potential race on dereferencing tty->disc_data, -* because the tty layer provides no locking at all - thus one -* cpu could be running ppp_asynctty_receive while another -* calls ppp_asynctty_close, which zeroes tty->disc_data and -* frees the memory that ppp_asynctty_receive is using. The best -* way to fix this is to use a rwlock in the tty struct, but for now -* we use a single global rwlock for all ttys in ppp line discipline. -* -* FIXME: this is no longer true. The _close path for the ldisc is -* now guaranteed to be sane. -*/ -static DEFINE_RWLOCK (disc_data_lock); - -static struct asyncppp *ap_get (struct tty_struct *tty) -{ -struct asyncppp *ap; - -read_lock (&disc_data_lock); - ap = tty->disc_data; -if (ap !=NULL ) -refcount_inc (&ap->refcnt); -read_unlock (&disc_data_lock); -return ap; -} - -static void ap_put (struct asyncppp *ap) -{ -if (refcount_dec_and_test (&ap->refcnt)) -complete (&ap->dead); -} -/* * Called when a tty is put into PPP line discipline. Called in process * context.
@@ -181,9 +147,6 @@ ppp_asynctty_open(struct tty_struct *tty)skb_queue_head_init (&ap->rqueue);tasklet_setup (&ap->tsk, ppp_async_process); -refcount_set (&ap->refcnt,1 ); -init_completion (&ap->dead); - ap->chan.private = ap; ap->chan.ops = &async_ops; ap->chan.mtu =PPP_MRU ;
@@ -204,34 +167,18 @@ ppp_asynctty_open(struct tty_struct *tty) }/* -* Called when the tty is put into another line discipline -* or it hangs up. We have to wait for any cpu currently -* executing in any of the other ppp_asynctty_* routines to -* finish before we can call ppp_unregister_channel and free -* the asyncppp struct. This routine must be called from -* process context, not interrupt or softirq context. +* Called when the tty is put into another line discipline or it hangs up. +* This call is serialized against other ldisc functions. */ static void ppp_asynctty_close (struct tty_struct *tty) { -struct asyncppp *ap; +struct asyncppp *ap = tty->disc_data; -write_lock_irq (&disc_data_lock); - ap = tty->disc_data; - tty->disc_data =NULL ; -write_unlock_irq (&disc_data_lock);if (!ap)return ; -/* -* We have now ensured that nobody can start using ap from now -* on, but we have to wait for all existing users to finish. -* Note that ppp_unregister_channel ensures that no calls to -* our channel ops (i.e. ppp_async_send/ioctl) are in progress -* by the time it returns. -*/ -if (!refcount_dec_and_test (&ap->refcnt)) -wait_for_completion (&ap->dead); + tty->disc_data =NULL ;tasklet_kill (&ap->tsk);ppp_unregister_channel (&ap->chan);
@@ -241,17 +188,6 @@ ppp_asynctty_close(struct tty_struct *tty)kfree (ap); } -/* -* Called on tty hangup in process context. -* -* Wait for I/O to driver to complete and unregister PPP channel. -* This is already done by the close routine, so just call that. -*/ -static void ppp_asynctty_hangup (struct tty_struct *tty) -{ -ppp_asynctty_close (tty); -} -/* * Read does nothing - no data is ever available this way. * Pppd reads and writes packets via /dev/ppp instead.
@@ -284,7 +220,7 @@ static int ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) { - struct asyncppp *ap = ap_get(tty); + struct asyncppp *ap = tty->disc_data;int err, val;int __user *p = (int __user *)arg;
@@ -325,7 +261,6 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file, err =tty_mode_ioctl (tty, file, cmd, arg); } -ap_put (ap);return err; }
@@ -341,7 +276,7 @@ static void ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, const char *cflags, int count) { - struct asyncppp *ap = ap_get(tty); + struct asyncppp *ap = tty->disc_data;unsigned long flags;if (!ap)
@@ -351,21 +286,19 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf,spin_unlock_irqrestore (&ap->recv_lock, flags);if (!skb_queue_empty (&ap->rqueue))tasklet_schedule (&ap->tsk); -ap_put (ap);tty_unthrottle (tty); }static void ppp_asynctty_wakeup (struct tty_struct *tty) { -struct asyncppp *ap =ap_get (tty); +struct asyncppp *ap = tty->disc_data;clear_bit (TTY_DO_WRITE_WAKEUP , &tty->flags);if (!ap)return ;set_bit (XMIT_WAKEUP , &ap->xmit_flags);tasklet_schedule (&ap->tsk); -ap_put (ap); }
@@ -375,7 +308,6 @@ static struct tty_ldisc_ops ppp_ldisc = { .name = "ppp", .open = ppp_asynctty_open, .close = ppp_asynctty_close, - .hangup = ppp_asynctty_hangup, .read = ppp_asynctty_read, .write = ppp_asynctty_write, .ioctl = ppp_asynctty_ioctl,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 262/752 tipc: fix NULL deref in tipc_named_node_up() on empty publication list
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tung Nguyen <[email protected]>
[ Upstream commit b3b76e9f4f2476f1135b2ba7743a821db4a0df4b ]
User-space applications can bind a large number of service addresses to one or more sockets. Each binding of a local-scope service address inserts one entry (publication) into the TIPC name table. If the number of these publications exceeds TIPC_MAX_PUBL (65535), protocol service types (such as node state and link state) are no longer inserted into the name table. This causes two issues:
1. User-space applications subscribing to node or link up/down events stop receiving notifications.
2. A NULL pointer dereference can occur:
BUG: kernel NULL pointer dereference, address: 00000000000000d0 ... CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 7.2.0-rc4-default+ #5 PREEMPT(full) ... RIP: 0010:tipc_named_node_up (./include/linux/skbuff.h:2251 net/tipc/name_distr.c:195 net/tipc/name_distr.c:221) ... Call Trace: <IRQ> tipc_node_write_unlock (net/tipc/node.c:428) tipc_rcv (net/tipc/node.c:934 net/tipc/node.c:2189) tipc_udp_recv (net/tipc/udp_media.c:389)
Thread 1 (tipc_net_finalize) | Thread 2 (named_distribute)
-----------------------------|-----------------------------
| ...
| list_for_each_entry(publ, pls, binding_node) {
| ...
| __skb_queue_tail(list, skb);
| ...
| }
| ...
| hdr = buf_msg(skb_peek_tail(list));
... |
tipc_nametbl_publish(); | If 'tipc_nametbl_publish()' (Thread 1) fails because the number of local publications reaches TIPC_MAX_PUBL, list (Thread 2) will be empty. As a result, NULL is passed to 'buf_msg()', leading to a NULL pointer dereference.
Fix these issues by allowing protocol service types (node state, link state, and topology server) to be inserted into the name table unconditionally. This ensures that users subscribing to these types always receive notifications. In addition, the maximum number of local user publications is reduced to (TIPC_MAX_PUBL - 1). This ensures that the maximum bulk size calculated in tipc_link_set_queue_limits() remains valid.
--- net/tipc/name_table.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-)
net/tipc/name_table.c +26 -4
@@ -763,21 +763,40 @@ struct publication *tipc_nametbl_publish(struct net *net, struct tipc_uaddr *ua, struct tipc_socket_addr *sk, u32 key) {struct name_table *nt =tipc_name_table (net); +u32 max_user_pub =TIPC_MAX_PUBL -1 ;struct tipc_net *tn =tipc_net (net);struct publication *p =NULL ;struct sk_buff *skb =NULL ; +bool protocol_type = false;u32 rc_dests; +if (ua->sr.type ==TIPC_NODE_STATE || ua->sr.type ==TIPC_LINK_STATE || + ua->sr.type ==TIPC_TOP_SRV ) + protocol_type = true; +spin_lock_bh (&tn->nametbl_lock); +if (protocol_type) + goto insert; -if (nt->local_publ_count >=TIPC_MAX_PUBL ) { -pr_warn ("Bind failed, max limit %u reached\n" ,TIPC_MAX_PUBL ); +/* Reserve one entry for node state service type because it has cluster +* scope and it is distributed in bulk. So, the maximum number of user's +* publications is (TIPC_MAX_PUBL - 1). +*/ +if (nt->local_publ_count >= max_user_pub) { +pr_warn ("Bind failed, max limit %u reached\n" , max_user_pub); goto exit; } +insert: p =tipc_nametbl_insert_publ (net, ua, sk, key);if (p) { - nt->local_publ_count++; +/* Not count node state, link state and topology server types +* so that maximum nt->local_publ_count does not prevent +* protocol service types from being inserted into the name +* table. +*/ +if (!protocol_type) + nt->local_publ_count++; skb =tipc_named_publish (net, p); } rc_dests = nt->rc_dests;
@@ -810,7 +829,10 @@ void tipc_nametbl_withdraw(struct net *net, struct tipc_uaddr *ua, p =tipc_nametbl_remove_publ (net, ua, sk, key);if (p) { - nt->local_publ_count--; +if (p->sr.type !=TIPC_NODE_STATE && + p->sr.type !=TIPC_LINK_STATE && + p->sr.type !=TIPC_TOP_SRV ) + nt->local_publ_count--; skb =tipc_named_withdraw (net, p);list_del_init (&p->binding_sock);kfree_rcu (p, rcu);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 263/752 ipv6: sr: restore network header before routing and forwarding
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 975b5b067f525a1b1338c4a3bee1c46545801518 ]
ipv6_srh_rcv() runs with skb->data at the Segment Routing Header (SRH) while skb_network_header() points at the IPv6 header.
When segments_left > 0, ipv6_srh_rcv() previously restored the skb->data position by pushing sizeof(struct ipv6hdr), assuming the SRH immediately followed the fixed IPv6 header. If another extension header (such as a Hop-by-Hop options header) precedes the SRH, skb_network_offset() remained negative.
This led to two problems:
1. During ip6_route_input(), fib6_rules_early_flow_dissect() invokes __skb_flow_dissect() which passes the negative skb_network_offset() to flow dissection, breaking BPF and C flow dissector logic.
2. If forwarded via ip6_forward() or redirected via act_mirred, downstream handlers (like sch_fragment() or neighbour output) pass the negative offset as an unsigned length, triggering OOB memcpy or buffer overflows.
Fix this by pushing -skb_network_offset(skb) before routing, ensuring skb_network_offset(skb) is 0 for route lookup / flow dissection as well as downstream forwarding. On the loopback path, pull skb_transport_offset(skb) to restore skb->data to the SRH before looping back.
--- net/ipv6/exthdrs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv6/exthdrs.c +2 -2
@@ -453,7 +453,7 @@ static int ipv6_srh_rcv(struct sk_buff *skb) hdr->segments_left--; addr = hdr->segments + hdr->segments_left; -skb_push (skb,sizeof (struct ipv6hdr )); +skb_push (skb, -skb_network_offset (skb));if (skb->ip_summed ==CHECKSUM_COMPLETE )seg6_update_csum (skb);
@@ -479,7 +479,7 @@ static int ipv6_srh_rcv(struct sk_buff *skb) }ipv6_hdr (skb)->hop_limit--; -skb_pull (skb,sizeof (struct ipv6hdr )); +skb_pull (skb,skb_transport_offset (skb)); goto looped_back; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 264/752 af_packet: Dont cast tpacket_hdr.tp_len to int in tpacket_parse_header().
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 73e594c19b4f815d8343461cec7074c4713bbde7 ]
syzbot reported BUG() in sock_sendmsg_nosec(). [0]
The problem is that tpacket_parse_header() casts user-provided tpacket_hdr.tp_len, which is u32, to int.
If the length is larger than INT_MAX, the following condition in tpacket_parse_header() passes,
if (unlikely(tp_len > size_max))
and any negative value can be returned to the caller, up to sock_sendmsg_nosec().
The repro set tpacket_hdr.tp_len to 0xfffffdef, which is cast to -EIOCBQUEUED (-529), triggering BUG() in sock_sendmsg_nosec().
*(uint64_t*)0x200000000008 = 0xfffffdef; ... syscall(__NR_write, /*fd=*/r[0], /*buf=*/0x200000000000ul, /*count=*/1ul);
Let's define the local tp_len as u32 in tpacket_parse_header().
[0]:
kernel BUG at net/socket.c:803!
Oops: invalid opcode: 0000 [#1] SMP KASAN PTI CPU: 0 UID: 0 PID: 5628 Comm: syz-executor176 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026 RIP: 0010:sock_sendmsg_nosec+0x145/0x180 net/socket.c:803 Code: 06 67 48 0f b9 3a eb 95 e8 e8 3a 22 f8 48 89 df 4c 89 f6 4c 89 e2 4d 89 fb 2e e8 32 a5 5c 16 e9 51 ff ff ff e8 cc 3a 22 f8 90 <0f> 0b e8 c4 3a 22 f8 48 83 c3 18 48 89 d8 48 c1 e8 03 42 80 3c 28 RSP: 0018:ffffc90003aefb48 EFLAGS: 00010293 RAX: ffffffff89a578d4 RBX: ffff8880764c67c0 RCX: ffff88807fb23e80 RDX: 0000000000000000 RSI: 00000000fffffdef RDI: 00000000fffffdef RBP: 00000000fffffdef R08: ffffc90003aef747 R09: 1ffff9200075dee8 R10: dffffc0000000000 R11: fffff5200075dee9 R12: 0000000000000001 R13: dffffc0000000000 R14: ffffc90003aefbc0 R15: ffffffff8aac4310 FS: 000055559101b400(0000) GS:ffff888124ce0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000200000000210 CR3: 0000000073dca000 CR4: 00000000003526f0 Call Trace: <TASK> __sock_sendmsg net/socket.c:815 [inline] sock_write_iter+0x2de/0x3e0 net/socket.c:1266 new_sync_write fs/read_write.c:595 [inline] vfs_write+0x612/0xba0 fs/read_write.c:687 ksys_write+0x150/0x270 fs/read_write.c:739 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f173130ecb9 Code: c0 79 93 eb d5 48 8d 7c 1d 00 eb 99 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 d8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffd67e44248 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000200000000000 RCX: 00007f173130ecb9 RDX: 0000000000000001 RSI: 0000200000000000 RDI: 0000000000000003 RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffd67e44388 R13: 0000000000000002 R14: 00002000000000c0 R15: 0000000000000002 </TASK>
--- net/packet/af_packet.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/packet/af_packet.c +3 -2
@@ -2683,7 +2683,8 @@ static int tpacket_parse_header(struct packet_sock *po, void *frame, int size_max, void **data) { union tpacket_uhdr ph; -int tp_len, off; +u32 tp_len; +int off; ph.raw = frame;
@@ -2703,7 +2704,7 @@ static int tpacket_parse_header(struct packet_sock *po, void *frame,break ; }if (unlikely (tp_len > size_max)) { -pr_err ("packet size is too long (%d > %d)\n" , tp_len, size_max); +pr_err ("packet size is too long (%u > %d)\n" , tp_len, size_max);return -EMSGSIZE ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 265/752 staging: fbtft: make dirty_lock IRQ-safe
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hui Su <[email protected]>
[ Upstream commit f576944a59f31bcffff121117ebf452c5dd162b7 ]
fbtft_mkdirty() can be reached from the fbcon rendering path while processing printk() in hardirq context. Meanwhile, dirty_lock is also taken by fbtft_deferred_io() in workqueue context with local interrupts enabled.
Lockdep reports a possible IRQ lock inversion involving dirty_lock and console_owner. A hardirq can interrupt a CPU holding dirty_lock and enter the console rendering path, which can attempt to acquire dirty_lock again.
The following lockdep report was observed on an RK3566 system with CONFIG_PROVE_LOCKING enabled:
WARNING: possible irq lock inversion dependency detected swapper/2/0 just changed the state of lock:
(console_owner){-...}-{0:0}
but this lock took another, HARDIRQ-unsafe lock in the past:
(&par->dirty_lock){+.+.}-{2:2}
CPU0 CPU1
---- ----
lock(&par->dirty_lock);
local_irq_disable();
lock(console_owner);
lock(&par->dirty_lock);
<Interrupt>
lock(console_owner);*** DEADLOCK ***
Use spin_lock_irqsave() for fbtft_mkdirty() and spin_lock_irq() for fbtft_deferred_io(). They only access the dirty line range, so the IRQ-off regions remain short.
--- drivers/staging/fbtft/fbtft-core.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/staging/fbtft/fbtft-core.c +5 -4
@@ -303,6 +303,7 @@ static void fbtft_mkdirty(struct fb_info *info, int y, int height) {struct fbtft_par *par = info->par;struct fb_deferred_io *fbdefio = info->fbdefio; +unsigned long flags;/* special case, needed ? */ if (y ==-1 ) {
@@ -311,12 +312,12 @@ static void fbtft_mkdirty(struct fb_info *info, int y, int height) }/* Mark display lines/area as dirty */ -spin_lock (&par->dirty_lock); +spin_lock_irqsave (&par->dirty_lock, flags);if (y < par->dirty_lines_start) par->dirty_lines_start = y;if (y + height -1 > par->dirty_lines_end) par->dirty_lines_end = y + height -1 ; -spin_unlock (&par->dirty_lock); +spin_unlock_irqrestore (&par->dirty_lock, flags);/* Schedule deferred_io to update display (no-op if already on queue)*/ schedule_delayed_work (&info->deferred_work, fbdefio->delay);
@@ -331,13 +332,13 @@ static void fbtft_deferred_io(struct fb_info *info, struct list_head *pagereflisunsigned int y_low =0 , y_high =0 ;int count =0 ; -spin_lock (&par->dirty_lock); +spin_lock_irq (&par->dirty_lock); dirty_lines_start = par->dirty_lines_start; dirty_lines_end = par->dirty_lines_end;/* set display line markers as clean */ par->dirty_lines_start = par->info->var.yres -1 ; par->dirty_lines_end =0 ; -spin_unlock (&par->dirty_lock); +spin_unlock_irq (&par->dirty_lock);/* Mark display lines as dirty */ list_for_each_entry (pageref, pagereflist, list) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 266/752 ASoC: amd: renoir: fix disable_pdm_interrupts() to clear mask bits
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: wangdicheng <[email protected]>
[ Upstream commit 0c06c4ce0206290c9a934a1e7196aaa86adfe018 ]
disable_pdm_interrupts() uses |= ~PDM_DMA_INTR_MASK which sets all bits except the PDM DMA interrupt bit instead of clearing only the PDM DMA interrupt bit. Use &= ~PDM_DMA_INTR_MASK to clear only the target bit.
--- sound/soc/amd/renoir/acp3x-pdm-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/amd/renoir/acp3x-pdm-dma.c +1 -1
@@ -98,7 +98,7 @@ static void disable_pdm_interrupts(void __iomem *acp_base)u32 ext_int_ctrl; ext_int_ctrl =rn_readl (acp_base +ACP_EXTERNAL_INTR_CNTL ); - ext_int_ctrl |= ~PDM_DMA_INTR_MASK ; + ext_int_ctrl &= ~PDM_DMA_INTR_MASK ;rn_writel (ext_int_ctrl, acp_base +ACP_EXTERNAL_INTR_CNTL ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 267/752 btrfs: detach failed sprout device from transaction update list
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guanghui Yang <[email protected]>
[ Upstream commit c93b3c43df561cd9f592cee20ae058b563f9e5b6 ]
When creating the first metadata chunk for a sprout filesystem, create_chunk() adds the new device to the transaction dev_update_list through device->post_commit_list.
If the subsequent system chunk creation fails, btrfs_init_new_device() aborts the transaction and releases the device while post_commit_list is still linked. This triggers a warning in btrfs_free_device() and leaves the transaction list referencing freed memory.
Detach the device while holding chunk_mutex before releasing it.
--- fs/btrfs/volumes.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/volumes.c +2 -0
@@ -2886,6 +2886,8 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_pathbtrfs_sysfs_remove_device (device);mutex_lock (&fs_info->fs_devices->device_list_mutex);mutex_lock (&fs_info->chunk_mutex); +if (!list_empty (&device->post_commit_list)) +list_del_init (&device->post_commit_list);list_del_rcu (&device->dev_list);list_del (&device->dev_alloc_list); fs_info->fs_devices->num_devices--;
Signature · 1 line
2.53.0