6.6.94-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 150/356 net: phy: mscc: Fix memory leak when using one step timestamping
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Horatiu Vultur <[email protected]>
[ Upstream commit 846992645b25ec4253167e3f931e4597eb84af56 ]
Fix memory leak when running one-step timestamping. When running one-step sync timestamping, the HW is configured to insert the TX time into the frame, so there is no reason to keep the skb anymore. As in this case the HW will never generate an interrupt to say that the frame was timestamped, then the frame will never released.
Fix this by freeing the frame in case of one-step timestamping.
--- drivers/net/phy/mscc/mscc_ptp.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/net/phy/mscc/mscc_ptp.c +11 -5
@@ -1165,18 +1165,24 @@ static void vsc85xx_txtstamp(struct mii_timestamper *mii_ts, container_of(mii_ts, struct vsc8531_private, mii_ts);if (!vsc8531->ptp->configured) -return ; + goto out; -if (vsc8531->ptp->tx_type ==HWTSTAMP_TX_OFF ) { -kfree_skb (skb); -return ; - } +if (vsc8531->ptp->tx_type ==HWTSTAMP_TX_OFF ) + goto out; + +if (vsc8531->ptp->tx_type ==HWTSTAMP_TX_ONESTEP_SYNC ) +if (ptp_msg_is_sync (skb, type)) + goto out;skb_shinfo (skb)->tx_flags |=SKBTX_IN_PROGRESS ;mutex_lock (&vsc8531->ts_lock);__skb_queue_tail (&vsc8531->ptp->tx_queue, skb);mutex_unlock (&vsc8531->ts_lock); +return ; + +out: +kfree_skb (skb); } static bool vsc85xx_rxtstamp(struct mii_timestamper *mii_ts,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 151/356 octeontx2-pf: QOS: Refactor TC_HTB_LEAF_DEL_LAST callback
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hariprasad Kelam <[email protected]>
[ Upstream commit 67af4ec948e8ce3ea53a9cf614d01fddf172e56d ]
This patch addresses below issues,
1. Active traffic on the leaf node must be stopped before its send queue is reassigned to the parent. This patch resolves the issue by marking the node as 'Inner'.
2. During a system reboot, the interface receives TC_HTB_LEAF_DEL and TC_HTB_LEAF_DEL_LAST callbacks to delete its HTB queues. In the case of TC_HTB_LEAF_DEL_LAST, although the same send queue is reassigned to the parent, the current logic still attempts to update the real number of queues, leadning to below warnings
New queues can't be registered after device unregistration.
WARNING: CPU: 0 PID: 6475 at net/core/net-sysfs.c:1714
netdev_queue_update_kobjects+0x1e4/0x200--- drivers/net/ethernet/marvell/octeontx2/nic/qos.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/qos.c +1 -3
@@ -1560,6 +1560,7 @@ static int otx2_qos_leaf_del_last(struct otx2_nic *pfvf, u16 classid, bool forceif (!node->is_static) dwrr_del_node = true; +WRITE_ONCE (node->qid,OTX2_QOS_QID_INNER );/* destroy the leaf node */ otx2_qos_disable_sq (pfvf, qid);otx2_qos_destroy_node (pfvf, node);
@@ -1604,9 +1605,6 @@ static int otx2_qos_leaf_del_last(struct otx2_nic *pfvf, u16 classid, bool force }kfree (new_cfg); -/* update tx_real_queues */ -otx2_qos_update_tx_netdev_queues (pfvf); -return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 152/356 calipso: Dont call calipso functions for AF_INET sk.
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 6e9f2df1c550ead7cecb3e450af1105735020c92 ]
syzkaller reported a null-ptr-deref in txopt_get(). [0]
The offset 0x70 was of struct ipv6_txoptions in struct ipv6_pinfo, so struct ipv6_pinfo was NULL there.
However, this never happens for IPv6 sockets as inet_sk(sk)->pinet6 is always set in inet6_create(), meaning the socket was not IPv6 one.
The root cause is missing validation in netlbl_conn_setattr().
netlbl_conn_setattr() switches branches based on struct sockaddr.sa_family, which is passed from userspace. However, netlbl_conn_setattr() does not check if the address family matches the socket.
The syzkaller must have called connect() for an IPv6 address on an IPv4 socket.
We have a proper validation in tcp_v[46]_connect(), but security_socket_connect() is called in the earlier stage.
Let's copy the validation to netlbl_conn_setattr().
[0]:
Oops: general protection fault, probably for non-canonical address 0xdffffc000000000e: 0000 [#1] PREEMPT SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000070-0x0000000000000077] CPU: 2 UID: 0 PID: 12928 Comm: syz.9.1677 Not tainted 6.12.0 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 RIP: 0010:txopt_get include/net/ipv6.h:390 [inline] RIP: 0010: Code: 02 00 00 49 8b ac 24 f8 02 00 00 e8 84 69 2a fd e8 ff 00 16 fd 48 8d 7d 70 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 53 02 00 00 48 8b 6d 70 48 85 ed 0f 84 ab 01 00 RSP: 0018:ffff88811b8afc48 EFLAGS: 00010212 RAX: dffffc0000000000 RBX: 1ffff11023715f8a RCX: ffffffff841ab00c RDX: 000000000000000e RSI: ffffc90007d9e000 RDI: 0000000000000070 RBP: 0000000000000000 R08: ffffed1023715f9d R09: ffffed1023715f9e R10: ffffed1023715f9d R11: 0000000000000003 R12: ffff888123075f00 R13: ffff88810245bd80 R14: ffff888113646780 R15: ffff888100578a80 FS: 00007f9019bd7640(0000) GS:ffff8882d2d00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f901b927bac CR3: 0000000104788003 CR4: 0000000000770ef0 PKRU: 80000000 Call Trace: <TASK> calipso_sock_setattr+0x56/0x80 net/netlabel/netlabel_calipso.c:557 netlbl_conn_setattr+0x10c/0x280 net/netlabel/netlabel_kapi.c:1177 selinux_netlbl_socket_connect_helper+0xd3/0x1b0 security/selinux/netlabel.c:569 selinux_netlbl_socket_connect_locked security/selinux/netlabel.c:597 [inline] selinux_netlbl_socket_connect+0xb6/0x100 security/selinux/netlabel.c:615 selinux_socket_connect+0x5f/0x80 security/selinux/hooks.c:4931 security_socket_connect+0x50/0xa0 security/security.c:4598 __sys_connect_file+0xa4/0x190 net/socket.c:2067 __sys_connect+0x12c/0x170 net/socket.c:2088 __do_sys_connect net/socket.c:2098 [inline] __se_sys_connect net/socket.c:2095 [inline] __x64_sys_connect+0x73/0xb0 net/socket.c:2095 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xaa/0x1b0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f901b61a12d Code: 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f9019bd6fa8 EFLAGS: 00000246 ORIG_RAX: 000000000000002a RAX: ffffffffffffffda RBX: 00007f901b925fa0 RCX: 00007f901b61a12d RDX: 000000000000001c RSI: 0000200000000140 RDI: 0000000000000003 RBP: 00007f901b701505 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f901b5b62a0 R15: 00007f9019bb7000 </TASK> Modules linked in:
--- net/netlabel/netlabel_kapi.c | 3 +++ 1 file changed, 3 insertions(+)
net/netlabel/netlabel_kapi.c +3 -0
@@ -1140,6 +1140,9 @@ int netlbl_conn_setattr(struct sock *sk,break ;#if IS_ENABLED (CONFIG_IPV6 )case AF_INET6 : +if (sk->sk_family !=AF_INET6 ) +return -EAFNOSUPPORT ; + addr6 = (struct sockaddr_in6 *)addr; entry =netlbl_domhsh_getentry_af6 (secattr->domain, &addr6->sin6_addr);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 153/356 net: openvswitch: Fix the dead loop of MPLS parse
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Faicker Mo <[email protected]>
[ Upstream commit 0bdc924bfb319fb10d1113cbf091fc26fb7b1f99 ]
The unexpected MPLS packet may not end with the bottom label stack. When there are many stacks, The label count value has wrapped around. A dead loop occurs, soft lockup/CPU stuck finally.
stack backtrace: UBSAN: array-index-out-of-bounds in /build/linux-0Pa0xK/linux-5.15.0/net/openvswitch/flow.c:662:26 index -1 is out of range for type '__be32 [3]' CPU: 34 PID: 0 Comm: swapper/34 Kdump: loaded Tainted: G OE 5.15.0-121-generic #131-Ubuntu Hardware name: Dell Inc. PowerEdge C6420/0JP9TF, BIOS 2.12.2 07/14/2021 Call Trace: <IRQ> show_stack+0x52/0x5c dump_stack_lvl+0x4a/0x63 dump_stack+0x10/0x16 ubsan_epilogue+0x9/0x36 __ubsan_handle_out_of_bounds.cold+0x44/0x49 key_extract_l3l4+0x82a/0x840 [openvswitch] ? kfree_skbmem+0x52/0xa0 key_extract+0x9c/0x2b0 [openvswitch] ovs_flow_key_extract+0x124/0x350 [openvswitch] ovs_vport_receive+0x61/0xd0 [openvswitch] ? kernel_init_free_pages.part.0+0x4a/0x70 ? get_page_from_freelist+0x353/0x540 netdev_port_receive+0xc4/0x180 [openvswitch] ? netdev_port_receive+0x180/0x180 [openvswitch] netdev_frame_hook+0x1f/0x40 [openvswitch] __netif_receive_skb_core.constprop.0+0x23a/0xf00 __netif_receive_skb_list_core+0xfa/0x240 netif_receive_skb_list_internal+0x18e/0x2a0 napi_complete_done+0x7a/0x1c0 bnxt_poll+0x155/0x1c0 [bnxt_en] __napi_poll+0x30/0x180 net_rx_action+0x126/0x280 ? bnxt_msix+0x67/0x80 [bnxt_en] handle_softirqs+0xda/0x2d0 irq_exit_rcu+0x96/0xc0 common_interrupt+0x8e/0xa0 </IRQ>
--- net/openvswitch/flow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/openvswitch/flow.c +1 -1
@@ -788,7 +788,7 @@ static int key_extract_l3l4(struct sk_buff *skb, struct sw_flow_key *key)memset (&key->ipv4,0 ,sizeof (key->ipv4)); } }else if (eth_p_mpls (key->eth.type)) { -u8 label_count =1 ; +size_t label_count =1 ;memset (&key->mpls,0 ,sizeof (key->mpls));skb_set_inner_network_header (skb, skb->mac_len);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 154/356 net: phy: mscc: Stop clearing the the UDPv4 checksum for L2 frames
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Horatiu Vultur <[email protected]>
[ Upstream commit 57a92d14659df3e7e7e0052358c8cc68bbbc3b5e ]
We have noticed that when PHY timestamping is enabled, L2 frames seems to be modified by changing two 2 bytes with a value of 0. The place were these 2 bytes seems to be random(or I couldn't find a pattern). In most of the cases the userspace can ignore these frames but if for example those 2 bytes are in the correction field there is nothing to do. This seems to happen when configuring the HW for IPv4 even that the flow is not enabled.
These 2 bytes correspond to the UDPv4 checksum and once we don't enable clearing the checksum when using L2 frames then the frame doesn't seem to be changed anymore.
--- drivers/net/phy/mscc/mscc_ptp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/phy/mscc/mscc_ptp.c +3 -1
@@ -943,7 +943,9 @@ static int vsc85xx_ip1_conf(struct phy_device *phydev, enum ts_blk blk,/* UDP checksum offset in IPv4 packet * according to: https://tools.ietf.org/html/rfc768 */ - val |=IP1_NXT_PROT_UDP_CHKSUM_OFF (26 ) |IP1_NXT_PROT_UDP_CHKSUM_CLEAR ; + val |=IP1_NXT_PROT_UDP_CHKSUM_OFF (26 ); +if (enable) + val |=IP1_NXT_PROT_UDP_CHKSUM_CLEAR ;vsc85xx_ts_write_csr (phydev, blk,MSCC_ANA_IP1_NXT_PROT_UDP_CHKSUM , val);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 155/356 f2fs: use d_inode(dentry) cleanup dentry->d_inode
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhiguo Niu <[email protected]>
[ Upstream commit a6c397a31f58a1d577c2c8d04b624e9baa31951c ]
no logic changes.
--- fs/f2fs/namei.c | 8 ++++---- fs/f2fs/super.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
fs/f2fs/namei.c +4 -4
@@ -411,7 +411,7 @@ static int f2fs_link(struct dentry *old_dentry, struct inode *dir,if (is_inode_flag_set (dir,FI_PROJ_INHERIT ) && (!projid_eq (F2FS_I (dir)->i_projid, -F2FS_I (old_dentry->d_inode)->i_projid))) +F2FS_I (inode)->i_projid)))return -EXDEV ; err =f2fs_dquot_initialize (dir);
@@ -905,7 +905,7 @@ static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir,if (is_inode_flag_set (new_dir,FI_PROJ_INHERIT ) && (!projid_eq (F2FS_I (new_dir)->i_projid, -F2FS_I (old_dentry->d_inode)->i_projid))) +F2FS_I (old_inode)->i_projid)))return -EXDEV ;/*
@@ -1101,10 +1101,10 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,if ((is_inode_flag_set (new_dir,FI_PROJ_INHERIT ) && !projid_eq (F2FS_I (new_dir)->i_projid, -F2FS_I (old_dentry->d_inode)->i_projid)) || +F2FS_I (old_inode)->i_projid)) || (is_inode_flag_set (new_dir,FI_PROJ_INHERIT ) && !projid_eq (F2FS_I (old_dir)->i_projid, -F2FS_I (new_dentry->d_inode)->i_projid))) +F2FS_I (new_inode)->i_projid)))return -EXDEV ; err =f2fs_dquot_initialize (old_dir);
fs/f2fs/super.c +2 -2
@@ -1849,9 +1849,9 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf) buf->f_fsid =u64_to_fsid (id);#ifdef CONFIG_QUOTA -if (is_inode_flag_set (dentry->d_inode,FI_PROJ_INHERIT ) && +if (is_inode_flag_set (d_inode (dentry),FI_PROJ_INHERIT ) &&sb_has_quota_limits_enabled (sb,PRJQUOTA )) { -f2fs_statfs_project (sb,F2FS_I (dentry->d_inode)->i_projid, buf); +f2fs_statfs_project (sb,F2FS_I (d_inode (dentry))->i_projid, buf); }#endif return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 156/356 f2fs: fix to correct check conditions in f2fs_cross_rename
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhiguo Niu <[email protected]>
[ Upstream commit 9883494c45a13dc88d27dde4f988c04823b42a2f ]
Should be "old_dir" here.
--- fs/f2fs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/namei.c +1 -1
@@ -1102,7 +1102,7 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,if ((is_inode_flag_set (new_dir,FI_PROJ_INHERIT ) && !projid_eq (F2FS_I (new_dir)->i_projid,F2FS_I (old_inode)->i_projid)) || - (is_inode_flag_set (new_dir,FI_PROJ_INHERIT ) && + (is_inode_flag_set (old_dir,FI_PROJ_INHERIT ) && !projid_eq (F2FS_I (old_dir)->i_projid,F2FS_I (new_inode)->i_projid)))return -EXDEV ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 157/356 arm64: dts: qcom: sdm845-starqltechn: remove wifi
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dzmitry Sankouski <[email protected]>
[ Upstream commit 2d3dd4b237638853b8a99353401ab8d88a6afb6c ]
Starqltechn has broadcom chip for wifi, so sdm845 wifi part can be disabled.
--- arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts | 8 -------- 1 file changed, 8 deletions(-)
arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +0 -8
@@ -418,14 +418,6 @@ status = "okay"; }; -&wifi { - vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>; - vdd-1.8-xo-supply = <&vreg_l7a_1p8>; - vdd-1.3-rfa-supply = <&vreg_l17a_1p3>; - vdd-3.3-ch0-supply = <&vreg_l25a_3p3>; - status = "okay"; -}; - &tlmm { gpio-reserved-ranges = <0 4>, <27 4>, <81 4>, <85 4>;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 158/356 arm64: dts: qcom: sdm845-starqltechn: fix usb regulator mistake
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dzmitry Sankouski <[email protected]>
[ Upstream commit 242e4126ee007b95765c21a9d74651fdcf221f2b ]
Usb regulator was wrongly pointed to vreg_l1a_0p875. However, on starqltechn it's powered from vreg_l5a_0p8.
--- arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +1 -2
@@ -135,8 +135,6 @@ vdda_sp_sensor: vdda_ufs1_core: vdda_ufs2_core: - vdda_usb1_ss_core: - vdda_usb2_ss_core: vreg_l1a_0p875: ldo1 { regulator-min-microvolt = <880000>; regulator-max-microvolt = <880000>;
@@ -157,6 +155,7 @@ regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; }; + vdda_usb1_ss_core: vdd_wcss_cx: vdd_wcss_mx: vdda_wcss_pll:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 159/356 arm64: dts: qcom: sdm845-starqltechn: refactor node order
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dzmitry Sankouski <[email protected]>
[ Upstream commit cba1dd3d851ebc1b6c5ae4000208a9753320694b ]
--- arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +1 -1
@@ -382,8 +382,8 @@ }; &sdhc_2 { - pinctrl-names = "default"; pinctrl-0 = <&sdc2_clk_state &sdc2_cmd_state &sdc2_data_state &sd_card_det_n_state>; + pinctrl-names = "default"; cd-gpios = <&tlmm 126 GPIO_ACTIVE_LOW>; vmmc-supply = <&vreg_l21a_2p95>; vqmmc-supply = <&vddpx_2>;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 160/356 arm64: dts: qcom: sdm845-starqltechn: remove excess reserved gpios
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dzmitry Sankouski <[email protected]>
[ Upstream commit fb5fce873b952f8b1c5f7edcabcc8611ef45ea7a ]
Starqltechn has 2 reserved gpio ranges <27 4>, <85 4>. <27 4> is spi for eSE(embedded Secure Element). <85 4> is spi for fingerprint.
Remove excess reserved gpio regions.
--- arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +2 -1
@@ -418,7 +418,8 @@ }; &tlmm { - gpio-reserved-ranges = <0 4>, <27 4>, <81 4>, <85 4>; + gpio-reserved-ranges = <27 4>, /* SPI (eSE - embedded Secure Element) */ + <85 4>; /* SPI (fingerprint reader) */ sdc2_clk_state: sdc2-clk-state { pins = "sdc2_clk";
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 161/356 arm64: dts: qcom: sm8350: Reenable crypto & cryptobam
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Weiss <[email protected]>
[ Upstream commit 75eefd474469abf95aa9ef6da8161d69f86b98b4 ]
When num-channels and qcom,num-ees is not provided in devicetree, the driver will try to read these values from the registers during probe but this fails if the interconnect is not on and then crashes the system.
So we can provide these properties in devicetree (queried after patching BAM driver to enable the necessary interconnect) so we can probe cryptobam without reading registers and then also use the QCE as expected.
--- arch/arm64/boot/dts/qcom/sm8350.dtsi | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sm8350.dtsi +2 -4
@@ -1754,11 +1754,11 @@ interrupts = <GIC_SPI 272 IRQ_TYPE_LEVEL_HIGH>; #dma-cells = <1>; qcom,ee = <0>; + qcom,num-ees = <4>; + num-channels = <16>; qcom,controlled-remotely; iommus = <&apps_smmu 0x594 0x0011>, <&apps_smmu 0x596 0x0011>; - /* FIXME: Probing BAM DMA causes some abort and system hang */ - status = "fail"; }; crypto: crypto@1dfa000 {
@@ -1770,8 +1770,6 @@ <&apps_smmu 0x596 0x0011>; interconnects = <&aggre2_noc MASTER_CRYPTO 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "memory"; - /* FIXME: dependency BAM DMA is disabled */ - status = "disabled"; }; ipa: ipa@1e40000 {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 162/356 arm64: dts: qcom: sm8250: Fix CPU7 opp table
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xilin Wu <[email protected]>
[ Upstream commit 28f997b89967afdc0855d8aa7538b251fb44f654 ]
There is a typo in cpu7_opp9. Fix it to get rid of the following errors.
[ 0.198043] cpu cpu7: Voltage update failed freq=1747200 [ 0.198052] cpu cpu7: failed to update OPP for freq=1747200
--- arch/arm64/boot/dts/qcom/sm8250.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8250.dtsi +1 -1
@@ -601,7 +601,7 @@ }; cpu7_opp9: opp-1747200000 { - opp-hz = /bits/ 64 <1708800000>; + opp-hz = /bits/ 64 <1747200000>; opp-peak-kBps = <5412000 42393600>; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 163/356 arm64: dts: qcom: sc8280xp-x13s: Drop duplicate DMIC supplies
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gerhold <[email protected]>
[ Upstream commit a2e617f4e6981aa514a569e927f90b0d39bb31b2 ]
The WCD938x codec provides two controls for each of the MIC_BIASn outputs:
- "MIC BIASn" enables an internal regulator to generate the output with a configurable voltage (qcom,micbiasN-microvolt).
- "VA MIC BIASn" enables "pull-up mode" that bypasses the internal regulator and directly outputs fixed 1.8V from the VDD_PX pin. This is intended for low-power VA (voice activation) use cases.
The audio-routing setup for the ThinkPad X13s currently specifies both as power supplies for the DMICs, but only one of them can be active at the same time. In practice, only the internal regulator is used with the current setup because the driver prefers it over pull-up mode.
Make this more clear by dropping the redundant routes to the pull-up "VA MIC BIASn" supply. There is no functional difference except that we skip briefly switching to pull-up mode when shutting down the microphone.
--- arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 3 --- 1 file changed, 3 deletions(-)
arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts +0 -3
@@ -985,9 +985,6 @@ "VA DMIC0", "MIC BIAS1", "VA DMIC1", "MIC BIAS1", "VA DMIC2", "MIC BIAS3", - "VA DMIC0", "VA MIC BIAS1", - "VA DMIC1", "VA MIC BIAS1", - "VA DMIC2", "VA MIC BIAS3", "TX SWR_ADC1", "ADC2_OUTPUT"; wcd-playback-dai-link {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 164/356 ARM: dts: at91: usb_a9263: fix GPIO for Dataflash chip select
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit 67ba341e57ab158423818ed33bfa1c40eb0e5e7e ]
Dataflash did not work on my board. After checking schematics and using the proper GPIO, it works now. Also, make it active low to avoid:
flash@0 enforce active low on GPIO handle
--- arch/arm/boot/dts/microchip/usb_a9263.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/microchip/usb_a9263.dts +1 -1
@@ -58,7 +58,7 @@ }; spi0: spi@fffa4000 { - cs-gpios = <&pioB 15 GPIO_ACTIVE_HIGH>; + cs-gpios = <&pioA 5 GPIO_ACTIVE_LOW>; status = "okay"; flash@0 { compatible = "atmel,at45", "atmel,dataflash";
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 165/356 ARM: dts: at91: at91sam9263: fix NAND chip selects
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit c72ede1c24be689733bcd2233a3a56f2478429c8 ]
NAND did not work on my USB-A9263. I discovered that the offending commit converted the PIO bank for chip selects wrongly, so all A9263 boards need to be fixed.
--- arch/arm/boot/dts/microchip/at91sam9263ek.dts | 2 +- arch/arm/boot/dts/microchip/tny_a9263.dts | 2 +- arch/arm/boot/dts/microchip/usb_a9263.dts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/microchip/at91sam9263ek.dts +1 -1
@@ -152,7 +152,7 @@ nand@3 { reg = <0x3 0x0 0x800000>; rb-gpios = <&pioA 22 GPIO_ACTIVE_HIGH>; - cs-gpios = <&pioA 15 GPIO_ACTIVE_HIGH>; + cs-gpios = <&pioD 15 GPIO_ACTIVE_HIGH>; nand-bus-width = <8>; nand-ecc-mode = "soft"; nand-on-flash-bbt;
arch/arm/boot/dts/microchip/tny_a9263.dts +1 -1
@@ -64,7 +64,7 @@ nand@3 { reg = <0x3 0x0 0x800000>; rb-gpios = <&pioA 22 GPIO_ACTIVE_HIGH>; - cs-gpios = <&pioA 15 GPIO_ACTIVE_HIGH>; + cs-gpios = <&pioD 15 GPIO_ACTIVE_HIGH>; nand-bus-width = <8>; nand-ecc-mode = "soft"; nand-on-flash-bbt;
arch/arm/boot/dts/microchip/usb_a9263.dts +1 -1
@@ -84,7 +84,7 @@ nand@3 { reg = <0x3 0x0 0x800000>; rb-gpios = <&pioA 22 GPIO_ACTIVE_HIGH>; - cs-gpios = <&pioA 15 GPIO_ACTIVE_HIGH>; + cs-gpios = <&pioD 15 GPIO_ACTIVE_HIGH>; nand-bus-width = <8>; nand-ecc-mode = "soft"; nand-on-flash-bbt;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 166/356 arm64: dts: mediatek: mt8195: Reparent vdec1/2 and venc1 power domains
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 394f29033324e2317bfd6a7ed99b9a60832b36a2 ]
By hardware, the first and second core of the video decoder IP need the VDEC_SOC to be powered up in order to be able to be accessed (both internally, by firmware, and externally, by the kernel).
Similarly, for the video encoder IP, the second core needs the first core to be powered up in order to be accessible.
Fix that by reparenting the VDEC1/2 power domains to be children of VDEC0 (VDEC_SOC), and the VENC1 to be a child of VENC0.
--- arch/arm64/boot/dts/mediatek/mt8195.dtsi | 50 +++++++++++++----------- 1 file changed, 27 insertions(+), 23 deletions(-)
arch/arm64/boot/dts/mediatek/mt8195.dtsi +27 -23
@@ -617,22 +617,6 @@ #size-cells = <0>; #power-domain-cells = <1>; - power-domain@MT8195_POWER_DOMAIN_VDEC1 { - reg = <MT8195_POWER_DOMAIN_VDEC1>; - clocks = <&vdecsys CLK_VDEC_LARB1>; - clock-names = "vdec1-0"; - mediatek,infracfg = <&infracfg_ao>; - #power-domain-cells = <0>; - }; - - power-domain@MT8195_POWER_DOMAIN_VENC_CORE1 { - reg = <MT8195_POWER_DOMAIN_VENC_CORE1>; - clocks = <&vencsys_core1 CLK_VENC_CORE1_LARB>; - clock-names = "venc1-larb"; - mediatek,infracfg = <&infracfg_ao>; - #power-domain-cells = <0>; - }; - power-domain@MT8195_POWER_DOMAIN_VDOSYS0 { reg = <MT8195_POWER_DOMAIN_VDOSYS0>; clocks = <&topckgen CLK_TOP_CFG_VDO0>,
@@ -678,15 +662,25 @@ clocks = <&vdecsys_soc CLK_VDEC_SOC_LARB1>; clock-names = "vdec0-0"; mediatek,infracfg = <&infracfg_ao>; + #address-cells = <1>; + #size-cells = <0>; #power-domain-cells = <0>; - }; - power-domain@MT8195_POWER_DOMAIN_VDEC2 { - reg = <MT8195_POWER_DOMAIN_VDEC2>; - clocks = <&vdecsys_core1 CLK_VDEC_CORE1_LARB1>; - clock-names = "vdec2-0"; - mediatek,infracfg = <&infracfg_ao>; - #power-domain-cells = <0>; + power-domain@MT8195_POWER_DOMAIN_VDEC1 { + reg = <MT8195_POWER_DOMAIN_VDEC1>; + clocks = <&vdecsys CLK_VDEC_LARB1>; + clock-names = "vdec1-0"; + mediatek,infracfg = <&infracfg_ao>; + #power-domain-cells = <0>; + }; + + power-domain@MT8195_POWER_DOMAIN_VDEC2 { + reg = <MT8195_POWER_DOMAIN_VDEC2>; + clocks = <&vdecsys_core1 CLK_VDEC_CORE1_LARB1>; + clock-names = "vdec2-0"; + mediatek,infracfg = <&infracfg_ao>; + #power-domain-cells = <0>; + }; }; power-domain@MT8195_POWER_DOMAIN_VENC {
@@ -694,7 +688,17 @@ clocks = <&vencsys CLK_VENC_LARB>; clock-names = "venc0-larb"; mediatek,infracfg = <&infracfg_ao>; + #address-cells = <1>; + #size-cells = <0>; #power-domain-cells = <0>; + + power-domain@MT8195_POWER_DOMAIN_VENC_CORE1 { + reg = <MT8195_POWER_DOMAIN_VENC_CORE1>; + clocks = <&vencsys_core1 CLK_VENC_CORE1_LARB>; + clock-names = "venc1-larb"; + mediatek,infracfg = <&infracfg_ao>; + #power-domain-cells = <0>; + }; }; power-domain@MT8195_POWER_DOMAIN_VDOSYS1 {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 167/356 arm64: dts: qcom: sdm660-xiaomi-lavender: Add missing SD card detect GPIO
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Minnekhanov <[email protected]>
[ Upstream commit 2eca6af66709de0d1ba14cdf8b6d200a1337a3a2 ]
During initial porting these cd-gpios were missed. Having card detect is beneficial because driver does not need to do polling every second and it can just use IRQ. SD card detection in U-Boot is also fixed by this.
--- arch/arm64/boot/dts/qcom/sdm660-xiaomi-lavender.dts | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/sdm660-xiaomi-lavender.dts +2 -0
@@ -404,6 +404,8 @@ &sdhc_2 { status = "okay"; + cd-gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>; + vmmc-supply = <&vreg_l5b_2p95>; vqmmc-supply = <&vreg_l2b_2p95>; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 168/356 arm64: dts: imx8mm-beacon: Fix RTC capacitive load
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adam Ford <[email protected]>
[ Upstream commit 2e98d456666d63f897ba153210bcef9d78ba0f3a ]
Although not noticeable when used every day, the RTC appears to drift when left to sit over time. This is due to the capacitive load not being properly set. Fix RTC drift by correcting the capacitive load setting from 7000 to 12500, which matches the actual hardware configuration.
--- arch/arm64/boot/dts/freescale/imx8mm-beacon-som.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/freescale/imx8mm-beacon-som.dtsi +1 -0
@@ -231,6 +231,7 @@ rtc: rtc@51 { compatible = "nxp,pcf85263"; reg = <0x51>; + quartz-load-femtofarads = <12500>; }; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 169/356 arm64: dts: imx8mn-beacon: Fix RTC capacitive load
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adam Ford <[email protected]>
[ Upstream commit c3f03bec30efd5082b55876846d57b5d17dae7b9 ]
Although not noticeable when used every day, the RTC appears to drift when left to sit over time. This is due to the capacitive load not being properly set. Fix RTC drift by correcting the capacitive load setting from 7000 to 12500, which matches the actual hardware configuration.
--- arch/arm64/boot/dts/freescale/imx8mn-beacon-som.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/freescale/imx8mn-beacon-som.dtsi +1 -0
@@ -240,6 +240,7 @@ rtc: rtc@51 { compatible = "nxp,pcf85263"; reg = <0x51>; + quartz-load-femtofarads = <12500>; }; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 170/356 arm64: dts: imx8mp-beacon: Fix RTC capacitive load
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adam Ford <[email protected]>
[ Upstream commit 6821ee17537938e919e8b86a541aae451f73165b ]
Although not noticeable when used every day, the RTC appears to drift when left to sit over time. This is due to the capacitive load not being properly set. Fix RTC drift by correcting the capacitive load setting from 7000 to 12500, which matches the actual hardware configuration.
--- arch/arm64/boot/dts/freescale/imx8mp-beacon-som.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/freescale/imx8mp-beacon-som.dtsi +1 -0
@@ -192,6 +192,7 @@ rtc: rtc@51 { compatible = "nxp,pcf85263"; reg = <0x51>; + quartz-load-femtofarads = <12500>; }; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 171/356 arm64: dts: imx8mm-beacon: Set SAI5 MCLK direction to output for HDMI audio
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adam Ford <[email protected]>
[ Upstream commit 8c716f80dfe8cd6ed9a2696847cea1affeeff6ff ]
The HDMI bridge chip fails to generate an audio source due to the SAI5 master clock (MCLK) direction not being set to output. This prevents proper clocking of the HDMI audio interface.
Add the fsl,sai-mclk-direction-output property to the SAI5 node to ensure the MCLK is driven by the SoC, resolving the HDMI sound issue.
--- arch/arm64/boot/dts/freescale/imx8mm-beacon-kit.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/freescale/imx8mm-beacon-kit.dts +1 -0
@@ -124,6 +124,7 @@ assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>; assigned-clock-rates = <24576000>; #sound-dai-cells = <0>; + fsl,sai-mclk-direction-output; status = "okay"; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 172/356 arm64: dts: imx8mn-beacon: Set SAI5 MCLK direction to output for HDMI audio
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adam Ford <[email protected]>
[ Upstream commit a747c4dd2a60c4d0179b372032a4b98548135096 ]
The HDMI bridge chip fails to generate an audio source due to the SAI5 master clock (MCLK) direction not being set to output. This prevents proper clocking of the HDMI audio interface.
Add the fsl,sai-mclk-direction-output property to the SAI5 node to ensure the MCLK is driven by the SoC, resolving the HDMI sound issue.
--- arch/arm64/boot/dts/freescale/imx8mn-beacon-kit.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/freescale/imx8mn-beacon-kit.dts +1 -0
@@ -126,6 +126,7 @@ assigned-clock-parents = <&clk IMX8MN_AUDIO_PLL1_OUT>; assigned-clock-rates = <24576000>; #sound-dai-cells = <0>; + fsl,sai-mclk-direction-output; status = "okay"; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 173/356 arm64: dts: mediatek: mt6357: Drop regulator-fixed compatibles
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit d77e89b7b03fb945b4353f2dcc4a70b34baa7bcb ]
Some of the regulators in the MT6357 PMIC dtsi have compatible set to regulator-fixed, even though they don't serve any purpose: all those regulators are handled as a whole by the mt6357-regulator driver. In fact this is the only dtsi in this family of chips where this is the
case: mt6359 and mt6358 don't have any such compatibles.
A side-effect caused by this is that the DT kselftest, which is supposed to identify nodes with compatibles that can be probed, but haven't, shows these nodes as failures.
Remove the useless compatibles to move the dtsi in line with the others in its family and fix the DT kselftest failures.
--- arch/arm64/boot/dts/mediatek/mt6357.dtsi | 10 ---------- 1 file changed, 10 deletions(-)
arch/arm64/boot/dts/mediatek/mt6357.dtsi +0 -10
@@ -60,7 +60,6 @@ }; mt6357_vfe28_reg: ldo-vfe28 { - compatible = "regulator-fixed"; regulator-name = "vfe28"; regulator-min-microvolt = <2800000>; regulator-max-microvolt = <2800000>;
@@ -75,7 +74,6 @@ }; mt6357_vrf18_reg: ldo-vrf18 { - compatible = "regulator-fixed"; regulator-name = "vrf18"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>;
@@ -83,7 +81,6 @@ }; mt6357_vrf12_reg: ldo-vrf12 { - compatible = "regulator-fixed"; regulator-name = "vrf12"; regulator-min-microvolt = <1200000>; regulator-max-microvolt = <1200000>;
@@ -112,7 +109,6 @@ }; mt6357_vcn28_reg: ldo-vcn28 { - compatible = "regulator-fixed"; regulator-name = "vcn28"; regulator-min-microvolt = <2800000>; regulator-max-microvolt = <2800000>;
@@ -120,7 +116,6 @@ }; mt6357_vcn18_reg: ldo-vcn18 { - compatible = "regulator-fixed"; regulator-name = "vcn18"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>;
@@ -142,7 +137,6 @@ }; mt6357_vcamio_reg: ldo-vcamio18 { - compatible = "regulator-fixed"; regulator-name = "vcamio"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>;
@@ -175,7 +169,6 @@ }; mt6357_vaux18_reg: ldo-vaux18 { - compatible = "regulator-fixed"; regulator-name = "vaux18"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>;
@@ -183,7 +176,6 @@ }; mt6357_vaud28_reg: ldo-vaud28 { - compatible = "regulator-fixed"; regulator-name = "vaud28"; regulator-min-microvolt = <2800000>; regulator-max-microvolt = <2800000>;
@@ -191,7 +183,6 @@ }; mt6357_vio28_reg: ldo-vio28 { - compatible = "regulator-fixed"; regulator-name = "vio28"; regulator-min-microvolt = <2800000>; regulator-max-microvolt = <2800000>;
@@ -199,7 +190,6 @@ }; mt6357_vio18_reg: ldo-vio18 { - compatible = "regulator-fixed"; regulator-name = "vio18"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 174/356 arm64: dts: mt6359: Add missing compatible property to regulators node
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julien Massot <[email protected]>
[ Upstream commit 1fe38d2a19950fa6dbc384ee8967c057aef9faf4 ]
The 'compatible' property is required by the 'mfd/mediatek,mt6397.yaml' binding. Add it to fix the following dtb-check error:
mediatek/mt8395-radxa-nio-12l.dtb: pmic: regulators:
'compatible' is a required property
--- arch/arm64/boot/dts/mediatek/mt6359.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/mediatek/mt6359.dtsi +2 -0
@@ -18,6 +18,8 @@ }; regulators { + compatible = "mediatek,mt6359-regulator"; + mt6359_vs1_buck_reg: buck_vs1 { regulator-name = "vs1"; regulator-min-microvolt = <800000>;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 175/356 arm64: dts: qcom: sdm660-lavender: Add missing USB phy supply
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Minnekhanov <[email protected]>
[ Upstream commit dbf62a117a1b7f605a98dd1fd1fd6c85ec324ea0 ]
Fixes the following dtbs check error:
phy@c012000: 'vdda-pll-supply' is a required property
--- arch/arm64/boot/dts/qcom/sdm660-xiaomi-lavender.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/sdm660-xiaomi-lavender.dts +1 -0
@@ -107,6 +107,7 @@ status = "okay"; vdd-supply = <&vreg_l1b_0p925>; + vdda-pll-supply = <&vreg_l10a_1p8>; vdda-phy-dpdm-supply = <&vreg_l7b_3p125>; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 176/356 arm64: dts: qcom: sda660-ifc6560: Fix dt-validate warning
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Minnekhanov <[email protected]>
[ Upstream commit f5110806b41eaa0eb0ab1bf2787876a580c6246c ]
If you remove clocks property, you should remove clock-names, too. Fixes warning with dtbs check:
'clocks' is a dependency of 'clock-names'
--- arch/arm64/boot/dts/qcom/sda660-inforce-ifc6560.dts | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/sda660-inforce-ifc6560.dts +2 -0
@@ -155,6 +155,7 @@ * BAM DMA interconnects support is in place. */ /delete-property/ clocks; + /delete-property/ clock-names; }; &blsp1_uart2 {
@@ -167,6 +168,7 @@ * BAM DMA interconnects support is in place. */ /delete-property/ clocks; + /delete-property/ clock-names; }; &blsp2_uart1 {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 177/356 arm64: dts: rockchip: Update eMMC for NanoPi R5 series
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Robinson <[email protected]>
[ Upstream commit 8eca9e979a1efbcc3d090f6eb3f4da621e7c87e0 ]
Add the 3.3v and 1.8v regulators that are connected to the eMMC on the R5 series devices, as well as adding the eMMC data strobe, and enable eMMC HS200 mode as the Foresee FEMDNN0xxG-A3A55 modules support it.
--- arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5s.dtsi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5s.dtsi +4 -1
@@ -486,9 +486,12 @@ &sdhci { bus-width = <8>; max-frequency = <200000000>; + mmc-hs200-1_8v; non-removable; pinctrl-names = "default"; - pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd>; + pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&vcc_1v8>; status = "okay"; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 178/356 arm64: tegra: Drop remaining serial clock-names and reset-names
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Kling <[email protected]>
[ Upstream commit 4cd763297c2203c6ba587d7d4a9105f96597b998 ]
The referenced commit only removed some of the names, missing all that weren't in use at the time. The commit removes the rest.
--- arch/arm64/boot/dts/nvidia/tegra186.dtsi | 12 ------------ arch/arm64/boot/dts/nvidia/tegra194.dtsi | 12 ------------ 2 files changed, 24 deletions(-)
arch/arm64/boot/dts/nvidia/tegra186.dtsi +0 -12
@@ -621,9 +621,7 @@ reg-shift = <2>; interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>; clocks = <&bpmp TEGRA186_CLK_UARTB>; - clock-names = "serial"; resets = <&bpmp TEGRA186_RESET_UARTB>; - reset-names = "serial"; status = "disabled"; };
@@ -633,9 +631,7 @@ reg-shift = <2>; interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>; clocks = <&bpmp TEGRA186_CLK_UARTD>; - clock-names = "serial"; resets = <&bpmp TEGRA186_RESET_UARTD>; - reset-names = "serial"; status = "disabled"; };
@@ -645,9 +641,7 @@ reg-shift = <2>; interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>; clocks = <&bpmp TEGRA186_CLK_UARTE>; - clock-names = "serial"; resets = <&bpmp TEGRA186_RESET_UARTE>; - reset-names = "serial"; status = "disabled"; };
@@ -657,9 +651,7 @@ reg-shift = <2>; interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>; clocks = <&bpmp TEGRA186_CLK_UARTF>; - clock-names = "serial"; resets = <&bpmp TEGRA186_RESET_UARTF>; - reset-names = "serial"; status = "disabled"; };
@@ -1236,9 +1228,7 @@ reg-shift = <2>; interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>; clocks = <&bpmp TEGRA186_CLK_UARTC>; - clock-names = "serial"; resets = <&bpmp TEGRA186_RESET_UARTC>; - reset-names = "serial"; status = "disabled"; };
@@ -1248,9 +1238,7 @@ reg-shift = <2>; interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>; clocks = <&bpmp TEGRA186_CLK_UARTG>; - clock-names = "serial"; resets = <&bpmp TEGRA186_RESET_UARTG>; - reset-names = "serial"; status = "disabled"; };
arch/arm64/boot/dts/nvidia/tegra194.dtsi +0 -12
@@ -766,9 +766,7 @@ reg-shift = <2>; interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>; clocks = <&bpmp TEGRA194_CLK_UARTD>; - clock-names = "serial"; resets = <&bpmp TEGRA194_RESET_UARTD>; - reset-names = "serial"; status = "disabled"; };
@@ -778,9 +776,7 @@ reg-shift = <2>; interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>; clocks = <&bpmp TEGRA194_CLK_UARTE>; - clock-names = "serial"; resets = <&bpmp TEGRA194_RESET_UARTE>; - reset-names = "serial"; status = "disabled"; };
@@ -790,9 +786,7 @@ reg-shift = <2>; interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>; clocks = <&bpmp TEGRA194_CLK_UARTF>; - clock-names = "serial"; resets = <&bpmp TEGRA194_RESET_UARTF>; - reset-names = "serial"; status = "disabled"; };
@@ -817,9 +811,7 @@ reg-shift = <2>; interrupts = <GIC_SPI 207 IRQ_TYPE_LEVEL_HIGH>; clocks = <&bpmp TEGRA194_CLK_UARTH>; - clock-names = "serial"; resets = <&bpmp TEGRA194_RESET_UARTH>; - reset-names = "serial"; status = "disabled"; };
@@ -1616,9 +1608,7 @@ reg-shift = <2>; interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>; clocks = <&bpmp TEGRA194_CLK_UARTC>; - clock-names = "serial"; resets = <&bpmp TEGRA194_RESET_UARTC>; - reset-names = "serial"; status = "disabled"; };
@@ -1628,9 +1618,7 @@ reg-shift = <2>; interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>; clocks = <&bpmp TEGRA194_CLK_UARTG>; - clock-names = "serial"; resets = <&bpmp TEGRA194_RESET_UARTG>; - reset-names = "serial"; status = "disabled"; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 179/356 arm64: dts: ti: k3-j721e-common-proc-board: Enable OSPI1 on J721E
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prasanth Babu Mantena <[email protected]>
[ Upstream commit 6b8deb2ff0d31848c43a73f6044e69ba9276b3ec ]
J721E SoM has MT25QU512AB Serial NOR flash connected to OSPI1 controller. Enable ospi1 node in device tree.
--- arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts +1 -0
@@ -557,6 +557,7 @@ &ospi1 { pinctrl-names = "default"; pinctrl-0 = <&mcu_fss0_ospi1_pins_default>; + status = "okay"; flash@0 { compatible = "jedec,spi-nor";
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 180/356 Squashfs: check return result of sb_min_blocksize
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phillip Lougher <[email protected]>
[ Upstream commit 734aa85390ea693bb7eaf2240623d41b03705c84 ]
Syzkaller reports an "UBSAN: shift-out-of-bounds in squashfs_bio_read" bug.
Syzkaller forks multiple processes which after mounting the Squashfs filesystem, issues an ioctl("/dev/loop0", LOOP_SET_BLOCK_SIZE, 0x8000). Now if this ioctl occurs at the same time another process is in the process of mounting a Squashfs filesystem on /dev/loop0, the failure occurs. When this happens the following code in squashfs_fill_super() fails.
----msblk->devblksize = sb_min_blocksize(sb, SQUASHFS_DEVBLK_SIZE); msblk->devblksize_log2 = ffz(~msblk->devblksize);
----
sb_min_blocksize() returns 0, which means msblk->devblksize is set to 0.
As a result, ffz(~msblk->devblksize) returns 64, and msblk->devblksize_log2 is set to 64.
This subsequently causes the
UBSAN: shift-out-of-bounds in fs/squashfs/block.c:195:36
shift exponent 64 is too large for 64-bit type 'u64' (aka 'unsigned long long')
This commit adds a check for a 0 return by sb_min_blocksize().
--- fs/squashfs/super.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/squashfs/super.c +5 -0
@@ -202,6 +202,11 @@ static int squashfs_fill_super(struct super_block *sb, struct fs_context *fc) msblk->panic_on_errors = (opts->errors == Opt_errors_panic); msblk->devblksize =sb_min_blocksize (sb,SQUASHFS_DEVBLK_SIZE ); +if (!msblk->devblksize) { +errorf (fc,"squashfs: unable to set blocksize\n" ); +return -EINVAL ; + } + msblk->devblksize_log2 =ffz (~msblk->devblksize);mutex_init (&msblk->meta_index_mutex);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 181/356 ocfs2: fix possible memory leak in ocfs2_finish_quota_recovery
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Murad Masimov <[email protected]>
[ Upstream commit cdc3ed3035d0fe934aa1d9b78ce256752fd3bb7d ]
If ocfs2_finish_quota_recovery() exits due to an error before passing all rc_list elements to ocfs2_recover_local_quota_file() then it can lead to a memory leak as rc_list may still contain elements that have to be freed.
Release all memory allocated by ocfs2_add_recovery_chunk() using ocfs2_free_quota_recovery() instead of kfree().
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- fs/ocfs2/quota_local.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/quota_local.c +1 -1
@@ -671,7 +671,7 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb,break ; } out: -kfree (rec); +ocfs2_free_quota_recovery (rec);return status; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 182/356 nilfs2: add pointer check for nilfs_direct_propagate()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit f43f02429295486059605997bc43803527d69791 ]
Patch series "nilfs2: improve sanity checks in dirty state propagation".
This fixes one missed check for block mapping anomalies and one improper return of an error code during a preparation step for log writing, thereby improving checking for filesystem corruption on writeback.
This patch (of 2):
In nilfs_direct_propagate(), the printer get from nilfs_direct_get_ptr() need to be checked to ensure it is not an invalid pointer.
If the pointer value obtained by nilfs_direct_get_ptr() is NILFS_BMAP_INVALID_PTR, means that the metadata (in this case, i_bmap in the nilfs_inode_info struct) that should point to the data block at the buffer head of the argument is corrupted and the data block is orphaned, meaning that the file system has lost consistency.
Add a value check and return -EINVAL when it is an invalid pointer.
--- fs/nilfs2/direct.c | 3 +++ 1 file changed, 3 insertions(+)
fs/nilfs2/direct.c +3 -0
@@ -273,6 +273,9 @@ static int nilfs_direct_propagate(struct nilfs_bmap *bmap, dat =nilfs_bmap_get_dat (bmap); key =nilfs_bmap_data_get_key (bmap, bh); ptr =nilfs_direct_get_ptr (bmap, key); +if (ptr ==NILFS_BMAP_INVALID_PTR ) +return -EINVAL ; +if (!buffer_nilfs_volatile (bh)) { oldreq.pr_entry_nr = ptr; newreq.pr_entry_nr = ptr;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 183/356 nilfs2: do not propagate ENOENT error from nilfs_btree_propagate()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
[ Upstream commit 8e39fbb1edbb4ec9d7c1124f403877fc167fcecd ]
In preparation for writing logs, in nilfs_btree_propagate(), which makes parent and ancestor node blocks dirty starting from a modified data block or b-tree node block, if the starting block does not belong to the b-tree, i.e. is isolated, nilfs_btree_do_lookup() called within the function fails with -ENOENT.
In this case, even though -ENOENT is an internal code, it is propagated to the log writer via nilfs_bmap_propagate() and may be erroneously returned to system calls such as fsync().
Fix this issue by changing the error code to -EINVAL in this case, and having the bmap layer detect metadata corruption and convert the error code appropriately.
--- fs/nilfs2/btree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nilfs2/btree.c +3 -1
@@ -2094,11 +2094,13 @@ static int nilfs_btree_propagate(struct nilfs_bmap *btree, ret =nilfs_btree_do_lookup (btree, path, key,NULL , level +1 ,0 );if (ret <0 ) { -if (unlikely (ret == -ENOENT )) +if (unlikely (ret == -ENOENT )) {nilfs_crit (btree->b_inode->i_sb,"writing node/leaf block does not appear in b-tree (ino=%lu) at key=%llu, level=%d" , btree->b_inode->i_ino, (unsigned long long )key, level); + ret = -EINVAL ; + } goto out; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 184/356 bus: fsl-mc: fix double-free on mc_dev
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ioana Ciornei <[email protected]>
[ Upstream commit d694bf8a9acdbd061596f3e7549bc8cb70750a60 ]
The blamed commit tried to simplify how the deallocations are done but, in the process, introduced a double-free on the mc_dev variable.
In case the MC device is a DPRC, a new mc_bus is allocated and the mc_dev variable is just a reference to one of its fields. In this circumstance, on the error path only the mc_bus should be freed.
This commit introduces back the following checkpatch warning which is a false-positive.
WARNING: kfree(NULL) is safe and this check is probably not required
+ if (mc_bus)
+ kfree(mc_bus);
--- drivers/bus/fsl-mc/fsl-mc-bus.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/bus/fsl-mc/fsl-mc-bus.c +4 -2
@@ -905,8 +905,10 @@ int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc, error_cleanup_dev:kfree (mc_dev->regions); -kfree (mc_bus); -kfree (mc_dev); +if (mc_bus) +kfree (mc_bus); +else +kfree (mc_dev);return error; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 185/356 dt-bindings: vendor-prefixes: Add Liontron name
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andre Przywara <[email protected]>
[ Upstream commit 9baa27a2e9fc746143ab686b6dbe2d515284a4c5 ]
Liontron is a company based in Shenzen, China, making industrial development boards and embedded computers, mostly using Rockchip and Allwinner SoCs.
Add their name to the list of vendors.
--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -773,6 +773,8 @@ patternProperties: description: Linux-specific binding "^linx,.*": description: Linx Technologies + "^liontron,.*": + description: Shenzhen Liontron Technology Co., Ltd "^liteon,.*": description: LITE-ON Technology Corp. "^litex,.*":
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 186/356 ARM: dts: qcom: apq8064: add missing clocks to the timer node
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 4b0eb149df58b6750cd8113e5ee5b3ac7cc51743 ]
In order to fix DT schema warning and describe hardware properly, add missing sleep clock to the timer node.
--- arch/arm/boot/dts/qcom/qcom-apq8064.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/dts/qcom/qcom-apq8064.dtsi +2 -0
@@ -343,6 +343,8 @@ <1 3 0x301>; reg = <0x0200a000 0x100>; clock-frequency = <27000000>; + clocks = <&sleep_clk>; + clock-names = "sleep"; cpu-offset = <0x80000>; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 187/356 ARM: dts: qcom: apq8064 merge hw splinlock into corresponding syscon device
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 325c6a441ae1f8fcb1db9bb945b8bdbd3142141e ]
Follow up the expected way of describing the SFPB hwspinlock and merge hwspinlock node into corresponding syscon node, fixing several dt-schema warnings.
--- arch/arm/boot/dts/qcom/qcom-apq8064.dtsi | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
arch/arm/boot/dts/qcom/qcom-apq8064.dtsi +4 -9
@@ -213,12 +213,6 @@ }; }; - sfpb_mutex: hwmutex { - compatible = "qcom,sfpb-mutex"; - syscon = <&sfpb_wrapper_mutex 0x604 0x4>; - #hwlock-cells = <1>; - }; - smem { compatible = "qcom,smem"; memory-region = <&smem_region>;
@@ -322,9 +316,10 @@ pinctrl-0 = <&ps_hold>; }; - sfpb_wrapper_mutex: syscon@1200000 { - compatible = "syscon"; - reg = <0x01200000 0x8000>; + sfpb_mutex: hwmutex@1200600 { + compatible = "qcom,sfpb-mutex"; + reg = <0x01200600 0x100>; + #hwlock-cells = <1>; }; intc: interrupt-controller@2000000 {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 188/356 arm64: defconfig: mediatek: enable PHY drivers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vignesh Raman <[email protected]>
[ Upstream commit f52cd248d844f9451858992f924988ac413fdc7e ]
The mediatek display driver fails to probe on mt8173-elm-hana and mt8183-kukui-jacuzzi-juniper-sku16 in v6.14-rc4 due to missing PHY configurations.
Commit 924d66011f24 ("drm/mediatek: stop selecting foreign drivers") stopped selecting the MediaTek PHY drivers, requiring them to be explicitly enabled in defconfig.
Enable the following PHY drivers for MediaTek platforms:CONFIG_PHY_MTK_HDMI=m for HDMI display CONFIG_PHY_MTK_MIPI_DSI=m for DSI display CONFIG_PHY_MTK_DP=m for DP display
--- arch/arm64/configs/defconfig | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/configs/defconfig +3 -0
@@ -1412,6 +1412,9 @@ CONFIG_PHY_HISTB_COMBPHY=y CONFIG_PHY_HISI_INNO_USB2=y CONFIG_PHY_MVEBU_CP110_COMPHY=y CONFIG_PHY_MTK_TPHY=y +CONFIG_PHY_MTK_HDMI=m +CONFIG_PHY_MTK_MIPI_DSI=m +CONFIG_PHY_MTK_DP=m CONFIG_PHY_QCOM_EDP=m CONFIG_PHY_QCOM_EUSB2_REPEATER=m CONFIG_PHY_QCOM_PCIE2=m
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 189/356 arm64: dts: rockchip: disable unrouted USB controllers and PHY on RK3399 Puma with Haikou
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quentin Schulz <[email protected]>
[ Upstream commit febd8c6ab52c683b447fe22fc740918c86feae43 ]
The u2phy0_host port is the part of the USB PHY0 (namely the HOST0_DP/DM lanes) which routes directly to the USB2.0 HOST controller[1]. The other lanes of the PHY are routed to the USB3.0 OTG controller (dwc3), which we do use.
The HOST0_DP/DM lanes aren't routed on RK3399 Puma so let's simply disable the USB2.0 controllers.
USB3 OTG has been known to be unstable on RK3399 Puma Haikou for a while, one of the recurring issues being that only USB2 is detected and not USB3 in host mode. Reading the justification above and seeing that we are keeping u2phy0_host in the Haikou carrierboard DTS probably may have bothered you since it should be changed to u2phy0_otg. The issue is that if it's switched to that, USB OTG on Haikou is entirely broken. I have checked the routing in the Gerber file, the lanes are going to the expected ball pins (that is, NOT HOST0_DP/DM).u2phy0_host is for sure the wrong part of the PHY to use, but it's the only one that works at the moment for that board so keep it until we figure out what exactly is broken.
No intended functional change.
[1] https://rockchip.fr/Rockchip%20RK3399%20TRM%20V1.3%20Part2.pdf
Chapter 2 USB2.0 PHY
--- arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts | 8 -------- 1 file changed, 8 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts +0 -8
@@ -251,14 +251,6 @@ status = "okay"; }; -&usb_host0_ehci { - status = "okay"; -}; - -&usb_host0_ohci { - status = "okay"; -}; - &vopb { status = "okay"; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 190/356 arm64: dts: renesas: white-hawk-ard-audio: Fix TPU0 groups
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thuan Nguyen <[email protected]>
[ Upstream commit 652eea251dd852f02cef6223f367220acb3d1867 ]
White Hawk ARD audio uses a clock generated by the TPU, but commit 3d144ef10a44 ("pinctrl: renesas: r8a779g0: Fix TPU suffixes") renamed pin group "tpu_to0_a" to "tpu_to0_b". Update DTS accordingly otherwise the sound driver does not receive a clock signal.
--- .../boot/dts/renesas/r8a779g0-white-hawk-ard-audio-da7212.dtso | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/renesas/r8a779g0-white-hawk-ard-audio-da7212.dtso +1 -1
@@ -108,7 +108,7 @@ }; tpu0_pins: tpu0 { - groups = "tpu_to0_a"; + groups = "tpu_to0_b"; function = "tpu"; }; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 191/356 arm64: dts: mt6359: Rename RTC node to match binding expectations
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julien Massot <[email protected]>
[ Upstream commit cfe035d8662cfbd6edff9bd89c4b516bbb34c350 ]
Rename the node 'mt6359rtc' to 'rtc', as required by the binding.
Fix the following dtb-check error:
mediatek/mt8395-radxa-nio-12l.dtb: pmic: 'mt6359rtc' do not match any of the regexes: 'pinctrl-[0-9]+'
--- arch/arm64/boot/dts/mediatek/mt6359.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/mediatek/mt6359.dtsi +1 -1
@@ -298,7 +298,7 @@ }; }; - mt6359rtc: mt6359rtc { + mt6359rtc: rtc { compatible = "mediatek,mt6358-rtc"; }; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 192/356 ARM: aspeed: Dont select SRAM
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joel Stanley <[email protected]>
[ Upstream commit e4f59f873c3ffe2a0150e11115a83e2dfb671dbf ]
The ASPEED devices have SRAM, but don't require it for basic function (or any function; there's no known users of the driver).
--- arch/arm/mach-aspeed/Kconfig | 1 - 1 file changed, 1 deletion(-)
arch/arm/mach-aspeed/Kconfig +0 -1
@@ -2,7 +2,6 @@ menuconfig ARCH_ASPEED bool "Aspeed BMC architectures" depends on (CPU_LITTLE_ENDIAN && ARCH_MULTI_V5) || ARCH_MULTI_V6 || ARCH_MULTI_V7 - select SRAM select WATCHDOG select ASPEED_WATCHDOG select MFD_SYSCON
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 193/356 soc: aspeed: lpc: Fix impossible judgment condition
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Hui <[email protected]>
[ Upstream commit d9f0a97e859bdcef51f9c187b1eb712eb13fd3ff ]
smatch error:drivers/soc/aspeed/aspeed-lpc-snoop.c:169 aspeed_lpc_snoop_config_irq() warn: platform_get_irq() does not return zero
platform_get_irq() return non-zero IRQ number or negative error code, change '!lpc_snoop->irq' to 'lpc_snoop->irq < 0' to fix this.
--- drivers/soc/aspeed/aspeed-lpc-snoop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/aspeed/aspeed-lpc-snoop.c +1 -1
@@ -166,7 +166,7 @@ static int aspeed_lpc_snoop_config_irq(struct aspeed_lpc_snoop *lpc_snoop,int rc; lpc_snoop->irq =platform_get_irq (pdev,0 ); -if (!lpc_snoop->irq) +if (lpc_snoop->irq <0 )return -ENODEV ; rc = devm_request_irq(dev, lpc_snoop->irq,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 194/356 soc: aspeed: Add NULL check in aspeed_lpc_enable_snoop()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henry Martin <[email protected]>
[ Upstream commit f1706e0e1a74b095cbc60375b9b1e6205f5f4c98 ]
devm_kasprintf() returns NULL when memory allocation fails. Currently, aspeed_lpc_enable_snoop() does not check for this case, which results in a NULL pointer dereference.
Add NULL check after devm_kasprintf() to prevent this issue.
--- drivers/soc/aspeed/aspeed-lpc-snoop.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/soc/aspeed/aspeed-lpc-snoop.c +13 -2
@@ -200,11 +200,15 @@ static int aspeed_lpc_enable_snoop(struct aspeed_lpc_snoop *lpc_snoop, lpc_snoop->chan[channel].miscdev.minor =MISC_DYNAMIC_MINOR ; lpc_snoop->chan[channel].miscdev.name =devm_kasprintf (dev,GFP_KERNEL ,"%s%d" ,DEVICE_NAME , channel); +if (!lpc_snoop->chan[channel].miscdev.name) { + rc = -ENOMEM ; + goto err_free_fifo; + } lpc_snoop->chan[channel].miscdev.fops = &snoop_fops; lpc_snoop->chan[channel].miscdev.parent = dev; rc =misc_register (&lpc_snoop->chan[channel].miscdev);if (rc) -return rc; + goto err_free_fifo;/* Enable LPC snoop channel at requested port */ switch (channel) {
@@ -221,7 +225,8 @@ static int aspeed_lpc_enable_snoop(struct aspeed_lpc_snoop *lpc_snoop, hicrb_en =HICRB_ENSNP1D ;break ;default : -return -EINVAL ; + rc = -EINVAL ; + goto err_misc_deregister; }regmap_update_bits (lpc_snoop->regmap,HICR5 , hicr5_en, hicr5_en);
@@ -231,6 +236,12 @@ static int aspeed_lpc_enable_snoop(struct aspeed_lpc_snoop *lpc_snoop,regmap_update_bits (lpc_snoop->regmap,HICRB , hicrb_en, hicrb_en); +return 0 ; + +err_misc_deregister: +misc_deregister (&lpc_snoop->chan[channel].miscdev); +err_free_fifo: +kfifo_free (&lpc_snoop->chan[channel].fifo);return rc; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 195/356 fbdev: core: fbcvt: avoid division by 0 in fb_cvt_hperiod()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Shtylyov <[email protected]>
[ Upstream commit 3f6dae09fc8c306eb70fdfef70726e1f154e173a ]
In fb_find_mode_cvt(), iff mode->refresh somehow happens to be 0x80000000, cvt.f_refresh will become 0 when multiplying it by 2 due to overflow. It's then passed to fb_cvt_hperiod(), where it's used as a divider -- division by 0 will result in kernel oops. Add a sanity check for cvt.f_refresh to avoid such overflow...
Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool.
--- drivers/video/fbdev/core/fbcvt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/core/fbcvt.c +1 -1
@@ -312,7 +312,7 @@ int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb) cvt.f_refresh = cvt.refresh; cvt.interlace =1 ; -if (!cvt.xres || !cvt.yres || !cvt.refresh) { +if (!cvt.xres || !cvt.yres || !cvt.refresh || cvt.f_refresh >INT_MAX ) {printk (KERN_INFO "fbcvt: Invalid input parameters\n" );return 1 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 196/356 randstruct: gcc-plugin: Remove bogus void member
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit e136a4062174a9a8d1c1447ca040ea81accfa6a8 ]
When building the randomized replacement tree of struct members, the randstruct GCC plugin would insert, as the first member, a 0-sized void member. This appears as though it was done to catch non-designated ("unnamed") static initializers, which wouldn't be stable since they depend on the original struct layout order.
This was accomplished by having the side-effect of the "void member" tripping an assert in GCC internals (count_type_elements) if the member list ever needed to be counted (e.g. for figuring out the order of members during a non-designated initialization), which would catch impossible type (void) in the struct:
security/landlock/fs.c: In function ‘hook_file_ioctl_common’:security/landlock/fs.c:1745:61: internal compiler error: in count_type_elements, at expr.cc:7075
1745 | .u.op = &(struct lsm_ioctlop_audit) {
| ^
static HOST_WIDE_INTcount_type_elements (const_tree type, bool for_ctor_p) {
switch (TREE_CODE (type))
...
case VOID_TYPE:
default:
gcc_unreachable ();
}
}However this is a redundant safety measure since randstruct uses the __designated_initializer attribute both internally and within the __randomized_layout attribute macro so that this would be enforced by the compiler directly even when randstruct was not enabled (via -Wdesignated-init).
A recent change in Landlock ended up tripping the same member counting routine when using a full-struct copy initializer as part of an anonymous initializer. This, however, is a false positive as the initializer is copying between identical structs (and hence identical layouts). The "path" member is "struct path", a randomized struct, and is being copied to from another "struct path", the "f_path" member:
landlock_log_denial(landlock_cred(file->f_cred), &(struct landlock_request) {
.type = LANDLOCK_REQUEST_FS_ACCESS,
.audit = {
.type = LSM_AUDIT_DATA_IOCTL_OP,
.u.op = &(struct lsm_ioctlop_audit) {
.path = file->f_path,
.cmd = cmd,
},
},
...As can be seen with the coming randstruct KUnit test, there appears to be no behavioral problems with this kind of initialization when the void member is removed from the randstruct GCC plugin, so remove it.
--- scripts/gcc-plugins/randomize_layout_plugin.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-)
scripts/gcc-plugins/randomize_layout_plugin.c +1 -17
@@ -348,29 +348,13 @@ static int relayout_struct(tree type)shuffle (type, (tree *)newtree, shuffle_length); -/* -* set up a bogus anonymous struct field designed to error out on unnamed struct initializers -* as gcc provides no other way to detect such code -*/ - list =make_node (FIELD_DECL ); -TREE_CHAIN (list) = newtree[0 ]; -TREE_TYPE (list) = void_type_node; -DECL_SIZE (list) = bitsize_zero_node; -DECL_NONADDRESSABLE_P (list) =1 ; -DECL_FIELD_BIT_OFFSET (list) = bitsize_zero_node; -DECL_SIZE_UNIT (list) = size_zero_node; -DECL_FIELD_OFFSET (list) = size_zero_node; -DECL_CONTEXT (list) = type; -// to satisfy the constify plugin -TREE_READONLY (list) =1 ; -for (i =0 ; i < num_fields -1 ; i++)TREE_CHAIN (newtree[i]) = newtree[i+1 ];TREE_CHAIN (newtree[num_fields -1 ]) =NULL_TREE ; main_variant =TYPE_MAIN_VARIANT (type);for (variant = main_variant; variant; variant =TYPE_NEXT_VARIANT (variant)) { -TYPE_FIELDS (variant) = list; +TYPE_FIELDS (variant) = newtree[0 ];TYPE_ATTRIBUTES (variant) =copy_list (TYPE_ATTRIBUTES (variant));TYPE_ATTRIBUTES (variant) =tree_cons (get_identifier ("randomize_performed" ),NULL_TREE ,TYPE_ATTRIBUTES (variant));TYPE_ATTRIBUTES (variant) =tree_cons (get_identifier ("designated_init" ),NULL_TREE ,TYPE_ATTRIBUTES (variant));
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 197/356 randstruct: gcc-plugin: Fix attribute addition
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit f39f18f3c3531aa802b58a20d39d96e82eb96c14 ]
Based on changes in the 2021 public version of the randstruct out-of-tree GCC plugin[1], more carefully update the attributes on resulting decls, to avoid tripping checks in GCC 15's comptypes_check_enum_int() when it has been configured with "--enable-checking=misc":
arch/arm64/kernel/kexec_image.c:132:14: internal compiler error: in comptypes_check_enum_int, at c/c-typeck.cc:1519
132 | const struct kexec_file_ops kexec_image_ops = {
| ^~~~~~~~~~~~~~ internal_error(char const*, ...), at gcc/gcc/diagnostic-global-context.cc:517 fancy_abort(char const*, int, char const*), at gcc/gcc/diagnostic.cc:1803 comptypes_check_enum_int(tree_node*, tree_node*, bool*), at gcc/gcc/c/c-typeck.cc:1519
...
--- scripts/gcc-plugins/gcc-common.h | 32 +++++++++++++++++++ scripts/gcc-plugins/randomize_layout_plugin.c | 22 ++++++------- 2 files changed, 43 insertions(+), 11 deletions(-)
scripts/gcc-plugins/gcc-common.h +32 -0
@@ -128,6 +128,38 @@ static inline tree build_const_char_string(int len, const char *str)return cstr; } +static inline void __add_type_attr (tree type,const char *attr,tree args) +{ +tree oldattr; + +if (type ==NULL_TREE ) +return ; + oldattr =lookup_attribute (attr,TYPE_ATTRIBUTES (type)); +if (oldattr !=NULL_TREE ) { +gcc_assert (TREE_VALUE (oldattr) == args ||TREE_VALUE (TREE_VALUE (oldattr)) ==TREE_VALUE (args)); +return ; + } + +TYPE_ATTRIBUTES (type) =copy_list (TYPE_ATTRIBUTES (type)); +TYPE_ATTRIBUTES (type) =tree_cons (get_identifier (attr), args,TYPE_ATTRIBUTES (type)); +} + +static inline void add_type_attr (tree type,const char *attr,tree args) +{ +tree main_variant =TYPE_MAIN_VARIANT (type); + +__add_type_attr (TYPE_CANONICAL (type), attr, args); +__add_type_attr (TYPE_CANONICAL (main_variant), attr, args); +__add_type_attr (main_variant, attr, args); + +for (type =TYPE_NEXT_VARIANT (main_variant); type; type =TYPE_NEXT_VARIANT (type)) { +if (!lookup_attribute (attr,TYPE_ATTRIBUTES (type))) +TYPE_ATTRIBUTES (type) =TYPE_ATTRIBUTES (main_variant); + +__add_type_attr (TYPE_CANONICAL (type), attr, args); + } +} +#define PASS_INFO (NAME ,REF ,ID ,POS ) \ struct register_pass_info NAME##_pass_info = { \ .pass = make_##NAME##_pass(), \
scripts/gcc-plugins/randomize_layout_plugin.c +11 -11
@@ -77,6 +77,9 @@ static tree handle_randomize_layout_attr(tree *node, tree name, tree args, int fif (TYPE_P (*node)) { type = *node; + }else if (TREE_CODE (*node) ==FIELD_DECL ) { + *no_add_attrs = false; +return NULL_TREE ; }else {gcc_assert (TREE_CODE (*node) ==TYPE_DECL ); type =TREE_TYPE (*node);
@@ -352,15 +355,14 @@ static int relayout_struct(tree type)TREE_CHAIN (newtree[i]) = newtree[i+1 ];TREE_CHAIN (newtree[num_fields -1 ]) =NULL_TREE ; +add_type_attr (type,"randomize_performed" ,NULL_TREE ); +add_type_attr (type,"designated_init" ,NULL_TREE ); +if (has_flexarray) +add_type_attr (type,"has_flexarray" ,NULL_TREE ); + main_variant =TYPE_MAIN_VARIANT (type); -for (variant = main_variant; variant; variant =TYPE_NEXT_VARIANT (variant)) { +for (variant = main_variant; variant; variant =TYPE_NEXT_VARIANT (variant))TYPE_FIELDS (variant) = newtree[0 ]; -TYPE_ATTRIBUTES (variant) =copy_list (TYPE_ATTRIBUTES (variant)); -TYPE_ATTRIBUTES (variant) =tree_cons (get_identifier ("randomize_performed" ),NULL_TREE ,TYPE_ATTRIBUTES (variant)); -TYPE_ATTRIBUTES (variant) =tree_cons (get_identifier ("designated_init" ),NULL_TREE ,TYPE_ATTRIBUTES (variant)); -if (has_flexarray) -TYPE_ATTRIBUTES (type) =tree_cons (get_identifier ("has_flexarray" ),NULL_TREE ,TYPE_ATTRIBUTES (type)); - }/* * force a re-layout of the main variant
@@ -428,10 +430,8 @@ static void randomize_type(tree type)if (lookup_attribute ("randomize_layout" ,TYPE_ATTRIBUTES (TYPE_MAIN_VARIANT (type))) ||is_pure_ops_struct (type))relayout_struct (type); -for (variant =TYPE_MAIN_VARIANT (type); variant; variant =TYPE_NEXT_VARIANT (variant)) { -TYPE_ATTRIBUTES (type) =copy_list (TYPE_ATTRIBUTES (type)); -TYPE_ATTRIBUTES (type) =tree_cons (get_identifier ("randomize_considered" ),NULL_TREE ,TYPE_ATTRIBUTES (type)); - } +add_type_attr (type,"randomize_considered" ,NULL_TREE ); +#ifdef __DEBUG_PLUGINfprintf (stderr,"Marking randomize_considered on struct %s\n" ,ORIG_TYPE_NAME (type));#ifdef __DEBUG_VERBOSE
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 198/356 perf build: Warn when libdebuginfod devel files are not available
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 4fce4b91fd1aabb326c46e237eb4b19ab72598f8 ]
While working on 'perf version --build-options' I noticed that:
$ perf version --build-options
perf version 6.15.rc1.g312a07a00d31
aio: [ on ] # HAVE_AIO_SUPPORT
bpf: [ on ] # HAVE_LIBBPF_SUPPORT
bpf_skeletons: [ on ] # HAVE_BPF_SKEL
debuginfod: [ OFF ] # HAVE_DEBUGINFOD_SUPPORT
<SNIP>And looking at tools/perf/Makefile.config I also noticed that it is not opt-in, meaning we will attempt to build with it in all normal cases.
So add the usual warning at build time to let the user know that something recommended is missing, now we see:
Makefile.config:563: No elfutils/debuginfod.h found, no debuginfo server support, please install elfutils-debuginfod-client-devel or equivalent
And after following the recommendation:
$ perf check feature debuginfod
debuginfod: [ on ] # HAVE_DEBUGINFOD_SUPPORT
$ ldd ~/bin/perf | grep debuginfo
libdebuginfod.so.1 => /lib64/libdebuginfod.so.1 (0x00007fee5cf5f000)
$With this feature on several perf tools will fetch what is needed and not require all the contents of the debuginfo packages, for instance:
# rpm -qa | grep kernel-debuginfo
# pahole --running_kernel_vmlinux
pahole: couldn't find a vmlinux that matches the running kernel
HINT: Maybe you're inside a container or missing a debuginfo package?
#
# perf trace -e open* perf probe --vars icmp_rcv
0.000 ( 0.005 ms): perf/97391 openat(dfd: CWD, filename: "/etc/ld.so.cache", flags: RDONLY|CLOEXEC) = 3
0.014 ( 0.004 ms): perf/97391 openat(dfd: CWD, filename: "/lib64/libm.so.6", flags: RDONLY|CLOEXEC) = 3
<SNIP>
32130.100 ( 0.008 ms): perf/97391 openat(dfd: CWD, filename: "/root/.cache/debuginfod_client/aa3c82b4a13f9c0e0301bebb20fe958c4db6f362/debuginfo") = 3
<SNIP>
Available variables at icmp_rcv
@<icmp_rcv+0>
struct sk_buff* skb
<SNIP>
#
# pahole --running_kernel_vmlinux
/root/.cache/debuginfod_client/aa3c82b4a13f9c0e0301bebb20fe958c4db6f362/debuginfo
# file /root/.cache/debuginfod_client/aa3c82b4a13f9c0e0301bebb20fe958c4db6f362/debuginfo
/root/.cache/debuginfod_client/aa3c82b4a13f9c0e0301bebb20fe958c4db6f362/debuginfo: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=aa3c82b4a13f9c0e0301bebb20fe958c4db6f362, with debug_info, not stripped
# ls -la /root/.cache/debuginfod_client/aa3c82b4a13f9c0e0301bebb20fe958c4db6f362/debuginfo
-r--------. 1 root root 475401512 Mar 27 21:00 /root/.cache/debuginfod_client/aa3c82b4a13f9c0e0301bebb20fe958c4db6f362/debuginfo
#Then, cached:
# perf stat --null perf probe --vars icmp_rcv
Available variables at icmp_rcv
@<icmp_rcv+0>
struct sk_buff* skb Performance counter stats for 'perf probe --vars icmp_rcv':
0.671389041 seconds time elapsed
0.519176000 seconds user
0.150860000 seconds sys--- tools/perf/Makefile.config | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/Makefile.config +2 -0
@@ -554,6 +554,8 @@ ifndef NO_LIBELF ifeq ($(feature-libdebuginfod), 1) CFLAGS += -DHAVE_DEBUGINFOD_SUPPORT EXTLIBS += -ldebuginfod + else + $(warning No elfutils/debuginfod.h found, no debuginfo server support, please install libdebuginfod-dev/elfutils-debuginfod-client-devel or equivalent) endif endif
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 199/356 perf ui browser hists: Set actions->thread before calling do_zoom_thread()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 1741189d843a1d5ef38538bc52a3760e2e46cb2e ]
In 7cecb7fe8388d5c3 ("perf hists: Move sort__has_comm into struct perf_hpp_list") it assumes that act->thread is set prior to calling do_zoom_thread().
This doesn't happen when we use ESC or the Left arrow key to Zoom out of a specific thread, making this operation not to work and we get stuck into the thread zoom.
In 6422184b087ff435 ("perf hists browser: Simplify zooming code using pstack_peek()") it says no need to set actions->thread, and at that point that was true, but in 7cecb7fe8388d5c3 a actions->thread == NULL check was added before the zoom out of thread could kick in.
We can zoom out using the alternative 't' thread zoom toggle hotkey to finally set actions->thread before calling do_zoom_thread() and zoom out, but lets also fix the ESC/Zoom out of thread case.
--- tools/perf/ui/browsers/hists.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/ui/browsers/hists.c +1 -1
@@ -3239,10 +3239,10 @@ static int evsel__hists_browse(struct evsel *evsel, int nr_events, const char *h/* * No need to set actions->dso here since * it's just to remove the current filter. -* Ditto for thread below. */ do_zoom_dso (browser, actions); }else if (top == &browser->hists->thread_filter) { + actions->thread = thread;do_zoom_thread (browser, actions); }else if (top == &browser->hists->socket_filter) {do_zoom_socket (browser, actions);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 200/356 dm: dont change md if dm_table_set_restrictions() fails
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Marzinski <[email protected]>
[ Upstream commit 9eb7109a5bfc5b8226e9517e9f3cc6d414391884 ]
__bind was changing the disk capacity, geometry and mempools of the mapped device before calling dm_table_set_restrictions() which could fail, forcing dm to drop the new table. Failing here would leave the device using the old table but with the wrong capacity and mempools.
Move dm_table_set_restrictions() earlier in __bind(). Since it needs the capacity to be set, save the old version and restore it on failure.
--- drivers/md/dm.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/md/dm.c +12 -10
@@ -2195,21 +2195,29 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t, struct queue_limits *limits) {struct dm_table *old_map; -sector_t size; +sector_t size, old_size;int ret;lockdep_assert_held (&md->suspend_lock); size =dm_table_get_size (t); + old_size =dm_get_size (md); +set_capacity (md->disk, size); + + ret =dm_table_set_restrictions (t, md->queue, limits); +if (ret) { +set_capacity (md->disk, old_size); + old_map =ERR_PTR (ret); + goto out; + } +/* * Wipe any geometry if the size of the table changed. */ -if (size !=dm_get_size (md)) +if (size != old_size)memset (&md->geometry,0 ,sizeof (md->geometry)); -set_capacity (md->disk, size); -dm_table_event_callback (t, event_callback, md);if (dm_table_request_based (t)) {
@@ -2242,12 +2250,6 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t, t->mempools =NULL ; } - ret =dm_table_set_restrictions (t, md->queue, limits); -if (ret) { - old_map =ERR_PTR (ret); - goto out; - } - old_map =rcu_dereference_protected (md->map,lockdep_is_held (&md->suspend_lock));rcu_assign_pointer (md->map, (void *)t); md->immutable_target_type =dm_table_get_immutable_target_type (t);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 201/356 dm: free table mempools if not used in __bind
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Marzinski <[email protected]>
[ Upstream commit e8819e7f03470c5b468720630d9e4e1d5b99159e ]
With request-based dm, the mempools don't need reloading when switching tables, but the unused table mempools are not freed until the active table is finally freed. Free them immediately if they are not needed.
--- drivers/md/dm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/md/dm.c +4 -4
@@ -2235,10 +2235,10 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t,* requests in the queue may refer to bio from the old bioset, * so you must walk through the queue to unprep. */ -if (!md->mempools) { +if (!md->mempools) md->mempools = t->mempools; - t->mempools =NULL ; - } +else +dm_free_md_mempools (t->mempools); }else {/* * The md may already have mempools that need changing.
@@ -2247,8 +2247,8 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t,*/ dm_free_md_mempools (md->mempools); md->mempools = t->mempools; - t->mempools =NULL ; } + t->mempools =NULL ; old_map =rcu_dereference_protected (md->map,lockdep_is_held (&md->suspend_lock));rcu_assign_pointer (md->map, (void *)t);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 202/356 backlight: pm8941: Add NULL check in wled_configure()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henry Martin <[email protected]>
[ Upstream commit e12d3e1624a02706cdd3628bbf5668827214fa33 ]
devm_kasprintf() returns NULL when memory allocation fails. Currently, wled_configure() does not check for this case, which results in a NULL pointer dereference.
Add NULL check after devm_kasprintf() to prevent this issue.
--- drivers/video/backlight/qcom-wled.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/video/backlight/qcom-wled.c +4 -2
@@ -1406,9 +1406,11 @@ static int wled_configure(struct wled *wled) wled->ctrl_addr =be32_to_cpu (*prop_addr); rc =of_property_read_string (dev->of_node,"label" , &wled->name); -if (rc) +if (rc) { wled->name =devm_kasprintf (dev,GFP_KERNEL ,"%pOFn" , dev->of_node); - +if (!wled->name) +return -ENOMEM ; + }switch (wled->version) {case 3 : u32_opts = wled3_opts;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 203/356 mtd: nand: ecc-mxic: Fix use of uninitialized variable ret
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikhail Arkhipov <[email protected]>
[ Upstream commit d95846350aac72303036a70c4cdc69ae314aa26d ]
If ctx->steps is zero, the loop processing ECC steps is skipped, and the variable ret remains uninitialized. It is later checked and returned, which leads to undefined behavior and may cause unpredictable results in user space or kernel crashes.
This scenario can be triggered in edge cases such as misconfigured geometry, ECC engine misuse, or if ctx->steps is not validated after initialization.
Initialize ret to zero before the loop to ensure correct and safe behavior regardless of the ctx->steps value.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/mtd/nand/ecc-mxic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/ecc-mxic.c +1 -1
@@ -614,7 +614,7 @@ static int mxic_ecc_finish_io_req_external(struct nand_device *nand, {struct mxic_ecc_engine *mxic =nand_to_mxic (nand);struct mxic_ecc_ctx *ctx =nand_to_ecc_ctx (nand); -int nents, step, ret; +int nents, step, ret =0 ;if (req->mode ==MTD_OPS_RAW )return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 204/356 hwmon: (asus-ec-sensors) check sensor index in read_string()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Safin <[email protected]>
[ Upstream commit 25be318324563c63cbd9cb53186203a08d2f83a1 ]
Prevent a potential invalid memory access when the requested sensor is not found.
find_ec_sensor_index() may return a negative value (e.g. -ENOENT), but its result was used without checking, which could lead to undefined behavior when passed to get_sensor_info().
Add a proper check to return -EINVAL if sensor_index is negative.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/hwmon/asus-ec-sensors.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/hwmon/asus-ec-sensors.c +4 -0
@@ -888,6 +888,10 @@ static int asus_ec_hwmon_read_string(struct device *dev, {struct ec_sensors_data *state =dev_get_drvdata (dev);int sensor_index =find_ec_sensor_index (state, type, channel); + +if (sensor_index <0 ) +return sensor_index; + *str =get_sensor_info (state, sensor_index)->label;return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 205/356 dm-flakey: error all IOs when num_features is absent
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Marzinski <[email protected]>
[ Upstream commit 40ed054f39bc99eac09871c33198e501f4acdf24 ]
dm-flakey would error all IOs if num_features was 0, but if it was absent, dm-flakey would never error any IO. Fix this so that no num_features works the same as num_features set to 0.
--- drivers/md/dm-flakey.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/md/dm-flakey.c +8 -8
@@ -53,8 +53,8 @@ struct per_bio_data {static int parse_features (struct dm_arg_set *as,struct flakey_c *fc,struct dm_target *ti) { -int r; -unsigned int argc; +int r =0 ; +unsigned int argc =0 ;const char *arg_name;static const struct dm_arg _args[] = {
@@ -65,14 +65,13 @@ static int parse_features(struct dm_arg_set *as, struct flakey_c *fc, {0, PROBABILITY_BASE, "Invalid random corrupt argument"}, }; -/* No feature arguments supplied. */ -if (!as->argc) -return 0 ; - - r =dm_read_arg_group (_args, as, &argc, &ti->error); -if (r) +if (as->argc && (r =dm_read_arg_group (_args, as, &argc, &ti->error)))return r; +/* No feature arguments supplied. */ +if (!argc) + goto error_all_io; +while (argc) { arg_name =dm_shift_arg (as); argc--;
@@ -217,6 +216,7 @@ static int parse_features(struct dm_arg_set *as, struct flakey_c *fc,if (!fc->corrupt_bio_byte && !test_bit (ERROR_READS , &fc->flags) && !test_bit (DROP_WRITES , &fc->flags) && !test_bit (ERROR_WRITES , &fc->flags) && !fc->random_read_corrupt && !fc->random_write_corrupt) { +error_all_io:set_bit (ERROR_WRITES , &fc->flags);set_bit (ERROR_READS , &fc->flags); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 206/356 dm-flakey: make corrupting read bios work
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Marzinski <[email protected]>
[ Upstream commit 13e79076c89f6e96a6cca8f6df38b40d025907b4 ]
dm-flakey corrupts the read bios in the endio function. However, the corrupt_bio_* functions checked bio_has_data() to see if there was data to corrupt. Since this was the endio function, there was no data left to complete, so bio_has_data() was always false. Fix this by saving a copy of the bio's bi_iter in flakey_map(), and using this to initialize the iter for corrupting the read bios. This patch also skips cloning the bio for write bios with no data.
--- drivers/md/dm-flakey.c | 54 ++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 26 deletions(-)
drivers/md/dm-flakey.c +28 -26
@@ -47,7 +47,8 @@ enum feature_flag_bits { };struct per_bio_data { -bool bio_submitted; +bool bio_can_corrupt; +struct bvec_iter saved_iter; }; static int parse_features(struct dm_arg_set *as, struct flakey_c *fc,
@@ -339,7 +340,8 @@ static void flakey_map_bio(struct dm_target *ti, struct bio *bio) }static void corrupt_bio_common (struct bio *bio,unsigned int corrupt_bio_byte, -unsigned char corrupt_bio_value) +unsigned char corrupt_bio_value, +struct bvec_iter start) {struct bvec_iter iter;struct bio_vec bvec;
@@ -348,7 +350,7 @@ static void corrupt_bio_common(struct bio *bio, unsigned int corrupt_bio_byte,* Overwrite the Nth byte of the bio's data, on whichever page * it falls. */ -bio_for_each_segment (bvec, bio, iter) { +__bio_for_each_segment (bvec, bio, iter, start) {if (bio_iter_len (bio, iter) > corrupt_bio_byte) {unsigned char *segment =bvec_kmap_local (&bvec); segment[corrupt_bio_byte] = corrupt_bio_value;
@@ -357,36 +359,31 @@ static void corrupt_bio_common(struct bio *bio, unsigned int corrupt_bio_byte,"(rw=%c bi_opf=%u bi_sector=%llu size=%u)\n" , bio, corrupt_bio_value, corrupt_bio_byte, (bio_data_dir (bio) ==WRITE ) ?'w' :'r' , bio->bi_opf, - (unsigned long long )bio->bi_iter.bi_sector, - bio->bi_iter.bi_size); + (unsigned long long )start.bi_sector, + start.bi_size);break ; } corrupt_bio_byte -=bio_iter_len (bio, iter); } } -static void corrupt_bio_data (struct bio *bio,struct flakey_c *fc) +static void corrupt_bio_data (struct bio *bio,struct flakey_c *fc, +struct bvec_iter start) {unsigned int corrupt_bio_byte = fc->corrupt_bio_byte -1 ; -if (!bio_has_data (bio)) -return ; - -corrupt_bio_common (bio, corrupt_bio_byte, fc->corrupt_bio_value); +corrupt_bio_common (bio, corrupt_bio_byte, fc->corrupt_bio_value, start); } -static void corrupt_bio_random (struct bio *bio) +static void corrupt_bio_random (struct bio *bio,struct bvec_iter start) {unsigned int corrupt_byte;unsigned char corrupt_value; -if (!bio_has_data (bio)) -return ; - - corrupt_byte =get_random_u32 () % bio->bi_iter.bi_size; + corrupt_byte =get_random_u32 () % start.bi_size; corrupt_value =get_random_u8 (); -corrupt_bio_common (bio, corrupt_byte, corrupt_value); +corrupt_bio_common (bio, corrupt_byte, corrupt_value, start); }static void clone_free (struct bio *clone)
@@ -481,7 +478,7 @@ static int flakey_map(struct dm_target *ti, struct bio *bio)unsigned int elapsed;struct per_bio_data *pb =dm_per_bio_data (bio,sizeof (struct per_bio_data )); - pb->bio_submitted = false; + pb->bio_can_corrupt = false;if (op_is_zone_mgmt (bio_op (bio))) goto map_bio;
@@ -490,10 +487,11 @@ static int flakey_map(struct dm_target *ti, struct bio *bio) elapsed = (jiffies - fc->start_time) /HZ ;if (elapsed % (fc->up_interval + fc->down_interval) >= fc->up_interval) {bool corrupt_fixed, corrupt_random; -/* -* Flag this bio as submitted while down. -*/ - pb->bio_submitted = true; + +if (bio_has_data (bio)) { + pb->bio_can_corrupt = true; + pb->saved_iter = bio->bi_iter; + }/* * Error reads if neither corrupt_bio_byte or drop_writes or error_writes are set.
@@ -516,6 +514,8 @@ static int flakey_map(struct dm_target *ti, struct bio *bio)return DM_MAPIO_SUBMITTED ; } +if (!pb->bio_can_corrupt) + goto map_bio;/* * Corrupt matching writes. */
@@ -535,9 +535,11 @@ static int flakey_map(struct dm_target *ti, struct bio *bio)struct bio *clone =clone_bio (ti, fc, bio);if (clone) {if (corrupt_fixed) -corrupt_bio_data (clone, fc); +corrupt_bio_data (clone, fc, + clone->bi_iter);if (corrupt_random) -corrupt_bio_random (clone); +corrupt_bio_random (clone, + clone->bi_iter);submit_bio (clone);return DM_MAPIO_SUBMITTED ; }
@@ -559,21 +561,21 @@ static int flakey_end_io(struct dm_target *ti, struct bio *bio,if (op_is_zone_mgmt (bio_op (bio)))return DM_ENDIO_DONE ; -if (!*error && pb->bio_submitted && (bio_data_dir (bio) ==READ )) { +if (!*error && pb->bio_can_corrupt && (bio_data_dir (bio) ==READ )) {if (fc->corrupt_bio_byte) {if ((fc->corrupt_bio_rw ==READ ) &&all_corrupt_bio_flags_match (bio, fc)) {/* * Corrupt successful matching READs while in down state. */ -corrupt_bio_data (bio, fc); +corrupt_bio_data (bio, fc, pb->saved_iter); } }if (fc->random_read_corrupt) {u64 rnd =get_random_u64 ();u32 rem =do_div (rnd,PROBABILITY_BASE );if (rem < fc->random_read_corrupt) -corrupt_bio_random (bio); +corrupt_bio_random (bio, pb->saved_iter); }if (test_bit (ERROR_READS , &fc->flags)) {/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 207/356 perf trace: Fix leaks of struct thread in set_filter_loop_pids()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit 30d20fb1f84ad5c92706fe2c6cbb2d4cc293e671 ]
I've found some leaks from 'perf trace -a'.
It seems there are more leaks but this is what I can find for now.
--- tools/perf/builtin-trace.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/builtin-trace.c +3 -0
@@ -3589,10 +3589,13 @@ static int trace__set_filter_loop_pids(struct trace *trace)if (!strcmp (thread__comm_str (parent),"sshd" ) ||strstarts (thread__comm_str (parent),"gnome-terminal" )) { pids[nr++] =thread__tid (parent); +thread__put (parent);break ; } +thread__put (thread); thread = parent; } +thread__put (thread); err =evlist__append_tp_filter_pids (trace->evlist, nr, pids);if (!err && trace->filter_pids.map)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 208/356 perf intel-pt: Fix PEBS-via-PT data_src
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
[ Upstream commit e00eac6b5b6d956f38d8880c44bf7fd9954063c3 ]
The Fixes commit did not add support for decoding PEBS-via-PT data_src. Fix by adding support.
PEBS-via-PT is a feature of some E-core processors, starting with processors based on Tremont microarchitecture. Because the kernel only supports Intel PT features that are on all processors, there is no support for PEBS-via-PT on hybrids.
Currently that leaves processors based on Tremont, Gracemont and Crestmont, however there are no events on Tremont that produce data_src information, and for Gracemont and Crestmont there are only:
mem-loads event=0xd0,umask=0x5,ldlat=3 mem-stores event=0xd0,umask=0x6
Affected processors include Alder Lake N (Gracemont), Sierra Forest (Crestmont) and Grand Ridge (Crestmont).
Example:
# perf record -d -e intel_pt/branch=0/ -e mem-loads/aux-output/pp uname
Before:
# perf.before script --itrace=o -Fdata_src
0 |OP No|LVL N/A|SNP N/A|TLB N/A|LCK No|BLK N/A
0 |OP No|LVL N/A|SNP N/A|TLB N/A|LCK No|BLK N/AAfter:
# perf script --itrace=o -Fdata_src 10268100142 |OP LOAD|LVL L1 hit|SNP None|TLB L1 or L2 hit|LCK No|BLK N/A 10450100442 |OP LOAD|LVL L2 hit|SNP None|TLB L2 miss|LCK No|BLK N/A
--- tools/perf/util/intel-pt.c | 205 ++++++++++++++++++++++++++++++++++++- 1 file changed, 202 insertions(+), 3 deletions(-)
tools/perf/util/intel-pt.c +202 -3
@@ -127,6 +127,7 @@ struct intel_pt {bool single_pebs;bool sample_pebs; +int pebs_data_src_fmt;struct evsel *pebs_evsel;u64 evt_sample_type;
@@ -175,6 +176,7 @@ enum switch_state {struct intel_pt_pebs_event {struct evsel *evsel;u64 id; +int data_src_fmt; };struct intel_pt_queue {
@@ -2232,7 +2234,146 @@ static void intel_pt_add_lbrs(struct branch_stack *br_stack, } } -static int intel_pt_do_synth_pebs_sample (struct intel_pt_queue *ptq,struct evsel *evsel,u64 id) +#define P (a, b) PERF_MEM_S(a, b) +#define OP_LH (P(OP, LOAD) | P(LVL, HIT)) +#define LEVEL (x) P(LVLNUM, x) +#define REM P(REMOTE, REMOTE) +#define SNOOP_NONE_MISS (P(SNOOP, NONE) | P(SNOOP, MISS)) + +#define PERF_PEBS_DATA_SOURCE_GRT_MAX 0x10 +#define PERF_PEBS_DATA_SOURCE_GRT_MASK (PERF_PEBS_DATA_SOURCE_GRT_MAX - 1) + +/* Based on kernel __intel_pmu_pebs_data_source_grt() and pebs_data_source */ +static const u64 pebs_data_source_grt[PERF_PEBS_DATA_SOURCE_GRT_MAX ] = { +P (OP ,LOAD ) |P (LVL ,MISS ) |LEVEL (L3 ) |P (SNOOP ,NA ),/* L3 miss|SNP N/A */ +OP_LH |P (LVL ,L1 ) |LEVEL (L1 ) |P (SNOOP ,NONE ),/* L1 hit|SNP None */ +OP_LH |P (LVL ,LFB ) |LEVEL (LFB ) |P (SNOOP ,NONE ),/* LFB/MAB hit|SNP None */ +OP_LH |P (LVL ,L2 ) |LEVEL (L2 ) |P (SNOOP ,NONE ),/* L2 hit|SNP None */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOP ,NONE ),/* L3 hit|SNP None */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOP ,HIT ),/* L3 hit|SNP Hit */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOP ,HITM ),/* L3 hit|SNP HitM */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOP ,HITM ),/* L3 hit|SNP HitM */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOPX ,FWD ),/* L3 hit|SNP Fwd */ +OP_LH |P (LVL ,REM_CCE1 ) |REM |LEVEL (L3 ) |P (SNOOP ,HITM ),/* Remote L3 hit|SNP HitM */ +OP_LH |P (LVL ,LOC_RAM ) |LEVEL (RAM ) |P (SNOOP ,HIT ),/* RAM hit|SNP Hit */ +OP_LH |P (LVL ,REM_RAM1 ) |REM |LEVEL (L3 ) |P (SNOOP ,HIT ),/* Remote L3 hit|SNP Hit */ +OP_LH |P (LVL ,LOC_RAM ) |LEVEL (RAM ) |SNOOP_NONE_MISS ,/* RAM hit|SNP None or Miss */ +OP_LH |P (LVL ,REM_RAM1 ) |LEVEL (RAM ) |REM |SNOOP_NONE_MISS ,/* Remote RAM hit|SNP None or Miss */ +OP_LH |P (LVL ,IO ) |LEVEL (NA ) |P (SNOOP ,NONE ),/* I/O hit|SNP None */ +OP_LH |P (LVL ,UNC ) |LEVEL (NA ) |P (SNOOP ,NONE ),/* Uncached hit|SNP None */ +}; + +/* Based on kernel __intel_pmu_pebs_data_source_cmt() and pebs_data_source */ +static const u64 pebs_data_source_cmt[PERF_PEBS_DATA_SOURCE_GRT_MAX ] = { +P (OP ,LOAD ) |P (LVL ,MISS ) |LEVEL (L3 ) |P (SNOOP ,NA ),/* L3 miss|SNP N/A */ +OP_LH |P (LVL ,L1 ) |LEVEL (L1 ) |P (SNOOP ,NONE ),/* L1 hit|SNP None */ +OP_LH |P (LVL ,LFB ) |LEVEL (LFB ) |P (SNOOP ,NONE ),/* LFB/MAB hit|SNP None */ +OP_LH |P (LVL ,L2 ) |LEVEL (L2 ) |P (SNOOP ,NONE ),/* L2 hit|SNP None */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOP ,NONE ),/* L3 hit|SNP None */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOP ,MISS ),/* L3 hit|SNP Hit */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOP ,HIT ),/* L3 hit|SNP HitM */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOPX ,FWD ),/* L3 hit|SNP HitM */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOP ,HITM ),/* L3 hit|SNP Fwd */ +OP_LH |P (LVL ,REM_CCE1 ) |REM |LEVEL (L3 ) |P (SNOOP ,HITM ),/* Remote L3 hit|SNP HitM */ +OP_LH |P (LVL ,LOC_RAM ) |LEVEL (RAM ) |P (SNOOP ,NONE ),/* RAM hit|SNP Hit */ +OP_LH |LEVEL (RAM ) |REM |P (SNOOP ,NONE ),/* Remote L3 hit|SNP Hit */ +OP_LH |LEVEL (RAM ) |REM |P (SNOOPX ,FWD ),/* RAM hit|SNP None or Miss */ +OP_LH |LEVEL (RAM ) |REM |P (SNOOP ,HITM ),/* Remote RAM hit|SNP None or Miss */ +OP_LH |P (LVL ,IO ) |LEVEL (NA ) |P (SNOOP ,NONE ),/* I/O hit|SNP None */ +OP_LH |P (LVL ,UNC ) |LEVEL (NA ) |P (SNOOP ,NONE ),/* Uncached hit|SNP None */ +}; + +/* Based on kernel pebs_set_tlb_lock() */ +static inline void pebs_set_tlb_lock (u64 *val,bool tlb,bool lock) +{ +/* +* TLB access +* 0 = did not miss 2nd level TLB +* 1 = missed 2nd level TLB +*/ +if (tlb) + *val |=P (TLB ,MISS ) |P (TLB ,L2 ); +else + *val |=P (TLB ,HIT ) |P (TLB ,L1 ) |P (TLB ,L2 ); + +/* locked prefix */ +if (lock) + *val |=P (LOCK ,LOCKED ); +} + +/* Based on kernel __grt_latency_data() */ +static u64 intel_pt_grt_latency_data (u8 dse,bool tlb,bool lock,bool blk, +const u64 *pebs_data_source) +{ +u64 val; + + dse &=PERF_PEBS_DATA_SOURCE_GRT_MASK ; + val = pebs_data_source[dse]; + +pebs_set_tlb_lock (&val, tlb, lock); + +if (blk) + val |=P (BLK ,DATA ); +else + val |=P (BLK ,NA ); + +return val; +} + +/* Default value for data source */ +#define PERF_MEM_NA (PERF_MEM_S(OP, NA) |\ + PERF_MEM_S(LVL, NA) |\ + PERF_MEM_S(SNOOP, NA) |\ + PERF_MEM_S(LOCK, NA) |\ + PERF_MEM_S(TLB, NA) |\ + PERF_MEM_S(LVLNUM, NA)) + +enum DATA_SRC_FORMAT { +DATA_SRC_FORMAT_ERR =-1 , +DATA_SRC_FORMAT_NA =0 , +DATA_SRC_FORMAT_GRT =1 , +DATA_SRC_FORMAT_CMT =2 , +}; + +/* Based on kernel grt_latency_data() and cmt_latency_data */ +static u64 intel_pt_get_data_src (u64 mem_aux_info,int data_src_fmt) +{ +switch (data_src_fmt) { +case DATA_SRC_FORMAT_GRT : { +union { +u64 val; +struct { +unsigned int dse:4 ; +unsigned int locked:1 ; +unsigned int stlb_miss:1 ; +unsigned int fwd_blk:1 ; +unsigned int reserved:25 ; + }; + } x = {.val = mem_aux_info}; +return intel_pt_grt_latency_data (x.dse, x.stlb_miss, x.locked, x.fwd_blk, + pebs_data_source_grt); + } +case DATA_SRC_FORMAT_CMT : { +union { +u64 val; +struct { +unsigned int dse:5 ; +unsigned int locked:1 ; +unsigned int stlb_miss:1 ; +unsigned int fwd_blk:1 ; +unsigned int reserved:24 ; + }; + } x = {.val = mem_aux_info}; +return intel_pt_grt_latency_data (x.dse, x.stlb_miss, x.locked, x.fwd_blk, + pebs_data_source_cmt); + } +default : +return PERF_MEM_NA ; + } +} + +static int intel_pt_do_synth_pebs_sample (struct intel_pt_queue *ptq,struct evsel *evsel, +u64 id,int data_src_fmt) {const struct intel_pt_blk_items *items = &ptq->state->items;struct perf_sample sample = { .ip =0 , };
@@ -2350,6 +2491,18 @@ static int intel_pt_do_synth_pebs_sample(struct intel_pt_queue *ptq, struct evse } } +if (sample_type &PERF_SAMPLE_DATA_SRC ) { +if (items->has_mem_aux_info && data_src_fmt) { +if (data_src_fmt <0 ) { +pr_err ("Intel PT missing data_src info\n" ); +return -1 ; + } + sample.data_src =intel_pt_get_data_src (items->mem_aux_info, data_src_fmt); + }else { + sample.data_src =PERF_MEM_NA ; + } + } +if (sample_type &PERF_SAMPLE_TRANSACTION && items->has_tsx_aux_info) {u64 ax = items->has_rax ? items->rax :0 ;/* Refer kernel's intel_hsw_transaction() */
@@ -2368,9 +2521,10 @@ static int intel_pt_synth_single_pebs_sample(struct intel_pt_queue *ptq) {struct intel_pt *pt = ptq->pt;struct evsel *evsel = pt->pebs_evsel; +int data_src_fmt = pt->pebs_data_src_fmt;u64 id = evsel->core.id[0 ]; -return intel_pt_do_synth_pebs_sample (ptq, evsel, id); +return intel_pt_do_synth_pebs_sample (ptq, evsel, id, data_src_fmt); }static int intel_pt_synth_pebs_sample (struct intel_pt_queue *ptq)
@@ -2395,7 +2549,7 @@ static int intel_pt_synth_pebs_sample(struct intel_pt_queue *ptq) hw_id);return intel_pt_synth_single_pebs_sample (ptq); } - err =intel_pt_do_synth_pebs_sample (ptq, pe->evsel, pe->id); + err =intel_pt_do_synth_pebs_sample (ptq, pe->evsel, pe->id, pe->data_src_fmt);if (err)return err; }
@@ -3355,6 +3509,49 @@ static int intel_pt_process_itrace_start(struct intel_pt *pt, event->itrace_start.tid); } +/* +* Events with data_src are identified by L1_Hit_Indication +* refer https://github.com/intel/perfmon +*/ +static int intel_pt_data_src_fmt (struct intel_pt *pt,struct evsel *evsel) +{ +struct perf_env *env = pt->machine->env; +int fmt =DATA_SRC_FORMAT_NA ; + +if (!env->cpuid) +return DATA_SRC_FORMAT_ERR ; + +/* +* PEBS-via-PT is only supported on E-core non-hybrid. Of those only +* Gracemont and Crestmont have data_src. Check for: +* Alderlake N (Gracemont) +* Sierra Forest (Crestmont) +* Grand Ridge (Crestmont) +*/ + +if (!strncmp (env->cpuid,"GenuineIntel,6,190," ,19 )) + fmt =DATA_SRC_FORMAT_GRT ; + +if (!strncmp (env->cpuid,"GenuineIntel,6,175," ,19 ) || + !strncmp (env->cpuid,"GenuineIntel,6,182," ,19 )) + fmt =DATA_SRC_FORMAT_CMT ; + +if (fmt ==DATA_SRC_FORMAT_NA ) +return fmt; + +/* +* Only data_src events are: +* mem-loads event=0xd0,umask=0x5 +* mem-stores event=0xd0,umask=0x6 +*/ +if (evsel->core.attr.type ==PERF_TYPE_RAW && + ((evsel->core.attr.config &0xffff ) ==0x5d0 || + (evsel->core.attr.config &0xffff ) ==0x6d0 )) +return fmt; + +return DATA_SRC_FORMAT_NA ; +} +static int intel_pt_process_aux_output_hw_id (struct intel_pt *pt,union perf_event *event,struct perf_sample *sample)
@@ -3375,6 +3572,7 @@ static int intel_pt_process_aux_output_hw_id(struct intel_pt *pt, ptq->pebs[hw_id].evsel = evsel; ptq->pebs[hw_id].id = sample->id; + ptq->pebs[hw_id].data_src_fmt =intel_pt_data_src_fmt (pt, evsel);return 0 ; }
@@ -3946,6 +4144,7 @@ static void intel_pt_setup_pebs_events(struct intel_pt *pt) } pt->single_pebs = true; pt->sample_pebs = true; + pt->pebs_data_src_fmt =intel_pt_data_src_fmt (pt, evsel); pt->pebs_evsel = evsel; } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 209/356 perf scripts python: exported-sql-viewer.py: Fix pattern matching with Python 3
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
[ Upstream commit 17e548405a81665fd14cee960db7d093d1396400 ]
The script allows the user to enter patterns to find symbols.
The pattern matching characters are converted for use in SQL.
For PostgreSQL the conversion involves using the Python maketrans() method which is slightly different in Python 3 compared with Python 2.
Fix to work in Python 3.
--- tools/perf/scripts/python/exported-sql-viewer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/scripts/python/exported-sql-viewer.py +4 -1
@@ -680,7 +680,10 @@ class CallGraphModelBase(TreeModel): s = value.replace("%", "\%") s = s.replace("_", "\_") # Translate * and ? into SQL LIKE pattern characters % and _ - trans = string.maketrans("*?", "%_") + if sys.version_info[0] == 3: + trans = str.maketrans("*?", "%_") + else: + trans = string.maketrans("*?", "%_") match = " LIKE '" + str(s).translate(trans) + "'" else: match = " GLOB '" + str(value) + "'"
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 210/356 remoteproc: qcom_wcnss_iris: Add missing put_device() on error in probe
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 0cb4b1b97041d8a1f773425208ded253c1cb5869 ]
The device_del() call matches with the device_add() but we also need to call put_device() to trigger the qcom_iris_release().
--- drivers/remoteproc/qcom_wcnss_iris.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/remoteproc/qcom_wcnss_iris.c +2 -0
@@ -197,6 +197,7 @@ struct qcom_iris *qcom_iris_probe(struct device *parent, bool *use_48mhz_xo) err_device_del:device_del (&iris->dev); +put_device (&iris->dev);return ERR_PTR (ret); }
@@ -204,4 +205,5 @@ struct qcom_iris *qcom_iris_probe(struct device *parent, bool *use_48mhz_xo)void qcom_iris_remove (struct qcom_iris *iris) {device_del (&iris->dev); +put_device (&iris->dev); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 211/356 remoteproc: k3-r5: Drop check performed in k3_r5_rproc_{mbox_callback/kick}
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siddharth Vadapalli <[email protected]>
[ Upstream commit 9995dbfc2235efabdb3759606d522e1a7ec3bdcb ]
Commit f3f11cfe8907 ("remoteproc: k3-r5: Acquire mailbox handle during probe routine") introduced a check in the "k3_r5_rproc_mbox_callback()" and "k3_r5_rproc_kick()" callbacks, causing them to exit if the remote core's state is "RPROC_DETACHED". However, the "__rproc_attach()" function that is responsible for attaching to a remote core, updates the state of the remote core to "RPROC_ATTACHED" only after invoking "rproc_start_subdevices()".
The "rproc_start_subdevices()" function triggers the probe of the Virtio RPMsg devices associated with the remote core, which require that the "k3_r5_rproc_kick()" and "k3_r5_rproc_mbox_callback()" callbacks are functional. Hence, drop the check in the callbacks.
--- drivers/remoteproc/ti_k3_r5_remoteproc.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/remoteproc/ti_k3_r5_remoteproc.c +0 -8
@@ -194,10 +194,6 @@ static void k3_r5_rproc_mbox_callback(struct mbox_client *client, void *data)const char *name = kproc->rproc->name;u32 msg =omap_mbox_message (data); -/* Do not forward message from a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -dev_dbg (dev,"mbox msg: 0x%x\n" , msg);switch (msg) {
@@ -233,10 +229,6 @@ static void k3_r5_rproc_kick(struct rproc *rproc, int vqid)mbox_msg_t msg = (mbox_msg_t )vqid;int ret; -/* Do not forward message to a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -/* send the index of the triggered virtqueue in the mailbox payload */ ret =mbox_send_message (kproc->mbox, (void *)msg);if (ret <0 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 212/356 rpmsg: qcom_smd: Fix uninitialized return variable in __qcom_smd_send()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 5de775df3362090a6e90046d1f2d83fe62489aa0 ]
The "ret" variable isn't initialized if we don't enter the loop. For example, if "channel->state" is not SMD_CHANNEL_OPENED.
--- drivers/rpmsg/qcom_smd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rpmsg/qcom_smd.c +1 -1
@@ -746,7 +746,7 @@ static int __qcom_smd_send(struct qcom_smd_channel *channel, const void *data,__le32 hdr[5 ] = {cpu_to_le32 (len), };int tlen =sizeof (hdr) + len;unsigned long flags; -int ret; +int ret =0 ;/* Word aligned channels only accept word size aligned data */ if (channel->info_word && len %4 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 213/356 mfd: exynos-lpass: Avoid calling exynos_lpass_disable() twice in exynos_lpass_remove()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit b70b84556eeca5262d290e8619fe0af5b7664a52 ]
exynos_lpass_disable() is called twice in the remove function. Remove one of these calls.
--- drivers/mfd/exynos-lpass.c | 1 - 1 file changed, 1 deletion(-)
drivers/mfd/exynos-lpass.c +0 -1
@@ -141,7 +141,6 @@ static int exynos_lpass_remove(struct platform_device *pdev) {struct exynos_lpass *lpass =platform_get_drvdata (pdev); -exynos_lpass_disable (lpass);pm_runtime_disable (&pdev->dev);if (!pm_runtime_status_suspended (&pdev->dev))exynos_lpass_disable (lpass);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 214/356 mfd: stmpe-spi: Correct the name used in MODULE_DEVICE_TABLE
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Gladkov <[email protected]>
[ Upstream commit 59d60c16ed41475f3b5f7b605e75fbf8e3628720 ]
The name used in the macro does not exist.
drivers/mfd/stmpe-spi.c:132:26: error: use of undeclared identifier 'stmpe_id'
132 | MODULE_DEVICE_TABLE(spi, stmpe_id);
--- drivers/mfd/stmpe-spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/stmpe-spi.c +1 -1
@@ -129,7 +129,7 @@ static const struct spi_device_id stmpe_spi_id[] = { { "stmpe2403", STMPE2403 }, { } }; -MODULE_DEVICE_TABLE(spi, stmpe_id); +MODULE_DEVICE_TABLE(spi, stmpe_spi_id); static struct spi_driver stmpe_spi_driver = { .driver = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 215/356 perf tests switch-tracking: Fix timestamp comparison
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 628e124404b3db5e10e17228e680a2999018ab33 ]
The test might fail on the Arm64 platform with the error:
# perf test -vvv "Track with sched_switch" Missing sched_switch events #
The issue is caused by incorrect handling of timestamp comparisons. The comparison result, a signed 64-bit value, was being directly cast to an int, leading to incorrect sorting for sched events.
The case does not fail everytime, usually I can trigger the failure after run 20 ~ 30 times:
# while true; do perf test "Track with sched_switch"; done 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : FAILED! 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : FAILED! 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok
I used cross compiler to build Perf tool on my host machine and tested on Debian / Juno board. Generally, I think this issue is not very specific to GCC versions. As both internal CI and my local env can reproduce the issue.
My Host Build compiler:
# aarch64-linux-gnu-gcc --version aarch64-linux-gnu-gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
Juno Board:
# lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 12 (bookworm) Release: 12 Codename: bookworm
Fix this by explicitly returning 0, 1, or -1 based on whether the result is zero, positive, or negative.
--- tools/perf/tests/switch-tracking.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/switch-tracking.c +1 -1
@@ -258,7 +258,7 @@ static int compar(const void *a, const void *b)const struct event_node *nodeb = b;s64 cmp = nodea->event_time - nodeb->event_time; -return cmp; +return cmp <0 ?-1 : (cmp >0 ?1 :0 ); } static int process_events(struct evlist *evlist,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 216/356 perf record: Fix incorrect --user-regs comments
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dapeng Mi <[email protected]>
[ Upstream commit a4a859eb6704a8aa46aa1cec5396c8d41383a26b ]
The comment of "--user-regs" option is not correct, fix it.
"on interrupt," -> "in user space,"
--- tools/perf/builtin-record.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-record.c +1 -1
@@ -3427,7 +3427,7 @@ static struct option __record_options[] = { "sample selected machine registers on interrupt," " use '-I?' to list register names", parse_intr_regs),OPT_CALLBACK_OPTARG (0 ,"user-regs" , &record.opts.sample_user_regs,NULL ,"any register" , -"sample selected machine registers on interrupt," +"sample selected machine registers in user space," " use '--user-regs=?' to list register names" , parse_user_regs),OPT_BOOLEAN (0 ,"running-time" , &record.opts.running_time, "Record running/enabled time of read (:S) events"),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 217/356 perf trace: Always print return value for syscalls returning a pid
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anubhav Shelat <[email protected]>
[ Upstream commit c7a48ea9b919e2fa0e4a1d9938fdb03e9afe276c ]
The syscalls that were consistently observed were set_robust_list and rseq. This is because perf cannot find their child process.
This change ensures that the return value is always printed.
Before:
0.256 ( 0.001 ms): set_robust_list(head: 0x7f09c77dba20, len: 24) =
0.259 ( 0.001 ms): rseq(rseq: 0x7f09c77dc0e0, rseq_len: 32, sig: 1392848979) =
After:
0.270 ( 0.002 ms): set_robust_list(head: 0x7f0bb14a6a20, len: 24) = 0
0.273 ( 0.002 ms): rseq(rseq: 0x7f0bb14a70e0, rseq_len: 32, sig: 1392848979) = 0Committer notes:
As discussed in the thread in the Link: tag below, these two don't return a pid, but for syscalls returning one, we need to print the result and if we manage to find the children in 'perf trace' data structures, then print its name as well.
--- tools/perf/builtin-trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-trace.c +1 -1
@@ -2586,8 +2586,8 @@ errno_print: {else if (sc->fmt->errpid) {struct thread *child =machine__find_thread (trace->host, ret, ret); +fprintf (trace->output,"%ld" , ret);if (child !=NULL ) { -fprintf (trace->output,"%ld" , ret);if (thread__comm_set (child))fprintf (trace->output," (%s)" ,thread__comm_str (child));thread__put (child);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 218/356 nfs: clear SB_RDONLY before getting superblock
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Lingfeng <[email protected]>
[ Upstream commit 8cd9b785943c57a136536250da80ba1eb6f8eb18 ]
As described in the link, commit 52cb7f8f1778 ("nfs: ignore SB_RDONLY when mounting nfs") removed the check for the ro flag when determining whether to share the superblock, which caused issues when mounting different subdirectories under the same export directory via NFSv3. However, this change did not affect NFSv4.
For NFSv3:
1) A single superblock is created for the initial mount.
2) When mounted read-only, this superblock carries the SB_RDONLY flag.
3) Before commit 52cb7f8f1778 ("nfs: ignore SB_RDONLY when mounting nfs"):
Subsequent rw mounts would not share the existing ro superblock due to flag mismatch, creating a new superblock without SB_RDONLY. After the commit:
The SB_RDONLY flag is ignored during superblock comparison, and this leads to sharing the existing superblock even for rw mounts. Ultimately results in write operations being rejected at the VFS layer.
For NFSv4:
1) Multiple superblocks are created and the last one will be kept.
2) The actually used superblock for ro mounts doesn't carry SB_RDONLY flag. Therefore, commit 52cb7f8f1778 doesn't affect NFSv4 mounts.
Clear SB_RDONLY before getting superblock when NFS_MOUNT_UNSHARED is not set to fix it.
--- fs/nfs/super.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/nfs/super.c +9 -0
@@ -1277,8 +1277,17 @@ int nfs_get_tree_common(struct fs_context *fc)if (IS_ERR (server))return PTR_ERR (server); +/* +* When NFS_MOUNT_UNSHARED is not set, NFS forces the sharing of a +* superblock among each filesystem that mounts sub-directories +* belonging to a single exported root path. +* To prevent interference between different filesystems, the +* SB_RDONLY flag should be removed from the superblock. +*/ if (server->flags &NFS_MOUNT_UNSHARED ) compare_super =NULL ; +else + fc->sb_flags &= ~SB_RDONLY ;/* -o noac implies -o sync */ if (server->flags &NFS_MOUNT_NOAC )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 219/356 nfs: ignore SB_RDONLY when remounting nfs
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Lingfeng <[email protected]>
[ Upstream commit 80c4de6ab44c14e910117a02f2f8241ffc6ec54a ]
In some scenarios, when mounting NFS, more than one superblock may be created. The final superblock used is the last one created, but only the first superblock carries the ro flag passed from user space. If a ro flag is added to the superblock via remount, it will trigger the issue described in Link[1].
Link[2] attempted to address this by marking the superblock as ro during the initial mount. However, this introduced a new problem in scenarios where multiple mount points share the same superblock:
[root@a ~]# mount /dev/sdb /mnt/sdb
[root@a ~]# echo "/mnt/sdb *(rw,no_root_squash)" > /etc/exports [root@a ~]# echo "/mnt/sdb/test_dir2 *(ro,no_root_squash)" >> /etc/exports [root@a ~]# systemctl restart nfs-server
[root@a ~]# mount -t nfs -o rw 127.0.0.1:/mnt/sdb/test_dir1 /mnt/test_mp1 [root@a ~]# mount | grep nfs4
127.0.0.1:/mnt/sdb/test_dir1 on /mnt/test_mp1 type nfs4 (rw,relatime,... [root@a ~]# mount -t nfs -o ro 127.0.0.1:/mnt/sdb/test_dir2 /mnt/test_mp2 [root@a ~]# mount | grep nfs4
127.0.0.1:/mnt/sdb/test_dir1 on /mnt/test_mp1 type nfs4 (ro,relatime,... 127.0.0.1:/mnt/sdb/test_dir2 on /mnt/test_mp2 type nfs4 (ro,relatime,... [root@a ~]#
When mounting the second NFS, the shared superblock is marked as ro, causing the previous NFS mount to become read-only.
To resolve both issues, the ro flag is no longer applied to the superblock during remount. Instead, the ro flag on the mount is used to control whether the mount point is read-only.
Link[1]: https://lore.kernel.org/all/[email protected]/
Link[2]: https://lore.kernel.org/all/[email protected]/
--- fs/nfs/super.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/nfs/super.c +10 -0
@@ -1020,6 +1020,16 @@ int nfs_reconfigure(struct fs_context *fc)sync_filesystem (sb); +/* +* The SB_RDONLY flag has been removed from the superblock during +* mounts to prevent interference between different filesystems. +* Similarly, it is also necessary to ignore the SB_RDONLY flag +* during reconfiguration; otherwise, it may also result in the +* creation of redundant superblocks when mounting a directory with +* different rw and ro flags multiple times. +*/ + fc->sb_flags_mask &= ~SB_RDONLY ; +/* * Userspace mount programs that send binary options generally send * them populated with default values. We have no way to know which
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 220/356 cifs: Fix validation of SMB1 query reparse point response
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pali Rohár <[email protected]>
[ Upstream commit 56e84c64fc257a95728ee73165456b025c48d408 ]
Validate the SMB1 query reparse point response per [MS-CIFS] section 2.2.7.2 NT_TRANSACT_IOCTL.
NT_TRANSACT_IOCTL response contains one word long setup data after which is ByteCount member. So check that SetupCount is 1 before trying to read and use ByteCount member.
Output setup data contains ReturnedDataLen member which is the output length of executed IOCTL command by remote system. So check that output was not truncated before transferring over network.
Change MaxSetupCount of NT_TRANSACT_IOCTL request from 4 to 1 as io_rsp structure already expects one word long output setup data. This should prevent server sending incompatible structure (in case it would be extended in future, which is unlikely).
Change MaxParameterCount of NT_TRANSACT_IOCTL request from 2 to 0 as NT IOCTL does not have any documented output parameters and this function does not parse any output parameters at all.
--- fs/smb/client/cifssmb.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
fs/smb/client/cifssmb.c +18 -2
@@ -2738,10 +2738,10 @@ int cifs_query_reparse_point(const unsigned int xid, io_req->TotalParameterCount =0 ; io_req->TotalDataCount =0 ; - io_req->MaxParameterCount =cpu_to_le32 (2 ); + io_req->MaxParameterCount =cpu_to_le32 (0 );/* BB find exact data count max from sess structure BB */ io_req->MaxDataCount =cpu_to_le32 (CIFSMaxBufSize &0xFFFFFF00 ); - io_req->MaxSetupCount =4 ; + io_req->MaxSetupCount =1 ; io_req->Reserved =0 ; io_req->ParameterOffset =0 ; io_req->DataCount =0 ;
@@ -2768,6 +2768,22 @@ int cifs_query_reparse_point(const unsigned int xid, goto error; } +/* SetupCount must be 1, otherwise offset to ByteCount is incorrect. */ +if (io_rsp->SetupCount !=1 ) { + rc = -EIO ; + goto error; + } + +/* +* ReturnedDataLen is output length of executed IOCTL. +* DataCount is output length transferred over network. +* Check that we have full FSCTL_GET_REPARSE_POINT buffer. +*/ +if (data_count !=le16_to_cpu (io_rsp->ReturnedDataLen)) { + rc = -EIO ; + goto error; + } + end =2 +get_bcc (&io_rsp->hdr) + (__u8 *)&io_rsp->ByteCount; start = (__u8 *)&io_rsp->hdr.Protocol + data_offset;if (start >= end) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 221/356 rtc: sh: assign correct interrupts with DT
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit 8f2efdbc303fe7baa83843d3290dd6ea5ba3276c ]
The DT bindings for this driver define the interrupts in the order as they are numbered in the interrupt controller. The old platform_data, however, listed them in a different order. So, for DT based platforms, they are mixed up. Assign them specifically for DT, so we can keep the bindings stable. After the fix, 'rtctest' passes again on the Renesas Genmai board (RZ-A1 / R7S72100).
--- drivers/rtc/rtc-sh.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/rtc/rtc-sh.c +9 -3
@@ -485,9 +485,15 @@ static int __init sh_rtc_probe(struct platform_device *pdev)return -ENOENT ; } - rtc->periodic_irq = ret; - rtc->carry_irq =platform_get_irq (pdev,1 ); - rtc->alarm_irq =platform_get_irq (pdev,2 ); +if (!pdev->dev.of_node) { + rtc->periodic_irq = ret; + rtc->carry_irq =platform_get_irq (pdev,1 ); + rtc->alarm_irq =platform_get_irq (pdev,2 ); + }else { + rtc->alarm_irq = ret; + rtc->periodic_irq =platform_get_irq (pdev,1 ); + rtc->carry_irq =platform_get_irq (pdev,2 ); + } res =platform_get_resource (pdev,IORESOURCE_IO ,0 );if (!res)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 222/356 PCI: Print the actual delay time in pci_bridge_wait_for_secondary_bus()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wilfred Mallawa <[email protected]>
[ Upstream commit d24eba726aadf8778f2907dd42281c6380b0ccaa ]
Print the delay amount that pcie_wait_for_link_delay() is invoked with instead of the hardcoded 1000ms value in the debug info print.
--- drivers/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci.c +1 -1
@@ -5221,7 +5221,7 @@ int pci_bridge_wait_for_secondary_bus(struct pci_dev *dev, char *reset_type) delay);if (!pcie_wait_for_link_delay (dev, true, delay)) {/* Did not train, no need to wait any further */ -pci_info (dev,"Data Link Layer Link Active not set in 1000 msec\n" ); +pci_info (dev,"Data Link Layer Link Active not set in %d msec\n" , delay);return -ENOTTY ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 223/356 PCI: cadence: Fix runtime atomic count underflow
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Zhang <[email protected]>
[ Upstream commit 8805f32a96d3b97cef07999fa6f52112678f7e65 ]
If the call to pci_host_probe() in cdns_pcie_host_setup() fails, PM runtime count is decremented in the error path using pm_runtime_put_sync(). But the runtime count is not incremented by this driver, but only by the callers (cdns_plat_pcie_probe/j721e_pcie_probe). And the callers also decrement the runtime PM count in their error path. So this leads to the below warning from the PM core:
"runtime PM usage count underflow!"
So fix it by getting rid of pm_runtime_put_sync() in the error path and directly return the errno.
--- drivers/pci/controller/cadence/pcie-cadence-host.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/pci/controller/cadence/pcie-cadence-host.c +1 -10
@@ -570,14 +570,5 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)if (!bridge->ops) bridge->ops = &cdns_pcie_host_ops; - ret =pci_host_probe (bridge); -if (ret <0 ) - goto err_init; - -return 0 ; - - err_init: -pm_runtime_put_sync (dev); - -return ret; +return pci_host_probe (bridge); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 224/356 PCI: apple: Use gpiod_set_value_cansleep in probe flow
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hector Martin <[email protected]>
[ Upstream commit 7334364f9de79a9a236dd0243ba574b8d2876e89 ]
We're allowed to sleep here, so tell the GPIO core by using gpiod_set_value_cansleep instead of gpiod_set_value.
--- drivers/pci/controller/pcie-apple.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/controller/pcie-apple.c +2 -2
@@ -541,7 +541,7 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,rmw_set (PORT_APPCLK_EN , port->base +PORT_APPCLK );/* Assert PERST# before setting up the clock */ -gpiod_set_value (reset,1 ); +gpiod_set_value_cansleep (reset,1 ); ret =apple_pcie_setup_refclk (pcie, port);if (ret <0 )
@@ -552,7 +552,7 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,/* Deassert PERST# */ rmw_set (PORT_PERST_OFF , port->base +PORT_PERST ); -gpiod_set_value (reset,0 ); +gpiod_set_value_cansleep (reset,0 );/* Wait for 100ms after PERST# deassertion (PCIe r5.0, 6.6.1) */ msleep (100 );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 225/356 PCI: Explicitly put devices into D0 when initializing
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit 4d4c10f763d7808fbade28d83d237411603bca05 ]
AMD BIOS team has root caused an issue that NVMe storage failed to come back from suspend to a lack of a call to _REG when NVMe device was probed.
112a7f9c8edbf ("PCI/ACPI: Call _REG when transitioning D-states") added support for calling _REG when transitioning D-states, but this only works if the device actually "transitions" D-states.
967577b062417 ("PCI/PM: Keep runtime PM enabled for unbound PCI devices") added support for runtime PM on PCI devices, but never actually 'explicitly' sets the device to D0.
To make sure that devices are in D0 and that platform methods such as _REG are called, explicitly set all devices into D0 during initialization.
--- drivers/pci/pci-driver.c | 6 ------ drivers/pci/pci.c | 13 ++++++++++--- drivers/pci/pci.h | 1 + 3 files changed, 11 insertions(+), 9 deletions(-)
drivers/pci/pci-driver.c +0 -6
@@ -564,12 +564,6 @@ static void pci_pm_default_resume(struct pci_dev *pci_dev)pci_enable_wake (pci_dev,PCI_D0 , false); } -static void pci_pm_power_up_and_verify_state (struct pci_dev *pci_dev) -{ -pci_power_up (pci_dev); -pci_update_current_state (pci_dev,PCI_D0 ); -} -static void pci_pm_default_resume_early (struct pci_dev *pci_dev) {pci_pm_power_up_and_verify_state (pci_dev);
drivers/pci/pci.c +10 -3
@@ -3227,6 +3227,12 @@ void pci_d3cold_disable(struct pci_dev *dev) }EXPORT_SYMBOL_GPL (pci_d3cold_disable); +void pci_pm_power_up_and_verify_state (struct pci_dev *pci_dev) +{ +pci_power_up (pci_dev); +pci_update_current_state (pci_dev,PCI_D0 ); +} +/** * pci_pm_init - Initialize PM functions of given PCI device * @dev: PCI device to handle.
@@ -3237,9 +3243,6 @@ void pci_pm_init(struct pci_dev *dev)u16 status;u16 pmc; -pm_runtime_forbid (&dev->dev); -pm_runtime_set_active (&dev->dev); -pm_runtime_enable (&dev->dev);device_enable_async_suspend (&dev->dev); dev->wakeup_prepared = false;
@@ -3301,6 +3304,10 @@ void pci_pm_init(struct pci_dev *dev)pci_read_config_word (dev,PCI_STATUS , &status);if (status &PCI_STATUS_IMM_READY ) dev->imm_ready =1 ; +pci_pm_power_up_and_verify_state (dev); +pm_runtime_forbid (&dev->dev); +pm_runtime_set_active (&dev->dev); +pm_runtime_enable (&dev->dev); }static unsigned long pci_ea_flags (struct pci_dev *dev,u8 prop)
drivers/pci/pci.h +1 -0
@@ -92,6 +92,7 @@ void pci_dev_adjust_pme(struct pci_dev *dev);void pci_dev_complete_resume (struct pci_dev *pci_dev);void pci_config_pm_runtime_get (struct pci_dev *dev);void pci_config_pm_runtime_put (struct pci_dev *dev); +void pci_pm_power_up_and_verify_state (struct pci_dev *pci_dev);void pci_pm_init (struct pci_dev *dev);void pci_ea_init (struct pci_dev *dev);void pci_msi_init (struct pci_dev *dev);
Signature · 1 line
2.39.5
Re: [PATCH 6.6 225/356] PCI: Explicitly put devices into D0 when initializing
Quoted 31 lines · Greg Kroah-Hartman
6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit
4d4c10f763d7808fbade28d83d237411603bca05]AMD BIOS team has root caused an issue that NVMe storage failed to come back from suspend to a lack of a call to
_REGwhen NVMe device was probed.
112a7f9c8edbf("PCI/ACPI: Call_REGwhen transitioning D-states") added support for calling_REGwhen transitioning D-states, but this only works if the device actually "transitions" D-states.
967577b062417("PCI/PM: Keep runtime PM enabled for unbound PCI devices") added support for runtime PM on PCI devices, but never actually 'explicitly' sets the device to D0.To make sure that devices are in D0 and that platform methods such as
_REGare called, explicitly set all devices into D0 during initialization.Fixes 967577b062417 ("PCI/PM: Keep runtime PM enabled for unbound PCI devices")Signed-off-by Mario Limonciello <[email protected]>Signed-off-by Bjorn Helgaas <[email protected]>Tested-by Denis Benato <[email protected]>Tested-by Yijun Shen <[email protected]>Tested-by David Perry <[email protected]>Reviewed-by Rafael J. Wysocki <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 1 line
---
I do think this should come back to stable, but I think we need to wait a stable cycle to pick it up so that it can come with this fix too.
https://lore.kernel.org/linux-pci/[email protected]/
Quoted 72 lines
drivers/pci/pci-driver.c | 6 ------ drivers/pci/pci.c | 13 ++++++++++--- drivers/pci/pci.h | 1 + 3 files changed, 11 insertions(+), 9 deletions(-)drivers/pci/pci-driver.c +0
-6@@ -564,12 +564,6 @@ static void pci_pm_default_resume(struct pci_dev *pci_dev)pci_enable_wake (pci_dev,PCI_D0 , false); } -static void pci_pm_power_up_and_verify_state (struct pci_dev *pci_dev) -{ -pci_power_up (pci_dev); -pci_update_current_state (pci_dev,PCI_D0 ); -} -static void pci_pm_default_resume_early (struct pci_dev *pci_dev) {pci_pm_power_up_and_verify_state (pci_dev);drivers/pci/pci.c +10
-3@@ -3227,6 +3227,12 @@ void pci_d3cold_disable(struct pci_dev *dev) }EXPORT_SYMBOL_GPL (pci_d3cold_disable); +void pci_pm_power_up_and_verify_state (struct pci_dev *pci_dev) +{ +pci_power_up (pci_dev); +pci_update_current_state (pci_dev,PCI_D0 ); +} +/** * pci_pm_init - Initialize PM functions of given PCI device * @dev: PCI device to handle. @@ -3237,9 +3243,6 @@ void pci_pm_init(struct pci_dev *dev)u16 status;u16 pmc; -pm_runtime_forbid (&dev->dev); -pm_runtime_set_active (&dev->dev); -pm_runtime_enable (&dev->dev);device_enable_async_suspend (&dev->dev); dev->wakeup_prepared = false;@@ -3301,6 +3304,10 @@ void pci_pm_init(struct pci_dev *dev)pci_read_config_word (dev,PCI_STATUS , &status);if (status &PCI_STATUS_IMM_READY ) dev->imm_ready =1 ; +pci_pm_power_up_and_verify_state (dev); +pm_runtime_forbid (&dev->dev); +pm_runtime_set_active (&dev->dev); +pm_runtime_enable (&dev->dev); }static unsigned long pci_ea_flags (struct pci_dev *dev,u8 prop)drivers/pci/pci.h +1
-0@@ -92,6 +92,7 @@ void pci_dev_adjust_pme(struct pci_dev *dev);void pci_dev_complete_resume (struct pci_dev *pci_dev);void pci_config_pm_runtime_get (struct pci_dev *dev);void pci_config_pm_runtime_put (struct pci_dev *dev); +void pci_pm_power_up_and_verify_state (struct pci_dev *pci_dev);void pci_pm_init (struct pci_dev *dev);void pci_ea_init (struct pci_dev *dev);void pci_msi_init (struct pci_dev *dev);
Greg Kroah-Hartman
maintainerPATCH 226/356 phy: qcom-qmp-usb: Fix an NULL vs IS_ERR() bug
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenyuan Yang <[email protected]>
[ Upstream commit d14402a38c2d868cacb1facaf9be908ca6558e59 ]
The qmp_usb_iomap() helper function currently returns the raw result of devm_ioremap() for non-exclusive mappings. Since devm_ioremap() may return a NULL pointer and the caller only checks error pointers with IS_ERR(), NULL could bypass the check and lead to an invalid dereference.
Fix the issue by checking if devm_ioremap() returns NULL. When it does, qmp_usb_iomap() now returns an error pointer via IOMEM_ERR_PTR(-ENOMEM), ensuring safe and consistent error handling.
--- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/phy/qualcomm/phy-qcom-qmp-usb.c +5 -1
@@ -2044,12 +2044,16 @@ static void __iomem *qmp_usb_iomap(struct device *dev, struct device_node *np, int index, bool exclusive) {struct resource res; +void __iomem *mem;if (!exclusive) {if (of_address_to_resource (np, index, &res))return IOMEM_ERR_PTR (-EINVAL ); -return devm_ioremap (dev, res.start,resource_size (&res)); + mem =devm_ioremap (dev, res.start,resource_size (&res)); +if (!mem) +return IOMEM_ERR_PTR (-ENOMEM ); +return mem; }return devm_of_iomap (dev, np, index,NULL );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 227/356 dmaengine: ti: Add NULL check in udma_probe()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henry Martin <[email protected]>
[ Upstream commit fd447415e74bccd7362f760d4ea727f8e1ebfe91 ]
devm_kasprintf() returns NULL when memory allocation fails. Currently, udma_probe() does not check for this case, which results in a NULL pointer dereference.
Add NULL check after devm_kasprintf() to prevent this issue.
--- drivers/dma/ti/k3-udma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/dma/ti/k3-udma.c +2 -1
@@ -5537,7 +5537,8 @@ static int udma_probe(struct platform_device *pdev) uc->config.dir =DMA_MEM_TO_MEM ; uc->name =devm_kasprintf (dev,GFP_KERNEL ,"%s chan%d" ,dev_name (dev), i); - +if (!uc->name) +return -ENOMEM ;vchan_init (&uc->vc, &ud->ddev);/* Use custom vchan completion handling */ tasklet_setup (&uc->vc.task, udma_vchan_complete);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 228/356 PCI/DPC: Initialize aer_err_info before using it
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
[ Upstream commit a424b598e6a6c1e69a2bb801d6fd16e805ab2c38 ]
Previously the struct aer_err_info "info" was allocated on the stack without being initialized, so it contained junk except for the fields we explicitly set later.
Initialize "info" at declaration so it starts as all zeros.
--- drivers/pci/pcie/dpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pcie/dpc.c +1 -1
@@ -263,7 +263,7 @@ static int dpc_get_aer_uncorrect_severity(struct pci_dev *dev,void dpc_process_error (struct pci_dev *pdev) {u16 cap = pdev->dpc_cap, status, source, reason, ext_reason; -struct aer_err_info info; +struct aer_err_info info = {};pci_read_config_word (pdev, cap +PCI_EXP_DPC_STATUS , &status);pci_read_config_word (pdev, cap +PCI_EXP_DPC_SOURCE_ID , &source);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 229/356 rtc: loongson: Add missing alarm notifications for ACPI RTC events
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Dalin <[email protected]>
[ Upstream commit 5af9f1fa576874b24627d4c05e3a84672204c200 ]
When an application sets and enables an alarm on Loongson RTC devices, the alarm notification fails to propagate to userspace because the ACPI event handler omits calling rtc_update_irq().
As a result, processes waiting via select() or poll() on RTC device files fail to receive alarm notifications.
The ACPI interrupt is also triggered multiple times. In loongson_rtc_handler, we need to clear TOY_MATCH0_REG to resolve this issue.
--- drivers/rtc/rtc-loongson.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/rtc/rtc-loongson.c +8 -0
@@ -129,6 +129,14 @@ static u32 loongson_rtc_handler(void *id) {struct loongson_rtc_priv *priv = (struct loongson_rtc_priv *)id; +rtc_update_irq (priv->rtcdev,1 ,RTC_AF |RTC_IRQF ); + +/* +* The TOY_MATCH0_REG should be cleared 0 here, +* otherwise the interrupt cannot be cleared. +*/ +regmap_write (priv->regmap,TOY_MATCH0_REG ,0 ); +spin_lock (&priv->lock);/* Disable RTC alarm wakeup and interrupt */ writel(readl(priv->pm_base + PM1_EN_REG) & ~RTC_EN,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 230/356 usb: renesas_usbhs: Reorder clock handling and power management in probe
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit ffb34a60ce86656ba12d46e91f1ccc71dd221251 ]
Reorder the initialization sequence in usbhs_probe() to enable runtime PM before accessing registers, preventing potential crashes due to uninitialized clocks.
Currently, in the probe path, registers are accessed before enabling the clocks, leading to a synchronous external abort on the RZ/V2H SoC. The problematic call flow is as follows:
usbhs_probe()
usbhs_sys_clock_ctrl()
usbhs_bset()
usbhs_write()
iowrite16() <-- Register access before enabling clocks
Since iowrite16() is performed without ensuring the required clocks are enabled, this can lead to access errors. To fix this, enable PM runtime early in the probe function and ensure clocks are acquired before register access, preventing crashes like the following on RZ/V2H:
[13.272640] Internal error: synchronous external abort: 0000000096000010 [#1] PREEMPT SMP [13.280814] Modules linked in: cec renesas_usbhs(+) drm_kms_helper fuse drm backlight ipv6 [13.289088] CPU: 1 UID: 0 PID: 195 Comm: (udev-worker) Not tainted 6.14.0-rc7+ #98 [13.296640] Hardware name: Renesas RZ/V2H EVK Board based on r9a09g057h44 (DT) [13.303834] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [13.310770] pc : usbhs_bset+0x14/0x4c [renesas_usbhs] [13.315831] lr : usbhs_probe+0x2e4/0x5ac [renesas_usbhs] [13.321138] sp : ffff8000827e3850 [13.324438] x29: ffff8000827e3860 x28: 0000000000000000 x27: ffff8000827e3ca0 [13.331554] x26: ffff8000827e3ba0 x25: ffff800081729668 x24: 0000000000000025 [13.338670] x23: ffff0000c0f08000 x22: 0000000000000000 x21: ffff0000c0f08010 [13.345783] x20: 0000000000000000 x19: ffff0000c3b52080 x18: 00000000ffffffff [13.352895] x17: 0000000000000000 x16: 0000000000000000 x15: ffff8000827e36ce [13.360009] x14: 00000000000003d7 x13: 00000000000003d7 x12: 0000000000000000 [13.367122] x11: 0000000000000000 x10: 0000000000000aa0 x9 : ffff8000827e3750 [13.374235] x8 : ffff0000c1850b00 x7 : 0000000003826060 x6 : 000000000000001c [13.381347] x5 : 000000030d5fcc00 x4 : ffff8000825c0000 x3 : 0000000000000000 [13.388459] x2 : 0000000000000400 x1 : 0000000000000000 x0 : ffff0000c3b52080 [13.395574] Call trace: [13.398013] usbhs_bset+0x14/0x4c [renesas_usbhs] (P) [13.403076] platform_probe+0x68/0xdc [13.406738] really_probe+0xbc/0x2c0 [13.410306] __driver_probe_device+0x78/0x120 [13.414653] driver_probe_device+0x3c/0x154 [13.418825] __driver_attach+0x90/0x1a0 [13.422647] bus_for_each_dev+0x7c/0xe0 [13.426470] driver_attach+0x24/0x30 [13.430032] bus_add_driver+0xe4/0x208 [13.433766] driver_register+0x68/0x130 [13.437587] __platform_driver_register+0x24/0x30 [13.442273] renesas_usbhs_driver_init+0x20/0x1000 [renesas_usbhs] [13.448450] do_one_initcall+0x60/0x1d4 [13.452276] do_init_module+0x54/0x1f8 [13.456014] load_module+0x1754/0x1c98 [13.459750] init_module_from_file+0x88/0xcc [13.464004] __arm64_sys_finit_module+0x1c4/0x328 [13.468689] invoke_syscall+0x48/0x104 [13.472426] el0_svc_common.constprop.0+0xc0/0xe0 [13.477113] do_el0_svc+0x1c/0x28 [13.480415] el0_svc+0x30/0xcc [13.483460] el0t_64_sync_handler+0x10c/0x138 [13.487800] el0t_64_sync+0x198/0x19c [13.491453] Code: 2a0103e1 12003c42 12003c63 8b010084 (79400084) [13.497522] ---[ end trace 0000000000000000 ]---
--- drivers/usb/renesas_usbhs/common.c | 50 +++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 12 deletions(-)
drivers/usb/renesas_usbhs/common.c +38 -12
@@ -674,10 +674,29 @@ static int usbhs_probe(struct platform_device *pdev)INIT_DELAYED_WORK (&priv->notify_hotplug_work, usbhsc_notify_hotplug);spin_lock_init (usbhs_priv_to_lock (priv)); +/* +* Acquire clocks and enable power management (PM) early in the +* probe process, as the driver accesses registers during +* initialization. Ensure the device is active before proceeding. +*/ +pm_runtime_enable (dev); + + ret =usbhsc_clk_get (dev, priv); +if (ret) + goto probe_pm_disable; + + ret =pm_runtime_resume_and_get (dev); +if (ret) + goto probe_clk_put; + + ret =usbhsc_clk_prepare_enable (priv); +if (ret) + goto probe_pm_put; +/* call pipe and module init */ ret =usbhs_pipe_probe (priv);if (ret <0 ) -return ret; + goto probe_clk_dis_unprepare; ret =usbhs_fifo_probe (priv);if (ret <0 )
@@ -694,10 +713,6 @@ static int usbhs_probe(struct platform_device *pdev)if (ret) goto probe_fail_rst; - ret =usbhsc_clk_get (dev, priv); -if (ret) - goto probe_fail_clks; -/* * deviece reset here because * USB device might be used in boot loader.
@@ -710,7 +725,7 @@ static int usbhs_probe(struct platform_device *pdev)if (ret) {dev_warn (dev,"USB function not selected (GPIO)\n" ); ret = -ENOTSUPP ; - goto probe_end_mod_exit; + goto probe_assert_rest; } }
@@ -724,14 +739,19 @@ static int usbhs_probe(struct platform_device *pdev) ret =usbhs_platform_call (priv, hardware_init, pdev);if (ret <0 ) {dev_err (dev,"platform init failed.\n" ); - goto probe_end_mod_exit; + goto probe_assert_rest; }/* reset phy for connection */ usbhs_platform_call (priv, phy_reset, pdev); -/* power control */ -pm_runtime_enable (dev); +/* +* Disable the clocks that were enabled earlier in the probe path, +* and let the driver handle the clocks beyond this point. +*/ +usbhsc_clk_disable_unprepare (priv); +pm_runtime_put (dev); +if (!usbhs_get_dparam (priv, runtime_pwctrl)) {usbhsc_power_ctrl (priv,1 );usbhs_mod_autonomy_mode (priv);
@@ -748,9 +768,7 @@ static int usbhs_probe(struct platform_device *pdev)return ret; -probe_end_mod_exit: -usbhsc_clk_put (priv); -probe_fail_clks: +probe_assert_rest:reset_control_assert (priv->rsts); probe_fail_rst:usbhs_mod_remove (priv);
@@ -758,6 +776,14 @@ static int usbhs_probe(struct platform_device *pdev)usbhs_fifo_remove (priv); probe_end_pipe_exit:usbhs_pipe_remove (priv); +probe_clk_dis_unprepare: +usbhsc_clk_disable_unprepare (priv); +probe_pm_put: +pm_runtime_put (dev); +probe_clk_put: +usbhsc_clk_put (priv); +probe_pm_disable: +pm_runtime_disable (dev);dev_info (dev,"probe failed (%d)\n" , ret);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 231/356 serial: Fix potential null-ptr-deref in mlb_usio_probe()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henry Martin <[email protected]>
[ Upstream commit 86bcae88c9209e334b2f8c252f4cc66beb261886 ]
devm_ioremap() can return NULL on error. Currently, mlb_usio_probe() does not check for this case, which could result in a NULL pointer dereference.
Add NULL check after devm_ioremap() to prevent this issue.
--- drivers/tty/serial/milbeaut_usio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/tty/serial/milbeaut_usio.c +4 -1
@@ -522,7 +522,10 @@ static int mlb_usio_probe(struct platform_device *pdev) } port->membase =devm_ioremap (&pdev->dev, res->start,resource_size (res)); - +if (!port->membase) { + ret = -ENOMEM ; + goto failed; + } ret =platform_get_irq_byname (pdev,"rx" ); mlb_usio_irq[index][RX ] = ret;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 232/356 thunderbolt: Fix a logic error in wake on connect
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit 1a760d10ded372d113a0410c42be246315bbc2ff ]
commit a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports") introduced a sysfs file to control wake up policy for a given USB4 port that defaulted to disabled.
However when testing commit 4bfeea6ec1c02 ("thunderbolt: Use wake on connect and disconnect over suspend") I found that it was working even without making changes to the power/wakeup file (which defaults to disabled). This is because of a logic error doing a bitwise or of the wake-on-connect flag with device_may_wakeup() which should have been a logical AND.
Adjust the logic so that policy is only applied when wakeup is actually enabled.
--- drivers/thunderbolt/usb4.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thunderbolt/usb4.c +2 -2
@@ -442,10 +442,10 @@ int usb4_switch_set_wake(struct tb_switch *sw, unsigned int flags)bool configured = val &PORT_CS_19_PC ; usb4 = port->usb4; -if (((flags &TB_WAKE_ON_CONNECT ) | +if (((flags &TB_WAKE_ON_CONNECT ) &&device_may_wakeup (&usb4->dev)) && !configured) val |=PORT_CS_19_WOC ; -if (((flags &TB_WAKE_ON_DISCONNECT ) | +if (((flags &TB_WAKE_ON_DISCONNECT ) &&device_may_wakeup (&usb4->dev)) && configured) val |=PORT_CS_19_WOD ;if ((flags &TB_WAKE_ON_USB4 ) && configured)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 233/356 iio: filter: admv8818: fix band 4, state 15
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sam Winchenbach <[email protected]>
[ Upstream commit ef0ce24f590ac075d5eda11f2d6434b303333ed6 ]
Corrects the upper range of LPF Band 4 from 18.5 GHz to 18.85 GHz per the ADMV8818 datasheet
--- drivers/iio/filter/admv8818.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/filter/admv8818.c +1 -1
@@ -103,7 +103,7 @@ static const unsigned long long freq_range_lpf[4][2] = { {2050000000ULL, 3850000000ULL}, {3350000000ULL, 7250000000ULL}, {7000000000, 13000000000}, - {12550000000, 18500000000} + {12550000000, 18850000000} };static const struct regmap_config admv8818_regmap_config = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 234/356 iio: filter: admv8818: fix integer overflow
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sam Winchenbach <[email protected]>
[ Upstream commit fb6009a28d77edec4eb548b5875dae8c79b88467 ]
HZ_PER_MHZ is only unsigned long. This math overflows, leading to incorrect results.
--- drivers/iio/filter/admv8818.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/filter/admv8818.c +1 -1
@@ -154,7 +154,7 @@ static int __admv8818_hpf_select(struct admv8818_state *st, u64 freq) }/* Close HPF frequency gap between 12 and 12.5 GHz */ -if (freq >=12000 *HZ_PER_MHZ && freq <=12500 *HZ_PER_MHZ ) { +if (freq >=12000ULL *HZ_PER_MHZ && freq <12500ULL *HZ_PER_MHZ ) { hpf_band =3 ; hpf_step =15 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 235/356 iio: filter: admv8818: fix range calculation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sam Winchenbach <[email protected]>
[ Upstream commit d542db7095d322bfcdc8e306db6f8c48358c9619 ]
Search for the minimum error while ensuring that the LPF corner frequency is greater than the target, and the HPF corner frequency is lower than the target
This fixes issues where the range calculations were suboptimal.
Add two new DTS properties to set the margin between the input frequency and the calculated corner frequency
Below is a generated table of the differences between the old algorithm and the new. This is a sweep from 0 to 20 GHz in 10 MHz steps. === HPF ===
freq = 1750 MHz, 3db: bypass => 1750 MHz
freq = 3400 MHz, 3db: 3310 => 3400 MHz
freq = 3410 MHz, 3db: 3310 => 3400 MHz
freq = 3420 MHz, 3db: 3310 => 3400 MHz
freq = 3660 MHz, 3db: 3550 => 3656 MHz
freq = 6600 MHz, 3db: 6479 => 6600 MHz
freq = 6610 MHz, 3db: 6479 => 6600 MHz
freq = 6620 MHz, 3db: 6479 => 6600 MHz
freq = 6630 MHz, 3db: 6479 => 6600 MHz
freq = 6640 MHz, 3db: 6479 => 6600 MHz
freq = 6650 MHz, 3db: 6479 => 6600 MHz
freq = 6660 MHz, 3db: 6479 => 6600 MHz
freq = 6670 MHz, 3db: 6479 => 6600 MHz
freq = 6680 MHz, 3db: 6479 => 6600 MHz
freq = 6690 MHz, 3db: 6479 => 6600 MHz
freq = 6700 MHz, 3db: 6479 => 6600 MHz
freq = 6710 MHz, 3db: 6479 => 6600 MHz
freq = 6720 MHz, 3db: 6479 => 6600 MHz
freq = 6730 MHz, 3db: 6479 => 6600 MHz
freq = 6960 MHz, 3db: 6736 => 6960 MHz
freq = 6970 MHz, 3db: 6736 => 6960 MHz
freq = 6980 MHz, 3db: 6736 => 6960 MHz
freq = 6990 MHz, 3db: 6736 => 6960 MHz
freq = 7320 MHz, 3db: 7249 => 7320 MHz
freq = 7330 MHz, 3db: 7249 => 7320 MHz
freq = 7340 MHz, 3db: 7249 => 7320 MHz
freq = 7350 MHz, 3db: 7249 => 7320 MHz
freq = 7360 MHz, 3db: 7249 => 7320 MHz
freq = 7370 MHz, 3db: 7249 => 7320 MHz
freq = 7380 MHz, 3db: 7249 => 7320 MHz
freq = 7390 MHz, 3db: 7249 => 7320 MHz
freq = 7400 MHz, 3db: 7249 => 7320 MHz
freq = 7410 MHz, 3db: 7249 => 7320 MHz
freq = 7420 MHz, 3db: 7249 => 7320 MHz
freq = 7430 MHz, 3db: 7249 => 7320 MHz
freq = 7440 MHz, 3db: 7249 => 7320 MHz
freq = 7450 MHz, 3db: 7249 => 7320 MHz
freq = 7460 MHz, 3db: 7249 => 7320 MHz
freq = 7470 MHz, 3db: 7249 => 7320 MHz
freq = 7480 MHz, 3db: 7249 => 7320 MHz
freq = 7490 MHz, 3db: 7249 => 7320 MHz
freq = 7500 MHz, 3db: 7249 => 7320 MHz
freq = 12500 MHz, 3db: 12000 => 12500 MHz
=== LPF ===
freq = 2050 MHz, 3db: bypass => 2050 MHz freq = 2170 MHz, 3db: 2290 => 2170 MHz freq = 2290 MHz, 3db: 2410 => 2290 MHz freq = 2410 MHz, 3db: 2530 => 2410 MHz freq = 2530 MHz, 3db: 2650 => 2530 MHz freq = 2650 MHz, 3db: 2770 => 2650 MHz freq = 2770 MHz, 3db: 2890 => 2770 MHz freq = 2890 MHz, 3db: 3010 => 2890 MHz freq = 3010 MHz, 3db: 3130 => 3010 MHz freq = 3130 MHz, 3db: 3250 => 3130 MHz freq = 3250 MHz, 3db: 3370 => 3250 MHz freq = 3260 MHz, 3db: 3370 => 3350 MHz freq = 3270 MHz, 3db: 3370 => 3350 MHz freq = 3280 MHz, 3db: 3370 => 3350 MHz freq = 3290 MHz, 3db: 3370 => 3350 MHz freq = 3300 MHz, 3db: 3370 => 3350 MHz freq = 3310 MHz, 3db: 3370 => 3350 MHz freq = 3320 MHz, 3db: 3370 => 3350 MHz freq = 3330 MHz, 3db: 3370 => 3350 MHz freq = 3340 MHz, 3db: 3370 => 3350 MHz freq = 3350 MHz, 3db: 3370 => 3350 MHz freq = 3370 MHz, 3db: 3490 => 3370 MHz freq = 3490 MHz, 3db: 3610 => 3490 MHz freq = 3610 MHz, 3db: 3730 => 3610 MHz freq = 3730 MHz, 3db: 3850 => 3730 MHz freq = 3850 MHz, 3db: 3870 => 3850 MHz freq = 3870 MHz, 3db: 4130 => 3870 MHz freq = 4130 MHz, 3db: 4390 => 4130 MHz freq = 4390 MHz, 3db: 4650 => 4390 MHz freq = 4650 MHz, 3db: 4910 => 4650 MHz freq = 4910 MHz, 3db: 5170 => 4910 MHz freq = 5170 MHz, 3db: 5430 => 5170 MHz freq = 5430 MHz, 3db: 5690 => 5430 MHz freq = 5690 MHz, 3db: 5950 => 5690 MHz freq = 5950 MHz, 3db: 6210 => 5950 MHz freq = 6210 MHz, 3db: 6470 => 6210 MHz freq = 6470 MHz, 3db: 6730 => 6470 MHz freq = 6730 MHz, 3db: 6990 => 6730 MHz freq = 6990 MHz, 3db: 7250 => 6990 MHz freq = 7000 MHz, 3db: 7250 => 7000 MHz freq = 7250 MHz, 3db: 7400 => 7250 MHz freq = 7400 MHz, 3db: 7800 => 7400 MHz freq = 7800 MHz, 3db: 8200 => 7800 MHz freq = 8200 MHz, 3db: 8600 => 8200 MHz freq = 8600 MHz, 3db: 9000 => 8600 MHz freq = 9000 MHz, 3db: 9400 => 9000 MHz freq = 9400 MHz, 3db: 9800 => 9400 MHz freq = 9800 MHz, 3db: 10200 => 9800 MHz freq = 10200 MHz, 3db: 10600 => 10200 MHz freq = 10600 MHz, 3db: 11000 => 10600 MHz freq = 11000 MHz, 3db: 11400 => 11000 MHz freq = 11400 MHz, 3db: 11800 => 11400 MHz freq = 11800 MHz, 3db: 12200 => 11800 MHz freq = 12200 MHz, 3db: 12600 => 12200 MHz freq = 12210 MHz, 3db: 12600 => 12550 MHz freq = 12220 MHz, 3db: 12600 => 12550 MHz freq = 12230 MHz, 3db: 12600 => 12550 MHz freq = 12240 MHz, 3db: 12600 => 12550 MHz freq = 12250 MHz, 3db: 12600 => 12550 MHz freq = 12260 MHz, 3db: 12600 => 12550 MHz freq = 12270 MHz, 3db: 12600 => 12550 MHz freq = 12280 MHz, 3db: 12600 => 12550 MHz freq = 12290 MHz, 3db: 12600 => 12550 MHz freq = 12300 MHz, 3db: 12600 => 12550 MHz freq = 12310 MHz, 3db: 12600 => 12550 MHz freq = 12320 MHz, 3db: 12600 => 12550 MHz freq = 12330 MHz, 3db: 12600 => 12550 MHz freq = 12340 MHz, 3db: 12600 => 12550 MHz freq = 12350 MHz, 3db: 12600 => 12550 MHz freq = 12360 MHz, 3db: 12600 => 12550 MHz freq = 12370 MHz, 3db: 12600 => 12550 MHz freq = 12380 MHz, 3db: 12600 => 12550 MHz freq = 12390 MHz, 3db: 12600 => 12550 MHz freq = 12400 MHz, 3db: 12600 => 12550 MHz freq = 12410 MHz, 3db: 12600 => 12550 MHz freq = 12420 MHz, 3db: 12600 => 12550 MHz freq = 12430 MHz, 3db: 12600 => 12550 MHz freq = 12440 MHz, 3db: 12600 => 12550 MHz freq = 12450 MHz, 3db: 12600 => 12550 MHz freq = 12460 MHz, 3db: 12600 => 12550 MHz freq = 12470 MHz, 3db: 12600 => 12550 MHz freq = 12480 MHz, 3db: 12600 => 12550 MHz freq = 12490 MHz, 3db: 12600 => 12550 MHz freq = 12500 MHz, 3db: 12600 => 12550 MHz freq = 12510 MHz, 3db: 12600 => 12550 MHz freq = 12520 MHz, 3db: 12600 => 12550 MHz freq = 12530 MHz, 3db: 12600 => 12550 MHz freq = 12540 MHz, 3db: 12600 => 12550 MHz freq = 12550 MHz, 3db: 12600 => 12550 MHz freq = 12600 MHz, 3db: 13000 => 12600 MHz freq = 12610 MHz, 3db: 13000 => 12970 MHz freq = 12620 MHz, 3db: 13000 => 12970 MHz freq = 12630 MHz, 3db: 13000 => 12970 MHz freq = 12640 MHz, 3db: 13000 => 12970 MHz freq = 12650 MHz, 3db: 13000 => 12970 MHz freq = 12660 MHz, 3db: 13000 => 12970 MHz freq = 12670 MHz, 3db: 13000 => 12970 MHz freq = 12680 MHz, 3db: 13000 => 12970 MHz freq = 12690 MHz, 3db: 13000 => 12970 MHz freq = 12700 MHz, 3db: 13000 => 12970 MHz freq = 12710 MHz, 3db: 13000 => 12970 MHz freq = 12720 MHz, 3db: 13000 => 12970 MHz freq = 12730 MHz, 3db: 13000 => 12970 MHz freq = 12740 MHz, 3db: 13000 => 12970 MHz freq = 12750 MHz, 3db: 13000 => 12970 MHz freq = 12760 MHz, 3db: 13000 => 12970 MHz freq = 12770 MHz, 3db: 13000 => 12970 MHz freq = 12780 MHz, 3db: 13000 => 12970 MHz freq = 12790 MHz, 3db: 13000 => 12970 MHz freq = 12800 MHz, 3db: 13000 => 12970 MHz freq = 12810 MHz, 3db: 13000 => 12970 MHz freq = 12820 MHz, 3db: 13000 => 12970 MHz freq = 12830 MHz, 3db: 13000 => 12970 MHz freq = 12840 MHz, 3db: 13000 => 12970 MHz freq = 12850 MHz, 3db: 13000 => 12970 MHz freq = 12860 MHz, 3db: 13000 => 12970 MHz freq = 12870 MHz, 3db: 13000 => 12970 MHz freq = 12880 MHz, 3db: 13000 => 12970 MHz freq = 12890 MHz, 3db: 13000 => 12970 MHz freq = 12900 MHz, 3db: 13000 => 12970 MHz freq = 12910 MHz, 3db: 13000 => 12970 MHz freq = 12920 MHz, 3db: 13000 => 12970 MHz freq = 12930 MHz, 3db: 13000 => 12970 MHz freq = 12940 MHz, 3db: 13000 => 12970 MHz freq = 12950 MHz, 3db: 13000 => 12970 MHz freq = 12960 MHz, 3db: 13000 => 12970 MHz freq = 12970 MHz, 3db: 13000 => 12970 MHz freq = 13000 MHz, 3db: 13390 => 13000 MHz freq = 13390 MHz, 3db: 13810 => 13390 MHz freq = 13810 MHz, 3db: 14230 => 13810 MHz freq = 14230 MHz, 3db: 14650 => 14230 MHz freq = 14650 MHz, 3db: 15070 => 14650 MHz freq = 15070 MHz, 3db: 15490 => 15070 MHz freq = 15490 MHz, 3db: 15910 => 15490 MHz freq = 15910 MHz, 3db: 16330 => 15910 MHz freq = 16330 MHz, 3db: 16750 => 16330 MHz freq = 16750 MHz, 3db: 17170 => 16750 MHz freq = 17170 MHz, 3db: 17590 => 17170 MHz freq = 17590 MHz, 3db: 18010 => 17590 MHz freq = 18010 MHz, 3db: 18430 => 18010 MHz freq = 18430 MHz, 3db: 18850 => 18430 MHz freq = 18850 MHz, 3db: bypass => 18850 MHz
--- drivers/iio/filter/admv8818.c | 205 +++++++++++++++++++++++++--------- 1 file changed, 152 insertions(+), 53 deletions(-)
drivers/iio/filter/admv8818.c +152 -53
@@ -14,6 +14,7 @@#include <linux/mod_devicetable.h> #include <linux/mutex.h> #include <linux/notifier.h> +#include <linux/property.h> #include <linux/regmap.h> #include <linux/spi/spi.h> #include <linux/units.h>
@@ -70,6 +71,16 @@#define ADMV8818_HPF_WR0_MSK GENMASK(7, 4)#define ADMV8818_LPF_WR0_MSK GENMASK(3, 0) +#define ADMV8818_BAND_BYPASS 0 +#define ADMV8818_BAND_MIN 1 +#define ADMV8818_BAND_MAX 4 +#define ADMV8818_BAND_CORNER_LOW 0 +#define ADMV8818_BAND_CORNER_HIGH 1 + +#define ADMV8818_STATE_MIN 0 +#define ADMV8818_STATE_MAX 15 +#define ADMV8818_NUM_STATES 16 +enum {ADMV8818_BW_FREQ ,ADMV8818_CENTER_FREQ
@@ -90,16 +101,20 @@ struct admv8818_state {struct mutex lock;unsigned int filter_mode;u64 cf_hz; +u64 lpf_margin_hz; +u64 hpf_margin_hz; }; -static const unsigned long long freq_range_hpf[4 ][2 ] = { +static const unsigned long long freq_range_hpf[5 ][2 ] = { + {0ULL ,0ULL },/* bypass */ {1750000000ULL ,3550000000ULL }, {3400000000ULL ,7250000000ULL }, {6600000000 ,12000000000 }, {12500000000 ,19900000000 } }; -static const unsigned long long freq_range_lpf[4 ][2 ] = { +static const unsigned long long freq_range_lpf[5 ][2 ] = { + {U64_MAX ,U64_MAX },/* bypass */ {2050000000ULL ,3850000000ULL }, {3350000000ULL ,7250000000ULL }, {7000000000 ,13000000000 },
@@ -121,44 +136,59 @@ static const char * const admv8818_modes[] = {static int __admv8818_hpf_select (struct admv8818_state *st,u64 freq) { -unsigned int hpf_step =0 , hpf_band =0 , i, j; -u64 freq_step; -int ret; +int band, state, ret; +unsigned int hpf_state =ADMV8818_STATE_MIN , hpf_band =ADMV8818_BAND_BYPASS ; +u64 freq_error, min_freq_error, freq_corner, freq_step; -if (freq < freq_range_hpf[0 ][0 ]) +if (freq < freq_range_hpf[ADMV8818_BAND_MIN ][ADMV8818_BAND_CORNER_LOW ]) goto hpf_write; -if (freq > freq_range_hpf[3 ][1 ]) { - hpf_step =15 ; - hpf_band =4 ; - +if (freq >= freq_range_hpf[ADMV8818_BAND_MAX ][ADMV8818_BAND_CORNER_HIGH ]) { + hpf_state =ADMV8818_STATE_MAX ; + hpf_band =ADMV8818_BAND_MAX ; goto hpf_write; } -for (i =0 ; i <4 ; i++) { - freq_step =div_u64 ((freq_range_hpf[i][1 ] - - freq_range_hpf[i][0 ]),15 ); +/* Close HPF frequency gap between 12 and 12.5 GHz */ +if (freq >=12000ULL *HZ_PER_MHZ && freq <12500ULL *HZ_PER_MHZ ) { + hpf_state =ADMV8818_STATE_MAX ; + hpf_band =3 ; + goto hpf_write; + } -if (freq > freq_range_hpf[i][0 ] && - (freq < freq_range_hpf[i][1 ] + freq_step)) { - hpf_band = i +1 ; + min_freq_error =U64_MAX ; +for (band =ADMV8818_BAND_MIN ; band <=ADMV8818_BAND_MAX ; band++) { +/* +* This (and therefore all other ranges) have a corner +* frequency higher than the target frequency. +*/ +if (freq_range_hpf[band][ADMV8818_BAND_CORNER_LOW ] > freq) +break ; -for (j =1 ; j <=16 ; j++) { -if (freq < (freq_range_hpf[i][0 ] + (freq_step * j))) { - hpf_step = j -1 ; -break ; - } + freq_step = freq_range_hpf[band][ADMV8818_BAND_CORNER_HIGH ] - + freq_range_hpf[band][ADMV8818_BAND_CORNER_LOW ]; + freq_step =div_u64 (freq_step,ADMV8818_NUM_STATES -1 ); + +for (state =ADMV8818_STATE_MIN ; state <=ADMV8818_STATE_MAX ; state++) { + freq_corner = freq_range_hpf[band][ADMV8818_BAND_CORNER_LOW ] + + freq_step * state; + +/* +* This (and therefore all other states) have a corner +* frequency higher than the target frequency. +*/ +if (freq_corner > freq) +break ; + + freq_error = freq - freq_corner; +if (freq_error < min_freq_error) { + min_freq_error = freq_error; + hpf_state = state; + hpf_band = band; } -break ; } } -/* Close HPF frequency gap between 12 and 12.5 GHz */ -if (freq >=12000ULL *HZ_PER_MHZ && freq <12500ULL *HZ_PER_MHZ ) { - hpf_band =3 ; - hpf_step =15 ; - } - hpf_write: ret = regmap_update_bits(st->regmap, ADMV8818_REG_WR0_SW, ADMV8818_SW_IN_SET_WR0_MSK |
@@ -170,7 +200,7 @@ static int __admv8818_hpf_select(struct admv8818_state *st, u64 freq)return regmap_update_bits (st->regmap,ADMV8818_REG_WR0_FILTER ,ADMV8818_HPF_WR0_MSK , -FIELD_PREP (ADMV8818_HPF_WR0_MSK , hpf_step)); +FIELD_PREP (ADMV8818_HPF_WR0_MSK , hpf_state)); }static int admv8818_hpf_select (struct admv8818_state *st,u64 freq)
@@ -186,31 +216,52 @@ static int admv8818_hpf_select(struct admv8818_state *st, u64 freq)static int __admv8818_lpf_select (struct admv8818_state *st,u64 freq) { -unsigned int lpf_step =0 , lpf_band =0 , i, j; -u64 freq_step; -int ret; +int band, state, ret; +unsigned int lpf_state =ADMV8818_STATE_MIN , lpf_band =ADMV8818_BAND_BYPASS ; +u64 freq_error, min_freq_error, freq_corner, freq_step; -if (freq > freq_range_lpf[3 ][1 ]) +if (freq > freq_range_lpf[ADMV8818_BAND_MAX ][ADMV8818_BAND_CORNER_HIGH ]) goto lpf_write; -if (freq < freq_range_lpf[0 ][0 ]) { - lpf_band =1 ; - +if (freq < freq_range_lpf[ADMV8818_BAND_MIN ][ADMV8818_BAND_CORNER_LOW ]) { + lpf_state =ADMV8818_STATE_MIN ; + lpf_band =ADMV8818_BAND_MIN ; goto lpf_write; } -for (i =0 ; i <4 ; i++) { -if (freq > freq_range_lpf[i][0 ] && freq < freq_range_lpf[i][1 ]) { - lpf_band = i +1 ; - freq_step =div_u64 ((freq_range_lpf[i][1 ] - freq_range_lpf[i][0 ]),15 ); + min_freq_error =U64_MAX ; +for (band =ADMV8818_BAND_MAX ; band >=ADMV8818_BAND_MIN ; --band) { +/* +* At this point the highest corner frequency of +* all remaining ranges is below the target. +* LPF corner should be >= the target. +*/ +if (freq > freq_range_lpf[band][ADMV8818_BAND_CORNER_HIGH ]) +break ; + + freq_step = freq_range_lpf[band][ADMV8818_BAND_CORNER_HIGH ] - + freq_range_lpf[band][ADMV8818_BAND_CORNER_LOW ]; + freq_step =div_u64 (freq_step,ADMV8818_NUM_STATES -1 ); + +for (state =ADMV8818_STATE_MAX ; state >=ADMV8818_STATE_MIN ; --state) { -for (j =0 ; j <=15 ; j++) { -if (freq < (freq_range_lpf[i][0 ] + (freq_step * j))) { - lpf_step = j; -break ; - } + freq_corner = freq_range_lpf[band][ADMV8818_BAND_CORNER_LOW ] + + state * freq_step; + +/* +* At this point all other states in range will +* place the corner frequency below the target +* LPF corner should >= the target. +*/ +if (freq > freq_corner) +break ; + + freq_error = freq_corner - freq; +if (freq_error < min_freq_error) { + min_freq_error = freq_error; + lpf_state = state; + lpf_band = band; } -break ; } }
@@ -225,7 +276,7 @@ static int __admv8818_lpf_select(struct admv8818_state *st, u64 freq)return regmap_update_bits (st->regmap,ADMV8818_REG_WR0_FILTER ,ADMV8818_LPF_WR0_MSK , -FIELD_PREP (ADMV8818_LPF_WR0_MSK , lpf_step)); +FIELD_PREP (ADMV8818_LPF_WR0_MSK , lpf_state)); }static int admv8818_lpf_select (struct admv8818_state *st,u64 freq)
@@ -242,16 +293,28 @@ static int admv8818_lpf_select(struct admv8818_state *st, u64 freq)static int admv8818_rfin_band_select (struct admv8818_state *st) {int ret; +u64 hpf_corner_target, lpf_corner_target; st->cf_hz =clk_get_rate (st->clkin); +/* Check for underflow */ +if (st->cf_hz > st->hpf_margin_hz) + hpf_corner_target = st->cf_hz - st->hpf_margin_hz; +else + hpf_corner_target =0 ; + +/* Check for overflow */ + lpf_corner_target = st->cf_hz + st->lpf_margin_hz; +if (lpf_corner_target < st->cf_hz) + lpf_corner_target =U64_MAX ; +mutex_lock (&st->lock); - ret =__admv8818_hpf_select (st, st->cf_hz); + ret =__admv8818_hpf_select (st, hpf_corner_target);if (ret) goto exit; - ret =__admv8818_lpf_select (st, st->cf_hz); + ret =__admv8818_lpf_select (st, lpf_corner_target); exit:mutex_unlock (&st->lock);return ret;
@@ -278,8 +341,11 @@ static int __admv8818_read_hpf_freq(struct admv8818_state *st, u64 *hpf_freq) hpf_state =FIELD_GET (ADMV8818_HPF_WR0_MSK , data); - *hpf_freq =div_u64 (freq_range_hpf[hpf_band -1 ][1 ] - freq_range_hpf[hpf_band -1 ][0 ],15 ); - *hpf_freq = freq_range_hpf[hpf_band -1 ][0 ] + (*hpf_freq * hpf_state); + *hpf_freq = freq_range_hpf[hpf_band][ADMV8818_BAND_CORNER_HIGH ] - + freq_range_hpf[hpf_band][ADMV8818_BAND_CORNER_LOW ]; + *hpf_freq =div_u64 (*hpf_freq,ADMV8818_NUM_STATES -1 ); + *hpf_freq = freq_range_hpf[hpf_band][ADMV8818_BAND_CORNER_LOW ] + + (*hpf_freq * hpf_state);return ret; }
@@ -316,8 +382,11 @@ static int __admv8818_read_lpf_freq(struct admv8818_state *st, u64 *lpf_freq) lpf_state =FIELD_GET (ADMV8818_LPF_WR0_MSK , data); - *lpf_freq =div_u64 (freq_range_lpf[lpf_band -1 ][1 ] - freq_range_lpf[lpf_band -1 ][0 ],15 ); - *lpf_freq = freq_range_lpf[lpf_band -1 ][0 ] + (*lpf_freq * lpf_state); + *lpf_freq = freq_range_lpf[lpf_band][ADMV8818_BAND_CORNER_HIGH ] - + freq_range_lpf[lpf_band][ADMV8818_BAND_CORNER_LOW ]; + *lpf_freq =div_u64 (*lpf_freq,ADMV8818_NUM_STATES -1 ); + *lpf_freq = freq_range_lpf[lpf_band][ADMV8818_BAND_CORNER_LOW ] + + (*lpf_freq * lpf_state);return ret; }
@@ -641,6 +710,32 @@ static int admv8818_clk_setup(struct admv8818_state *st)return devm_add_action_or_reset (&spi->dev, admv8818_clk_notifier_unreg, st); } +static int admv8818_read_properties (struct admv8818_state *st) +{ +struct spi_device *spi = st->spi; +u32 mhz; +int ret; + + ret =device_property_read_u32 (&spi->dev,"adi,lpf-margin-mhz" , &mhz); +if (ret ==0 ) + st->lpf_margin_hz = (u64 )mhz *HZ_PER_MHZ ; +else if (ret == -EINVAL ) + st->lpf_margin_hz =0 ; +else +return ret; + + + ret =device_property_read_u32 (&spi->dev,"adi,hpf-margin-mhz" , &mhz); +if (ret ==0 ) + st->hpf_margin_hz = (u64 )mhz *HZ_PER_MHZ ; +else if (ret == -EINVAL ) + st->hpf_margin_hz =0 ; +else if (ret <0 ) +return ret; + +return 0 ; +} +static int admv8818_probe (struct spi_device *spi) {struct iio_dev *indio_dev;
@@ -672,6 +767,10 @@ static int admv8818_probe(struct spi_device *spi)mutex_init (&st->lock); + ret =admv8818_read_properties (st); +if (ret) +return ret; + ret =admv8818_init (st);if (ret)return ret;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 236/356 iio: filter: admv8818: Support frequencies >= 2^32
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Pellegrino <[email protected]>
[ Upstream commit 9016776f1301627de78a633bda7c898425a56572 ]
This patch allows writing u64 values to the ADMV8818's high and low-pass filter frequencies. It includes the following changes:
- Rejects negative frequencies in admv8818_write_raw.
- Adds a write_raw_get_fmt function to admv8818's iio_info, returning IIO_VAL_INT_64 for the high and low-pass filter 3dB frequency channels.
--- drivers/iio/filter/admv8818.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/iio/filter/admv8818.c +17 -0
@@ -402,6 +402,19 @@ static int admv8818_read_lpf_freq(struct admv8818_state *st, u64 *lpf_freq)return ret; } +static int admv8818_write_raw_get_fmt (struct iio_dev *indio_dev, +struct iio_chan_spec const *chan, +long mask) +{ +switch (mask) { +case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY : +case IIO_CHAN_INFO_HIGH_PASS_FILTER_3DB_FREQUENCY : +return IIO_VAL_INT_64 ; +default : +return -EINVAL ; + } +} +static int admv8818_write_raw (struct iio_dev *indio_dev,struct iio_chan_spec const *chan,int val,int val2,long info)
@@ -410,6 +423,9 @@ static int admv8818_write_raw(struct iio_dev *indio_dev,u64 freq = ((u64 )val2 <<32 | (u32 )val); +if ((s64 )freq <0 ) +return -EINVAL ; +switch (info) {case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY :return admv8818_lpf_select (st, freq);
@@ -571,6 +587,7 @@ static int admv8818_set_mode(struct iio_dev *indio_dev,static const struct iio_info admv8818_info = { .write_raw = admv8818_write_raw, + .write_raw_get_fmt = admv8818_write_raw_get_fmt, .read_raw = admv8818_read_raw, .debugfs_reg_access = &admv8818_reg_access, };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 237/356 iio: adc: ad7124: Fix 3dB filter frequency reading
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 8712e4986e7ce42a14c762c4c350f290989986a5 ]
The sinc4 filter has a factor 0.23 between Output Data Rate and f_{3dB} and for sinc3 the factor is 0.272 according to the data sheets for ad7124-4 (Rev. E.) and ad7124-8 (Rev. F).
--- drivers/iio/adc/ad7124.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ad7124.c +2 -2
@@ -300,9 +300,9 @@ static int ad7124_get_3db_filter_freq(struct ad7124_state *st,switch (st->channels[channel].cfg.filter_type) {case AD7124_SINC3_FILTER : -return DIV_ROUND_CLOSEST (fadc *230 ,1000 ); +return DIV_ROUND_CLOSEST (fadc *272 ,1000 );case AD7124_SINC4_FILTER : -return DIV_ROUND_CLOSEST (fadc *262 ,1000 ); +return DIV_ROUND_CLOSEST (fadc *230 ,1000 );default :return -EINVAL ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 238/356 MIPS: Loongson64: Add missing #interrupt-cells for loongson64c_ls7a
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: WangYuli <[email protected]>
[ Upstream commit 6d223b8ffcd1593d032b71875def2daa71c53111 ]
Similar to commit 98a9e2ac3755 ("MIPS: Loongson64: DTS: Fix msi node for ls7a").
Fix follow warnings:
arch/mips/boot/dts/loongson/loongson64c_4core_ls7a.dts:28.31-36.4: Warning (interrupt_provider): /bus@10000000/msi-controller@2ff00000: Missing '#interrupt-cells' in interrupt provider arch/mips/boot/dts/loongson/loongson64c_4core_ls7a.dtb: Warning (interrupt_map): Failed prerequisite 'interrupt_provider'
--- arch/mips/boot/dts/loongson/loongson64c_4core_ls7a.dts | 1 + 1 file changed, 1 insertion(+)
arch/mips/boot/dts/loongson/loongson64c_4core_ls7a.dts +1 -0
@@ -29,6 +29,7 @@ compatible = "loongson,pch-msi-1.0"; reg = <0 0x2ff00000 0 0x8>; interrupt-controller; + #interrupt-cells = <1>; msi-controller; loongson,msi-base-vec = <64>; loongson,msi-num-vecs = <64>;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 239/356 counter: interrupt-cnt: Protect enable/disable OPs with mutex
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Sverdlin <[email protected]>
[ Upstream commit 7351312632e831e51383f48957d47712fae791ef ]
Enable/disable seems to be racy on SMP, consider the following scenario:
CPU0 CPU1
interrupt_cnt_enable_write(true)
{
if (priv->enabled == enable)
return 0;
if (enable) {
priv->enabled = true;
interrupt_cnt_enable_write(false)
{
if (priv->enabled == enable)
return 0;
if (enable) {
priv->enabled = true;
enable_irq(priv->irq);
} else {
disable_irq(priv->irq)
priv->enabled = false;
}
enable_irq(priv->irq);
} else {
disable_irq(priv->irq);
priv->enabled = false;
}The above would result in priv->enabled == false, but IRQ left enabled. Protect both write (above race) and read (to propagate the value on SMP) callbacks with a mutex.
--- drivers/counter/interrupt-cnt.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/counter/interrupt-cnt.c +9 -0
@@ -3,12 +3,14 @@* Copyright (c) 2021 Pengutronix, Oleksij Rempel <[email protected]> */ +#include <linux/cleanup.h> #include <linux/counter.h> #include <linux/gpio/consumer.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/mod_devicetable.h> #include <linux/module.h> +#include <linux/mutex.h> #include <linux/platform_device.h> #include <linux/types.h>
@@ -19,6 +21,7 @@ struct interrupt_cnt_priv {struct gpio_desc *gpio;int irq;bool enabled; +struct mutex lock;struct counter_signal signals;struct counter_synapse synapses;struct counter_count cnts;
@@ -41,6 +44,8 @@ static int interrupt_cnt_enable_read(struct counter_device *counter, {struct interrupt_cnt_priv *priv =counter_priv (counter); +guard (mutex)(&priv->lock); + *enable = priv->enabled;return 0 ;
@@ -51,6 +56,8 @@ static int interrupt_cnt_enable_write(struct counter_device *counter, {struct interrupt_cnt_priv *priv =counter_priv (counter); +guard (mutex)(&priv->lock); +if (priv->enabled == enable)return 0 ;
@@ -227,6 +234,8 @@ static int interrupt_cnt_probe(struct platform_device *pdev)if (ret)return ret; +mutex_init (&priv->lock); + ret =devm_counter_add (dev, counter);if (ret <0 )return dev_err_probe (dev, ret,"Failed to add counter\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 240/356 fpga: fix potential null pointer deref in fpga_mgr_test_img_load_sgt()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qasim Ijaz <[email protected]>
[ Upstream commit 6ebf1982038af12f3588417e4fd0417d2551da28 ]
fpga_mgr_test_img_load_sgt() allocates memory for sgt using kunit_kzalloc() however it does not check if the allocation failed. It then passes sgt to sg_alloc_table(), which passes it to __sg_alloc_table(). This function calls memset() on sgt in an attempt to zero it out. If the allocation fails then sgt will be NULL and the memset will trigger a NULL pointer dereference.
Fix this by checking the allocation with KUNIT_ASSERT_NOT_ERR_OR_NULL().
--- drivers/fpga/tests/fpga-mgr-test.c | 1 + 1 file changed, 1 insertion(+)
drivers/fpga/tests/fpga-mgr-test.c +1 -0
@@ -253,6 +253,7 @@ static void fpga_mgr_test_img_load_sgt(struct kunit *test) img_buf =init_test_buffer (test,IMAGE_SIZE ); sgt =kunit_kzalloc (test,sizeof (*sgt),GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, sgt); ret =sg_alloc_table (sgt,1 ,GFP_KERNEL );KUNIT_ASSERT_EQ (test, ret,0 );sg_init_one (sgt->sgl, img_buf,IMAGE_SIZE );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 241/356 coresight: prevent deactivate active config while enabling the config
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yeoreum Yun <[email protected]>
[ Upstream commit 408c97c4a5e0b634dcd15bf8b8808b382e888164 ]
While enable active config via cscfg_csdev_enable_active_config(), active config could be deactivated via configfs' sysfs interface. This could make UAF issue in below scenario:
CPU0 CPU1
(sysfs enable) load module
cscfg_load_config_sets() activate config. // sysfs (sys_active_cnt == 1)
...cscfg_csdev_enable_active_config() lock(csdev->cscfg_csdev_lock)
// here load config activate by CPU1 unlock(csdev->cscfg_csdev_lock)
deactivate config // sysfs (sys_activec_cnt == 0) cscfg_unload_config_sets() unload module
// access to config_desc which freed
// while unloading module.cscfg_csdev_enable_config
To address this, use cscfg_config_desc's active_cnt as a reference count
which will be holded when
- activate the config.
- enable the activated config.
and put the module reference when config_active_cnt == 0.
--- .../hwtracing/coresight/coresight-config.h | 2 +- .../hwtracing/coresight/coresight-syscfg.c | 49 +++++++++++++------ 2 files changed, 35 insertions(+), 16 deletions(-)
drivers/hwtracing/coresight/coresight-config.h +1 -1
@@ -228,7 +228,7 @@ struct cscfg_feature_csdev {* @feats_csdev:references to the device features to enable. */ struct cscfg_config_csdev { -const struct cscfg_config_desc *config_desc; +struct cscfg_config_desc *config_desc;struct coresight_device *csdev;bool enabled;struct list_head node;
drivers/hwtracing/coresight/coresight-syscfg.c +34 -15
101 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 242/356 vt: remove VT_RESIZE and VT_RESIZEX from vt_compat_ioctl()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Pitre <[email protected]>
[ Upstream commit c4c7ead7b86c1e7f11c64915b7e5bb6d2e242691 ]
They are listed amon those cmd values that "treat 'arg' as an integer" which is wrong. They should instead fall into the default case. Probably nobody ever relied on that code since 2009 but still.
--- drivers/tty/vt/vt_ioctl.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/vt/vt_ioctl.c +0 -2
@@ -1105,8 +1105,6 @@ long vt_compat_ioctl(struct tty_struct *tty,case VT_WAITACTIVE :case VT_RELDISP :case VT_DISALLOCATE : -case VT_RESIZE : -case VT_RESIZEX :return vt_ioctl (tty, cmd, arg);/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 243/356 net: stmmac: platform: guarantee uniqueness of bus_id
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quentin Schulz <[email protected]>
[ Upstream commit eb7fd7aa35bfcc1e1fda4ecc42ccfcb526cdc780 ]
bus_id is currently derived from the ethernetX alias. If one is missing for the device, 0 is used. If ethernet0 points to another stmmac device or if there are 2+ stmmac devices without an ethernet alias, then bus_id will be 0 for all of those.
This is an issue because the bus_id is used to generate the mdio bus id (new_bus->id in drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c stmmac_mdio_register) and this needs to be unique.
This allows to avoid needing to define ethernet aliases for devices with multiple stmmac controllers (such as the Rockchip RK3588) for multiple stmmac devices to probe properly.
Obviously, the bus_id isn't guaranteed to be stable across reboots if no alias is set for the device but that is easily fixed by simply adding an alias if this is desired.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +9 -2
@@ -419,6 +419,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)struct device_node *np = pdev->dev.of_node;struct plat_stmmacenet_data *plat;struct stmmac_dma_cfg *dma_cfg; +static int bus_id = -ENODEV ;int phy_mode;void *ret;int rc;
@@ -454,8 +455,14 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)of_property_read_u32 (np,"max-speed" , &plat->max_speed); plat->bus_id =of_alias_get_id (np,"ethernet" ); -if (plat->bus_id <0 ) - plat->bus_id =0 ; +if (plat->bus_id <0 ) { +if (bus_id <0 ) + bus_id =of_alias_get_highest_id ("ethernet" ); +/* No ethernet alias found, init at -1 so first bus_id is 0 */ +if (bus_id <0 ) + bus_id =-1 ; + plat->bus_id = ++bus_id; + }/* Default to phy auto-detection */ plat->phy_addr =-1 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 244/356 gve: Fix RX_BUFFERS_POSTED stat to report per-queue fill_cnt
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alok Tiwari <[email protected]>
[ Upstream commit f41a94aade120dc60322865f363cee7865f2df01 ]
Previously, the RX_BUFFERS_POSTED stat incorrectly reported the fill_cnt from RX queue 0 for all queues, resulting in inaccurate per-queue statistics.
Fix this by correctly indexing priv->rx[idx].fill_cnt for each RX queue.
--- drivers/net/ethernet/google/gve/gve_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/google/gve/gve_main.c +1 -1
@@ -1992,7 +1992,7 @@ void gve_handle_report_stats(struct gve_priv *priv) }; stats[stats_idx++] = (struct stats ) { .stat_name =cpu_to_be32 (RX_BUFFERS_POSTED ), - .value =cpu_to_be64 (priv->rx[0 ].fill_cnt), + .value =cpu_to_be64 (priv->rx[idx].fill_cnt), .queue_id =cpu_to_be32 (idx), }; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 245/356 net: tipc: fix refcount warning in tipc_aead_encrypt
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charalampos Mitrodimas <[email protected]>
[ Upstream commit f29ccaa07cf3d35990f4d25028cc55470d29372b ]
syzbot reported a refcount warning [1] caused by calling get_net() on a network namespace that is being destroyed (refcount=0). This happens when a TIPC discovery timer fires during network namespace cleanup.
The recently added get_net() call in commit e279024617134 ("net/tipc:
fix slab-use-after-free Read in tipc_aead_encrypt_done") attempts to hold a reference to the network namespace. However, if the namespace is already being destroyed, its refcount might be zero, leading to the use-after-free warning.
Replace get_net() with maybe_get_net(), which safely checks if the refcount is non-zero before incrementing it. If the namespace is being destroyed, return -ENODEV early, after releasing the bearer reference.
[1]: https://lore.kernel.org/all/[email protected]/T/#m12019cf9ae77e1954f666914640efa36d52704a2
--- net/tipc/crypto.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/tipc/crypto.c +5 -1
@@ -818,7 +818,11 @@ static int tipc_aead_encrypt(struct tipc_aead *aead, struct sk_buff *skb, }/* Get net to avoid freed tipc_crypto when delete namespace */ -get_net (aead->crypto->net); +if (!maybe_get_net (aead->crypto->net)) { +tipc_bearer_put (b); + rc = -ENODEV ; + goto exit; + }/* Now, do encrypt */ rc =crypto_aead_encrypt (req);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 246/356 driver: net: ethernet: mtk_star_emac: fix suspend/resume issue
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yanqing Wang <[email protected]>
[ Upstream commit ba99c627aac85bc746fb4a6e2d79edb3ad100326 ]
Identify the cause of the suspend/resume hang: netif_carrier_off() is called during link state changes and becomes stuck while executing linkwatch_work().
To resolve this issue, call netif_device_detach() during the Ethernet suspend process to temporarily detach the network device from the kernel and prevent the suspend/resume hang.
--- drivers/net/ethernet/mediatek/mtk_star_emac.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/mediatek/mtk_star_emac.c +4 -0
@@ -1468,6 +1468,8 @@ static __maybe_unused int mtk_star_suspend(struct device *dev)if (netif_running (ndev))mtk_star_disable (ndev); +netif_device_detach (ndev); +clk_bulk_disable_unprepare (MTK_STAR_NCLKS , priv->clks);return 0 ;
@@ -1492,6 +1494,8 @@ static __maybe_unused int mtk_star_resume(struct device *dev)clk_bulk_disable_unprepare (MTK_STAR_NCLKS , priv->clks); } +netif_device_attach (ndev); +return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 247/356 net/mlx4_en: Prevent potential integer overflow calculating Hz
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 54d34165b4f786d7fea8412a18fb4a54c1eab623 ]
The "freq" variable is in terms of MHz and "max_val_cycles" is in terms of Hz. The fact that "max_val_cycles" is a u64 suggests that support for high frequency is intended but the "freq_khz * 1000" would overflow the u32 type if we went above 4GHz. Use unsigned long long type for the mutliplication to prevent that.
--- drivers/net/ethernet/mellanox/mlx4/en_clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx4/en_clock.c +1 -1
@@ -249,7 +249,7 @@ static const struct ptp_clock_info mlx4_en_ptp_clock_info = {static u32 freq_to_shift (u16 freq) {u32 freq_khz = freq *1000 ; -u64 max_val_cycles = freq_khz *1000 *MLX4_EN_WRAP_AROUND_SEC ; +u64 max_val_cycles = freq_khz *1000ULL *MLX4_EN_WRAP_AROUND_SEC ;u64 max_val_cycles_rounded =1ULL <<fls64 (max_val_cycles -1 );/* calculate max possible multiplier in order to fit in 64bit */ u64 max_mul =div64_u64 (ULLONG_MAX , max_val_cycles_rounded);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 248/356 net: lan966x: Make sure to insert the vlan tags also in host mode
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Horatiu Vultur <[email protected]>
[ Upstream commit 27eab4c644236a9324084a70fe79e511cbd07393 ]
When running these commands on DUT (and similar at the other end) ip link set dev eth0 up
ip link add link eth0 name eth0.10 type vlan id 10
ip addr add 10.0.0.1/24 dev eth0.10
ip link set dev eth0.10 up
ping 10.0.0.2
The ping will fail.
The reason why is failing is because, the network interfaces for lan966x have a flag saying that the HW can insert the vlan tags into the frames(NETIF_F_HW_VLAN_CTAG_TX). Meaning that the frames that are transmitted don't have the vlan tag inside the skb data, but they have it inside the skb. We already get that vlan tag and put it in the IFH but the problem is that we don't configure the HW to rewrite the frame when the interface is in host mode.
The fix consists in actually configuring the HW to insert the vlan tag if it is different than 0.
--- .../ethernet/microchip/lan966x/lan966x_main.c | 1 + .../ethernet/microchip/lan966x/lan966x_main.h | 1 + .../microchip/lan966x/lan966x_switchdev.c | 1 + .../ethernet/microchip/lan966x/lan966x_vlan.c | 21 +++++++++++++++++++ 4 files changed, 24 insertions(+)
drivers/net/ethernet/microchip/lan966x/lan966x_main.c +1 -0
@@ -881,6 +881,7 @@ static int lan966x_probe_port(struct lan966x *lan966x, u32 p,lan966x_vlan_port_set_vlan_aware (port,0 );lan966x_vlan_port_set_vid (port,HOST_PVID , false, false);lan966x_vlan_port_apply (port); +lan966x_vlan_port_rew_host (port);return 0 ; }
drivers/net/ethernet/microchip/lan966x/lan966x_main.h +1 -0
@@ -549,6 +549,7 @@ void lan966x_vlan_port_apply(struct lan966x_port *port);bool lan966x_vlan_cpu_member_cpu_vlan_mask (struct lan966x *lan966x,u16 vid);void lan966x_vlan_port_set_vlan_aware (struct lan966x_port *port,bool vlan_aware); +void lan966x_vlan_port_rew_host (struct lan966x_port *port); int lan966x_vlan_port_set_vid(struct lan966x_port *port, u16 vid, bool pvid,
drivers/net/ethernet/microchip/lan966x/lan966x_switchdev.c +1 -0
@@ -297,6 +297,7 @@ static void lan966x_port_bridge_leave(struct lan966x_port *port,lan966x_vlan_port_set_vlan_aware (port, false);lan966x_vlan_port_set_vid (port,HOST_PVID , false, false);lan966x_vlan_port_apply (port); +lan966x_vlan_port_rew_host (port); } int lan966x_port_changeupper(struct net_device *dev,
drivers/net/ethernet/microchip/lan966x/lan966x_vlan.c +21 -0
@@ -149,6 +149,27 @@ void lan966x_vlan_port_set_vlan_aware(struct lan966x_port *port, port->vlan_aware = vlan_aware; } +/* When the interface is in host mode, the interface should not be vlan aware +* but it should insert all the tags that it gets from the network stack. +* The tags are not in the data of the frame but actually in the skb and the ifh +* is configured already to get this tag. So what we need to do is to update the +* rewriter to insert the vlan tag for all frames which have a vlan tag +* different than 0. +*/ +void lan966x_vlan_port_rew_host (struct lan966x_port *port) +{ +struct lan966x *lan966x = port->lan966x; +u32 val; + +/* Tag all frames except when VID=0*/ + val =REW_TAG_CFG_TAG_CFG_SET (2 ); + +/* Update only some bits in the register */ +lan_rmw (val, +REW_TAG_CFG_TAG_CFG , + lan966x,REW_TAG_CFG (port->chip_port)); +} +void lan966x_vlan_port_apply (struct lan966x_port *port) {struct lan966x *lan966x = port->lan966x;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 249/356 spi: bcm63xx-spi: fix shared reset
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Álvaro Fernández Rojas <[email protected]>
[ Upstream commit 5ad20e3d8cfe3b2e42bbddc7e0ebaa74479bb589 ]
Some bmips SoCs (bcm6362, bcm63268) share the same SPI reset for both SPI and HSSPI controllers, so reset shouldn't be exclusive.
--- drivers/spi/spi-bcm63xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-bcm63xx.c +1 -1
@@ -523,7 +523,7 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)return PTR_ERR (clk); } - reset =devm_reset_control_get_optional_exclusive (dev,NULL ); + reset =devm_reset_control_get_optional_shared (dev,NULL );if (IS_ERR (reset))return PTR_ERR (reset);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 250/356 spi: bcm63xx-hsspi: fix shared reset
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Álvaro Fernández Rojas <[email protected]>
[ Upstream commit 3d6d84c8f2f66d3fd6a43a1e2ce8e6b54c573960 ]
Some bmips SoCs (bcm6362, bcm63268) share the same SPI reset for both SPI and HSSPI controllers, so reset shouldn't be exclusive.
--- drivers/spi/spi-bcm63xx-hsspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-bcm63xx-hsspi.c +1 -1
@@ -745,7 +745,7 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)if (IS_ERR (clk))return PTR_ERR (clk); - reset =devm_reset_control_get_optional_exclusive (dev,NULL ); + reset =devm_reset_control_get_optional_shared (dev,NULL );if (IS_ERR (reset))return PTR_ERR (reset);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 251/356 Bluetooth: L2CAP: Fix not responding with L2CAP_CR_LE_ENCRYPTION
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 03dba9cea72f977e873e4e60e220fa596959dd8f ]
Depending on the security set the response to L2CAP_LE_CONN_REQ shall be just L2CAP_CR_LE_ENCRYPTION if only encryption when BT_SECURITY_MEDIUM is selected since that means security mode 2 which doesn't require authentication which is something that is covered in the qualification test L2CAP/LE/CFC/BV-25-C.
--- net/bluetooth/l2cap_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/bluetooth/l2cap_core.c +2 -1
@@ -4833,7 +4833,8 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn,if (!smp_sufficient_security (conn->hcon, pchan->sec_level,SMP_ALLOW_STK )) { - result =L2CAP_CR_LE_AUTHENTICATION ; + result = pchan->sec_level ==BT_SECURITY_MEDIUM ? +L2CAP_CR_LE_ENCRYPTION :L2CAP_CR_LE_AUTHENTICATION ; chan =NULL ; goto response_unlock; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 252/356 ice: fix Tx scheduler error handling in XDP callback
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Kubiak <[email protected]>
[ Upstream commit 0153f36041b8e52019ebfa8629c13bf8f9b0a951 ]
When the XDP program is loaded, the XDP callback adds new Tx queues. This means that the callback must update the Tx scheduler with the new queue number. In the event of a Tx scheduler failure, the XDP callback should also fail and roll back any changes previously made for XDP preparation.
The previous implementation had a bug that not all changes made by the XDP callback were rolled back. This caused the crash with the following call trace:
[ +9.549584] ice 0000:ca:00.0: Failed VSI LAN queue config for XDP, error: -5 [ +0.382335] Oops: general protection fault, probably for non-canonical address 0x50a2250a90495525: 0000 [#1] SMP NOPTI [ +0.010710] CPU: 103 UID: 0 PID: 0 Comm: swapper/103 Not tainted 6.14.0-net-next-mar-31+ #14 PREEMPT(voluntary) [ +0.010175] Hardware name: Intel Corporation M50CYP2SBSTD/M50CYP2SBSTD, BIOS SE5C620.86B.01.01.0005.2202160810 02/16/2022 [ +0.010946] RIP: 0010:__ice_update_sample+0x39/0xe0 [ice]
[...]
[ +0.002715] Call Trace: [ +0.002452] <IRQ> [ +0.002021] ? __die_body.cold+0x19/0x29 [ +0.003922] ? die_addr+0x3c/0x60 [ +0.003319] ? exc_general_protection+0x17c/0x400 [ +0.004707] ? asm_exc_general_protection+0x26/0x30 [ +0.004879] ? __ice_update_sample+0x39/0xe0 [ice] [ +0.004835] ice_napi_poll+0x665/0x680 [ice] [ +0.004320] __napi_poll+0x28/0x190 [ +0.003500] net_rx_action+0x198/0x360 [ +0.003752] ? update_rq_clock+0x39/0x220 [ +0.004013] handle_softirqs+0xf1/0x340 [ +0.003840] ? sched_clock_cpu+0xf/0x1f0 [ +0.003925] __irq_exit_rcu+0xc2/0xe0 [ +0.003665] common_interrupt+0x85/0xa0 [ +0.003839] </IRQ> [ +0.002098] <TASK> [ +0.002106] asm_common_interrupt+0x26/0x40 [ +0.004184] RIP: 0010:cpuidle_enter_state+0xd3/0x690
Fix this by performing the missing unmapping of XDP queues from q_vectors and setting the XDP rings pointer back to NULL after all those queues are released.
Also, add an immediate exit from the XDP callback in case of ring preparation failure.
--- drivers/net/ethernet/intel/ice/ice_main.c | 47 ++++++++++++++++------- 1 file changed, 33 insertions(+), 14 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +33 -14
@@ -2650,6 +2650,27 @@ static void ice_vsi_assign_bpf_prog(struct ice_vsi *vsi, struct bpf_prog *prog)bpf_prog_put (old_prog); } +/** +* ice_unmap_xdp_rings - Unmap XDP rings from interrupt vectors +* @vsi: the VSI with XDP rings being unmapped +*/ +static void ice_unmap_xdp_rings (struct ice_vsi *vsi) +{ +int v_idx; + +ice_for_each_q_vector (vsi, v_idx) { +struct ice_q_vector *q_vector = vsi->q_vectors[v_idx]; +struct ice_tx_ring *ring; + +ice_for_each_tx_ring (ring, q_vector->tx) +if (!ring->tx_buf || !ice_ring_is_xdp (ring)) +break ; + +/* restore the value of last node prior to XDP setup */ + q_vector->tx.tx_ring = ring; + } +} +/** * ice_prepare_xdp_rings - Allocate, configure and setup Tx rings for XDP * @vsi: VSI to bring up Tx rings used by XDP
@@ -2749,7 +2770,7 @@ int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog,if (status) {dev_err (dev,"Failed VSI LAN queue config for XDP, error: %d\n" , status); - goto clear_xdp_rings; + goto unmap_xdp_rings; }/* assign the prog only when it's not already present on VSI;
@@ -2765,6 +2786,8 @@ int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog,ice_vsi_assign_bpf_prog (vsi, prog);return 0 ; +unmap_xdp_rings: +ice_unmap_xdp_rings (vsi); clear_xdp_rings:ice_for_each_xdp_txq (vsi, i)if (vsi->xdp_rings[i]) {
@@ -2781,6 +2804,8 @@ int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog,mutex_unlock (&pf->avail_q_mutex);devm_kfree (dev, vsi->xdp_rings); + vsi->xdp_rings =NULL ; +return -ENOMEM ; }
@@ -2796,7 +2821,7 @@ int ice_destroy_xdp_rings(struct ice_vsi *vsi, enum ice_xdp_cfg cfg_type) {u16 max_txqs[ICE_MAX_TRAFFIC_CLASS ] = {0 };struct ice_pf *pf = vsi->back; -int i, v_idx; +int i;/* q_vectors are freed in reset path so there's no point in detaching * rings
@@ -2804,17 +2829,7 @@ int ice_destroy_xdp_rings(struct ice_vsi *vsi, enum ice_xdp_cfg cfg_type)if (cfg_type ==ICE_XDP_CFG_PART ) goto free_qmap; -ice_for_each_q_vector (vsi, v_idx) { -struct ice_q_vector *q_vector = vsi->q_vectors[v_idx]; -struct ice_tx_ring *ring; - -ice_for_each_tx_ring (ring, q_vector->tx) -if (!ring->tx_buf || !ice_ring_is_xdp (ring)) -break ; - -/* restore the value of last node prior to XDP setup */ - q_vector->tx.tx_ring = ring; - } +ice_unmap_xdp_rings (vsi); free_qmap:mutex_lock (&pf->avail_q_mutex);
@@ -2956,11 +2971,14 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog, xdp_ring_err =ice_vsi_determine_xdp_res (vsi);if (xdp_ring_err) {NL_SET_ERR_MSG_MOD (extack,"Not enough Tx resources for XDP" ); + goto resume_if; }else { xdp_ring_err =ice_prepare_xdp_rings (vsi, prog,ICE_XDP_CFG_FULL ); -if (xdp_ring_err) +if (xdp_ring_err) {NL_SET_ERR_MSG_MOD (extack,"Setting up XDP Tx resources failed" ); + goto resume_if; + } }xdp_features_set_redirect_target (vsi->netdev, true);/* reallocate Rx queues that are used for zero-copy */
@@ -2978,6 +2996,7 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog,NL_SET_ERR_MSG_MOD (extack,"Freeing XDP Rx resources failed" ); } +resume_if:if (if_running) ret =ice_up (vsi);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 253/356 ice: create new Tx scheduler nodes for new queues only
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Kubiak <[email protected]>
[ Upstream commit 6fa2942578472c9cab13a8fc1dae0d830193e0a1 ]
The current implementation of the Tx scheduler tree attempts to create nodes for all Tx queues, ignoring the fact that some queues may already exist in the tree. For example, if the VSI already has 128 Tx queues and the user requests for 16 new queues, the Tx scheduler will compute the tree for 272 queues (128 existing queues + 144 new queues), instead of 144 queues (128 existing queues and 16 new queues).
Fix that by modifying the node count calculation algorithm to skip the queues that already exist in the tree.
--- drivers/net/ethernet/intel/ice/ice_sched.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/ice/ice_sched.c +6 -5
@@ -1614,16 +1614,16 @@ ice_sched_get_agg_node(struct ice_port_info *pi, struct ice_sched_node *tc_node,/** * ice_sched_calc_vsi_child_nodes - calculate number of VSI child nodes * @hw: pointer to the HW struct -* @num_qs: number of queues +* @num_new_qs: number of new queues that will be added to the tree * @num_nodes: num nodes array * * This function calculates the number of VSI child nodes based on the * number of queues. */ static void -ice_sched_calc_vsi_child_nodes (struct ice_hw *hw,u16 num_qs,u16 *num_nodes) +ice_sched_calc_vsi_child_nodes (struct ice_hw *hw,u16 num_new_qs,u16 *num_nodes) { -u16 num = num_qs; +u16 num = num_new_qs;u8 i, qgl, vsil; qgl =ice_sched_get_qgrp_layer (hw);
@@ -1873,8 +1873,9 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,return status; } -if (new_numqs) -ice_sched_calc_vsi_child_nodes (hw, new_numqs, new_num_nodes); +ice_sched_calc_vsi_child_nodes (hw, new_numqs - prev_numqs, + new_num_nodes); +/* Keep the max number of queue configuration all the time. Update the * tree only if number of queues > previous number of queues. This may * leave some extra nodes in the tree if number of queues < previous
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 254/356 ice: fix rebuilding the Tx scheduler tree for large queue counts
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Kubiak <[email protected]>
[ Upstream commit 73145e6d81070d34a21431c9e0d7aaf2f29ca048 ]
The current implementation of the Tx scheduler allows the tree to be rebuilt as the user adds more Tx queues to the VSI. In such a case, additional child nodes are added to the tree to support the new number of queues.
Unfortunately, this algorithm does not take into account that the limit of the VSI support node may be exceeded, so an additional node in the VSI layer may be required to handle all the requested queues.
Such a scenario occurs when adding XDP Tx queues on machines with many CPUs. Although the driver still respects the queue limit returned by the FW, the Tx scheduler was unable to add those queues to its tree and returned one of the errors below.
Such a scenario occurs when adding XDP Tx queues on machines with many CPUs (e.g. at least 321 CPUs, if there is already 128 Tx/Rx queue pairs). Although the driver still respects the queue limit returned by the FW, the Tx scheduler was unable to add those queues to its tree and returned the following errors:
Failed VSI LAN queue config for XDP, error: -5
or:
Failed to set LAN Tx queue context, error: -22
Fix this problem by extending the tree rebuild algorithm to check if the current VSI node can support the requested number of queues. If it cannot, create as many additional VSI support nodes as necessary to handle all the required Tx queues. Symmetrically, adjust the VSI node removal algorithm to remove all nodes associated with the given VSI. Also, make the search for the next free VSI node more restrictive. That is, add queue group nodes only to the VSI support nodes that have a matching VSI handle.
Finally, fix the comment describing the tree update algorithm to better reflect the current scenario.
--- drivers/net/ethernet/intel/ice/ice_sched.c | 170 +++++++++++++++++---- 1 file changed, 142 insertions(+), 28 deletions(-)
drivers/net/ethernet/intel/ice/ice_sched.c +142 -28
@@ -84,6 +84,27 @@ ice_sched_find_node_by_teid(struct ice_sched_node *start_node, u32 teid)return NULL ; } +/** +* ice_sched_find_next_vsi_node - find the next node for a given VSI +* @vsi_node: VSI support node to start search with +* +* Return: Next VSI support node, or NULL. +* +* The function returns a pointer to the next node from the VSI layer +* assigned to the given VSI, or NULL if there is no such a node. +*/ +static struct ice_sched_node * +ice_sched_find_next_vsi_node (struct ice_sched_node *vsi_node) +{ +unsigned int vsi_handle = vsi_node->vsi_handle; + +while ((vsi_node = vsi_node->sibling) !=NULL ) +if (vsi_node->vsi_handle == vsi_handle) +break ; + +return vsi_node; +} +/** * ice_aqc_send_sched_elem_cmd - send scheduling elements cmd * @hw: pointer to the HW struct
@@ -1096,8 +1117,10 @@ ice_sched_add_nodes_to_layer(struct ice_port_info *pi,if (parent->num_children < max_child_nodes) { new_num_nodes = max_child_nodes - parent->num_children; }else { -/* This parent is full, try the next sibling */ - parent = parent->sibling; +/* This parent is full, +* try the next available sibling. +*/ + parent =ice_sched_find_next_vsi_node (parent);/* Don't modify the first node TEID memory if the * first node was added already in the above call. * Instead send some temp memory for all other
@@ -1538,12 +1561,23 @@ ice_sched_get_free_qparent(struct ice_port_info *pi, u16 vsi_handle, u8 tc,/* get the first queue group node from VSI sub-tree */ qgrp_node =ice_sched_get_first_node (pi, vsi_node, qgrp_layer);while (qgrp_node) { +struct ice_sched_node *next_vsi_node; +/* make sure the qgroup node is part of the VSI subtree */ if (ice_sched_find_node_in_subtree (pi->hw, vsi_node, qgrp_node))if (qgrp_node->num_children < max_children && qgrp_node->owner == owner)break ; qgrp_node = qgrp_node->sibling; +if (qgrp_node) +continue ; + + next_vsi_node =ice_sched_find_next_vsi_node (vsi_node); +if (!next_vsi_node) +break ; + + vsi_node = next_vsi_node; + qgrp_node =ice_sched_get_first_node (pi, vsi_node, qgrp_layer); }/* Select the best queue group */
@@ -1789,7 +1823,11 @@ ice_sched_add_vsi_support_nodes(struct ice_port_info *pi, u16 vsi_handle,if (!parent)return -EIO ; -if (i == vsil) +/* Do not modify the VSI handle for already existing VSI nodes, +* (if no new VSI node was added to the tree). +* Assign the VSI handle only to newly added VSI nodes. +*/ +if (i == vsil && num_added) parent->vsi_handle = vsi_handle; }
@@ -1822,6 +1860,41 @@ ice_sched_add_vsi_to_topo(struct ice_port_info *pi, u16 vsi_handle, u8 tc) num_nodes); } +/** +* ice_sched_recalc_vsi_support_nodes - recalculate VSI support nodes count +* @hw: pointer to the HW struct +* @vsi_node: pointer to the leftmost VSI node that needs to be extended +* @new_numqs: new number of queues that has to be handled by the VSI +* @new_num_nodes: pointer to nodes count table to modify the VSI layer entry +* +* This function recalculates the number of supported nodes that need to +* be added after adding more Tx queues for a given VSI. +* The number of new VSI support nodes that shall be added will be saved +* to the @new_num_nodes table for the VSI layer. +*/ +static void +ice_sched_recalc_vsi_support_nodes (struct ice_hw *hw, +struct ice_sched_node *vsi_node, +unsigned int new_numqs,u16 *new_num_nodes) +{ +u32 vsi_nodes_cnt =1 ; +u32 max_queue_cnt =1 ; +u32 qgl, vsil; + + qgl =ice_sched_get_qgrp_layer (hw); + vsil =ice_sched_get_vsi_layer (hw); + +for (u32 i = vsil; i <= qgl; i++) + max_queue_cnt *= hw->max_children[i]; + +while ((vsi_node =ice_sched_find_next_vsi_node (vsi_node)) !=NULL ) + vsi_nodes_cnt++; + +if (new_numqs > (max_queue_cnt * vsi_nodes_cnt)) + new_num_nodes[vsil] =DIV_ROUND_UP (new_numqs, max_queue_cnt) - + vsi_nodes_cnt; +} +/** * ice_sched_update_vsi_child_nodes - update VSI child nodes * @pi: port information structure
@@ -1873,16 +1946,25 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,return status; } +ice_sched_recalc_vsi_support_nodes (hw, vsi_node, + new_numqs, new_num_nodes);ice_sched_calc_vsi_child_nodes (hw, new_numqs - prev_numqs, new_num_nodes); -/* Keep the max number of queue configuration all the time. Update the -* tree only if number of queues > previous number of queues. This may +/* Never decrease the number of queues in the tree. Update the tree +* only if number of queues > previous number of queues. This may * leave some extra nodes in the tree if number of queues < previous * number but that wouldn't harm anything. Removing those extra nodes * may complicate the code if those nodes are part of SRL or * individually rate limited. +* Also, add the required VSI support nodes if the existing ones cannot +* handle the requested new number of queues. */ + status =ice_sched_add_vsi_support_nodes (pi, vsi_handle, tc_node, + new_num_nodes); +if (status) +return status; + status =ice_sched_add_vsi_child_nodes (pi, vsi_handle, tc_node, new_num_nodes, owner);if (status)
@@ -2023,6 +2105,58 @@ static bool ice_sched_is_leaf_node_present(struct ice_sched_node *node)return (node->info.data.elem_type ==ICE_AQC_ELEM_TYPE_LEAF ); } +/** +* ice_sched_rm_vsi_subtree - remove all nodes assigned to a given VSI +* @pi: port information structure +* @vsi_node: pointer to the leftmost node of the VSI to be removed +* @owner: LAN or RDMA +* @tc: TC number +* +* Return: Zero in case of success, or -EBUSY if the VSI has leaf nodes in TC. +* +* This function removes all the VSI support nodes associated with a given VSI +* and its LAN or RDMA children nodes from the scheduler tree. +*/ +static int +ice_sched_rm_vsi_subtree (struct ice_port_info *pi, +struct ice_sched_node *vsi_node,u8 owner,u8 tc) +{ +u16 vsi_handle = vsi_node->vsi_handle; +bool all_vsi_nodes_removed = true; +int j =0 ; + +while (vsi_node) { +struct ice_sched_node *next_vsi_node; + +if (ice_sched_is_leaf_node_present (vsi_node)) { +ice_debug (pi->hw,ICE_DBG_SCHED ,"VSI has leaf nodes in TC %d\n" , tc); +return -EBUSY ; + } +while (j < vsi_node->num_children) { +if (vsi_node->children[j]->owner == owner) +ice_free_sched_node (pi, vsi_node->children[j]); +else + j++; + } + + next_vsi_node =ice_sched_find_next_vsi_node (vsi_node); + +/* remove the VSI if it has no children */ +if (!vsi_node->num_children) +ice_free_sched_node (pi, vsi_node); +else + all_vsi_nodes_removed = false; + + vsi_node = next_vsi_node; + } + +/* clean up aggregator related VSI info if any */ +if (all_vsi_nodes_removed) +ice_sched_rm_agg_vsi_info (pi, vsi_handle); + +return 0 ; +} +/** * ice_sched_rm_vsi_cfg - remove the VSI and its children nodes * @pi: port information structure
@@ -2049,7 +2183,6 @@ ice_sched_rm_vsi_cfg(struct ice_port_info *pi, u16 vsi_handle, u8 owner)ice_for_each_traffic_class (i) {struct ice_sched_node *vsi_node, *tc_node; -u8 j =0 ; tc_node =ice_sched_get_tc_node (pi, i);if (!tc_node)
@@ -2059,31 +2192,12 @@ ice_sched_rm_vsi_cfg(struct ice_port_info *pi, u16 vsi_handle, u8 owner)if (!vsi_node)continue ; -if (ice_sched_is_leaf_node_present (vsi_node)) { -ice_debug (pi->hw,ICE_DBG_SCHED ,"VSI has leaf nodes in TC %d\n" , i); - status = -EBUSY ; + status =ice_sched_rm_vsi_subtree (pi, vsi_node, owner, i); +if (status) goto exit_sched_rm_vsi_cfg; - } -while (j < vsi_node->num_children) { -if (vsi_node->children[j]->owner == owner) { -ice_free_sched_node (pi, vsi_node->children[j]); -/* reset the counter again since the num -* children will be updated after node removal -*/ - j =0 ; - }else { - j++; - } - } -/* remove the VSI if it has no children */ -if (!vsi_node->num_children) { -ice_free_sched_node (pi, vsi_node); - vsi_ctx->sched.vsi_node[i] =NULL ; + vsi_ctx->sched.vsi_node[i] =NULL ; -/* clean up aggregator related VSI info if any */ -ice_sched_rm_agg_vsi_info (pi, vsi_handle); - }if (owner ==ICE_SCHED_NODE_OWNER_LAN ) vsi_ctx->sched.max_lanq[i] =0 ;else
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 255/356 net: dsa: tag_brcm: legacy: fix pskb_may_pull length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Álvaro Fernández Rojas <[email protected]>
[ Upstream commit efdddc4484859082da6c7877ed144c8121c8ea55 ]
BRCM_LEG_PORT_ID was incorrectly used for pskb_may_pull length. The correct check is BRCM_LEG_TAG_LEN + VLAN_HLEN, or 10 bytes.
--- net/dsa/tag_brcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/dsa/tag_brcm.c +1 -1
@@ -257,7 +257,7 @@ static struct sk_buff *brcm_leg_tag_rcv(struct sk_buff *skb,int source_port;u8 *brcm_tag; -if (unlikely (!pskb_may_pull (skb,BRCM_LEG_PORT_ID ))) +if (unlikely (!pskb_may_pull (skb,BRCM_LEG_TAG_LEN +VLAN_HLEN )))return NULL ; brcm_tag =dsa_etype_header_pos_rx (skb);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 256/356 net: stmmac: make sure that ptp_rate is not 0 before configuring timestamping
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexis Lothoré <[email protected]>
[ Upstream commit 030ce919e114a111e83b7976ecb3597cefd33f26 ]
The stmmac platform drivers that do not open-code the clk_ptp_rate value after having retrieved the default one from the device-tree can end up with 0 in clk_ptp_rate (as clk_get_rate can return 0). It will eventually propagate up to PTP initialization when bringing up the interface, leading to a divide by 0:
Division by zero in kernel.
CPU: 1 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.30-00001-g48313bd5768a #22 Hardware name: STM32 (Device Tree Support) Call trace: unwind_backtrace from show_stack+0x18/0x1c show_stack from dump_stack_lvl+0x6c/0x8c dump_stack_lvl from Ldiv0_64+0x8/0x18 Ldiv0_64 from stmmac_init_tstamp_counter+0x190/0x1a4 stmmac_init_tstamp_counter from stmmac_hw_setup+0xc1c/0x111c stmmac_hw_setup from __stmmac_open+0x18c/0x434 __stmmac_open from stmmac_open+0x3c/0xbc stmmac_open from __dev_open+0xf4/0x1ac __dev_open from __dev_change_flags+0x1cc/0x224 __dev_change_flags from dev_change_flags+0x24/0x60 dev_change_flags from ip_auto_config+0x2e8/0x11a0 ip_auto_config from do_one_initcall+0x84/0x33c do_one_initcall from kernel_init_freeable+0x1b8/0x214 kernel_init_freeable from kernel_init+0x24/0x140 kernel_init from ret_from_fork+0x14/0x28 Exception stack(0xe0815fb0 to 0xe0815ff8)
Prevent this division by 0 by adding an explicit check and error log about the actual issue. While at it, remove the same check from stmmac_ptp_register, which then becomes duplicate
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +++++ drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +5 -0
@@ -842,6 +842,11 @@ int stmmac_init_tstamp_counter(struct stmmac_priv *priv, u32 systime_flags)if (!(priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp))return -EOPNOTSUPP ; +if (!priv->plat->clk_ptp_rate) { +netdev_err (priv->dev,"Invalid PTP clock rate" ); +return -EINVAL ; + } +stmmac_config_hw_tstamping (priv, priv->ptpaddr, systime_flags); priv->systime_flags = systime_flags;
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +1 -1
@@ -295,7 +295,7 @@ void stmmac_ptp_register(struct stmmac_priv *priv)/* Calculate the clock domain crossing (CDC) error if necessary */ priv->plat->cdc_error_adj =0 ; -if (priv->plat->has_gmac4 && priv->plat->clk_ptp_rate) +if (priv->plat->has_gmac4) priv->plat->cdc_error_adj = (2 *NSEC_PER_SEC ) / priv->plat->clk_ptp_rate; stmmac_ptp_clock_ops.n_per_out = priv->dma_cap.pps_out_num;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 257/356 net: Fix checksum update for ILA adj-transport
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Chaignon <[email protected]>
[ Upstream commit 6043b794c7668c19dabc4a93c75b924a19474d59 ]
During ILA address translations, the L4 checksums can be handled in different ways. One of them, adj-transport, consist in parsing the transport layer and updating any found checksum. This logic relies on inet_proto_csum_replace_by_diff and produces an incorrect skb->csum when in state CHECKSUM_COMPLETE.
This bug can be reproduced with a simple ILA to SIR mapping, assuming packets are received with CHECKSUM_COMPLETE:
$ ip a show dev eth0
14: eth0@if15: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 62:ae:35:9e:0f:8d brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 3333:0:0:1::c078/64 scope global
valid_lft forever preferred_lft forever
inet6 fd00:10:244:1::c078/128 scope global nodad
valid_lft forever preferred_lft forever
inet6 fe80::60ae:35ff:fe9e:f8d/64 scope link proto kernel_ll
valid_lft forever preferred_lft forever
$ ip ila add loc_match fd00:10:244:1 loc 3333:0:0:1 \
csum-mode adj-transport ident-type luid dev eth0Then I hit [fd00:10:244:1::c078]:8000 with a server listening only on [3333:0:0:1::c078]:8000. With the bug, the SYN packet is dropped with SKB_DROP_REASON_TCP_CSUM after inet_proto_csum_replace_by_diff changed skb->csum. The translation and drop are visible on pwru [1] traces:
IFACE TUPLE FUNC eth0:9 [fd00:10:244:3::3d8]:51420->[fd00:10:244:1::c078]:8000(tcp) ipv6_rcv eth0:9 [fd00:10:244:3::3d8]:51420->[fd00:10:244:1::c078]:8000(tcp) ip6_rcv_core eth0:9 [fd00:10:244:3::3d8]:51420->[fd00:10:244:1::c078]:8000(tcp) nf_hook_slow eth0:9 [fd00:10:244:3::3d8]:51420->[fd00:10:244:1::c078]:8000(tcp) inet_proto_csum_replace_by_diff eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) tcp_v6_early_demux eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ip6_route_input eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ip6_input eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ip6_input_finish eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ip6_protocol_deliver_rcu eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) raw6_local_deliver eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ipv6_raw_deliver eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) tcp_v6_rcv eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) __skb_checksum_complete eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) kfree_skb_reason(SKB_DROP_REASON_TCP_CSUM) eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) skb_release_head_state eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) skb_release_data eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) skb_free_head eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) kfree_skbmem
This is happening because inet_proto_csum_replace_by_diff is updating skb->csum when it shouldn't. The L4 checksum is updated such that it "cancels" the IPv6 address change in terms of checksum computation, so the impact on skb->csum is null.
Note this would be different for an IPv4 packet since three fields would be updated: the IPv4 address, the IP checksum, and the L4 checksum. Two would cancel each other and skb->csum would still need to be updated to take the L4 checksum change into account.
This patch fixes it by passing an ipv6 flag to inet_proto_csum_replace_by_diff, to skip the skb->csum update if we're in the IPv6 case. Note the behavior of the only other user of inet_proto_csum_replace_by_diff, the BPF subsystem, is left as is in this patch and fixed in the subsequent patch.
With the fix, using the reproduction from above, I can confirm skb->csum is not touched by inet_proto_csum_replace_by_diff and the TCP SYN proceeds to the application after the ILA translation.
--- include/net/checksum.h | 2 +- net/core/filter.c | 2 +- net/core/utils.c | 4 ++-- net/ipv6/ila/ila_common.c | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-)
include/net/checksum.h +1 -1
@@ -158,7 +158,7 @@ void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb, const __be32 *from, const __be32 *to, bool pseudohdr);void inet_proto_csum_replace_by_diff (__sum16 *sum,struct sk_buff *skb, -__wsum diff,bool pseudohdr); +__wsum diff,bool pseudohdr,bool ipv6); static __always_inline void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
net/core/filter.c +1 -1
@@ -1987,7 +1987,7 @@ BPF_CALL_5(bpf_l4_csum_replace, struct sk_buff *, skb, u32, offset,if (unlikely (from !=0 ))return -EINVAL ; -inet_proto_csum_replace_by_diff (ptr, skb, to, is_pseudo); +inet_proto_csum_replace_by_diff (ptr, skb, to, is_pseudo, false);break ;case 2 :inet_proto_csum_replace2 (ptr, skb, from, to, is_pseudo);
net/core/utils.c +2 -2
@@ -473,11 +473,11 @@ void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb,EXPORT_SYMBOL (inet_proto_csum_replace16);void inet_proto_csum_replace_by_diff (__sum16 *sum,struct sk_buff *skb, -__wsum diff,bool pseudohdr) +__wsum diff,bool pseudohdr,bool ipv6) {if (skb->ip_summed !=CHECKSUM_PARTIAL ) {csum_replace_by_diff (sum, diff); -if (skb->ip_summed ==CHECKSUM_COMPLETE && pseudohdr) +if (skb->ip_summed ==CHECKSUM_COMPLETE && pseudohdr && !ipv6) skb->csum = ~csum_sub (diff, skb->csum); }else if (pseudohdr) { *sum = ~csum_fold (csum_add (diff,csum_unfold (*sum)));
net/ipv6/ila/ila_common.c +3 -3
@@ -86,7 +86,7 @@ static void ila_csum_adjust_transport(struct sk_buff *skb, diff =get_csum_diff (ip6h, p);inet_proto_csum_replace_by_diff (&th->check, skb, - diff, true); + diff, true, true); }break ;case NEXTHDR_UDP :
@@ -97,7 +97,7 @@ static void ila_csum_adjust_transport(struct sk_buff *skb,if (uh->check || skb->ip_summed ==CHECKSUM_PARTIAL ) { diff =get_csum_diff (ip6h, p);inet_proto_csum_replace_by_diff (&uh->check, skb, - diff, true); + diff, true, true);if (!uh->check) uh->check =CSUM_MANGLED_0 ; }
@@ -111,7 +111,7 @@ static void ila_csum_adjust_transport(struct sk_buff *skb, diff =get_csum_diff (ip6h, p);inet_proto_csum_replace_by_diff (&ih->icmp6_cksum, skb, - diff, true); + diff, true, true); }break ; }
Signature · 1 line
2.39.5
Re: [PATCH 6.6 257/356] net: Fix checksum update for ILA adj-transport
Quoted 1 line · Greg Kroah-Hartman
6.6-stable review patch. If anyone has any objections, please let me know.
Not an objection per se, but I've sent the same backport at
https://lore.kernel.org/stable/6520b247c2d367849f41689f71961e9741b1b7eb.1750168920.git.paul.chaignon@gmail.com/
The only difference is that I also backported the second patch in the series, which had a conflict. The backported patchset should apply on 6.1, 6.6, and 6.12. I hope that was the correct way to proceed :)
Quoted 167 lines
------------------
From: Paul Chaignon <[email protected]>
[ Upstream commit
6043b794c7668c19dabc4a93c75b924a19474d59]During ILA address translations, the L4 checksums can be handled in different ways. One of them, adj-transport, consist in parsing the transport layer and updating any found checksum. This logic relies on
inet_proto_csum_replace_by_diffand produces an incorrectskb->csumwhen in stateCHECKSUM_COMPLETE.This bug can be reproduced with a simple ILA to SIR mapping, assuming packets are received with
CHECKSUM_COMPLETE:$ ip a show dev eth0 14: eth0@if15: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 62:ae:35:9e:0f:8d brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet6 3333:0:0:1::c078/64 scope global valid_lft forever preferred_lft forever inet6 fd00:10:244:1::c078/128 scope global nodad valid_lft forever preferred_lft forever inet6 fe80::60ae:35ff:fe9e:f8d/64 scope link proto kernel_ll valid_lft forever preferred_lft forever $ ip ila add loc_match fd00:10:244:1 loc 3333:0:0:1 \ csum-mode adj-transport ident-type luid dev eth0Then I hit [fd00:10:244:1::c078]:8000 with a server listening only on [3333:0:0:1::c078]:8000. With the bug, the SYN packet is dropped with
SKB_DROP_REASON_TCP_CSUMafterinet_proto_csum_replace_by_diffchangedskb->csum. The translation and drop are visible on pwru [1] traces:IFACE TUPLE FUNC eth0:9 [fd00:10:244:3::3d8]:51420->[fd00:10:244:1::c078]:8000(tcp) ipv6_rcv eth0:9 [fd00:10:244:3::3d8]:51420->[fd00:10:244:1::c078]:8000(tcp) ip6_rcv_core eth0:9 [fd00:10:244:3::3d8]:51420->[fd00:10:244:1::c078]:8000(tcp) nf_hook_slow eth0:9 [fd00:10:244:3::3d8]:51420->[fd00:10:244:1::c078]:8000(tcp) inet_proto_csum_replace_by_diff eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) tcp_v6_early_demux eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ip6_route_input eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ip6_input eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ip6_input_finish eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ip6_protocol_deliver_rcu eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) raw6_local_deliver eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ipv6_raw_deliver eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) tcp_v6_rcv eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) __skb_checksum_complete eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) kfree_skb_reason(SKB_DROP_REASON_TCP_CSUM) eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) skb_release_head_state eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) skb_release_data eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) skb_free_head eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) kfree_skbmemThis is happening because
inet_proto_csum_replace_by_diffis updatingskb->csumwhen it shouldn't. The L4 checksum is updated such that it "cancels" the IPv6 address change in terms of checksum computation, so the impact onskb->csumis null.Note this would be different for an IPv4 packet since three fields would be updated: the IPv4 address, the IP checksum, and the L4 checksum. Two would cancel each other and
skb->csumwould still need to be updated to take the L4 checksum change into account.This patch fixes it by passing an ipv6 flag to
inet_proto_csum_replace_by_diff, to skip theskb->csumupdate if we're in the IPv6 case. Note the behavior of the only other user ofinet_proto_csum_replace_by_diff, the BPF subsystem, is left as is in this patch and fixed in the subsequent patch.With the fix, using the reproduction from above, I can confirm
skb->csumis not touched byinet_proto_csum_replace_by_diffand the TCP SYN proceeds to the application after the ILA translation.Link https://github.com/cilium/pwru [1]Fixes 65d7ab8de582 ("net: Identifier Locator Addressing module")Signed-off-by Paul Chaignon <[email protected]>Acked-by Daniel Borkmann <[email protected]>Link https://patch.msgid.link/b5539869e3550d46068504feb02d37653d939c0b.1748509484.git.paul.chaignon@gmail.com open hereSigned-off-by Jakub Kicinski <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- include/net/checksum.h | 2 +- net/core/filter.c | 2 +- net/core/utils.c | 4 ++-- net/ipv6/ila/ila_common.c | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-)include/net/checksum.h +1
-1@@ -158,7 +158,7 @@ void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb, const __be32 *from, const __be32 *to, bool pseudohdr);void inet_proto_csum_replace_by_diff (__sum16 *sum,struct sk_buff *skb, -__wsum diff,bool pseudohdr); +__wsum diff,bool pseudohdr,bool ipv6); static __always_inline void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,net/core/filter.c +1
-1@@ -1987,7 +1987,7 @@ BPF_CALL_5(bpf_l4_csum_replace, struct sk_buff *, skb, u32, offset,if (unlikely (from !=0 ))return -EINVAL ; -inet_proto_csum_replace_by_diff (ptr, skb, to, is_pseudo); +inet_proto_csum_replace_by_diff (ptr, skb, to, is_pseudo, false);break ;case 2 :inet_proto_csum_replace2 (ptr, skb, from, to, is_pseudo);net/core/utils.c +2
-2@@ -473,11 +473,11 @@ void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb,EXPORT_SYMBOL (inet_proto_csum_replace16);void inet_proto_csum_replace_by_diff (__sum16 *sum,struct sk_buff *skb, -__wsum diff,bool pseudohdr) +__wsum diff,bool pseudohdr,bool ipv6) {if (skb->ip_summed !=CHECKSUM_PARTIAL ) {csum_replace_by_diff (sum, diff); -if (skb->ip_summed ==CHECKSUM_COMPLETE && pseudohdr) +if (skb->ip_summed ==CHECKSUM_COMPLETE && pseudohdr && !ipv6) skb->csum = ~csum_sub (diff, skb->csum); }else if (pseudohdr) { *sum = ~csum_fold (csum_add (diff,csum_unfold (*sum)));net/ipv6/ila/ila_common.c +3
-3@@ -86,7 +86,7 @@ static void ila_csum_adjust_transport(struct sk_buff *skb, diff =get_csum_diff (ip6h, p);inet_proto_csum_replace_by_diff (&th->check, skb, - diff, true); + diff, true, true); }break ;case NEXTHDR_UDP :@@ -97,7 +97,7 @@ static void ila_csum_adjust_transport(struct sk_buff *skb,if (uh->check || skb->ip_summed ==CHECKSUM_PARTIAL ) { diff =get_csum_diff (ip6h, p);inet_proto_csum_replace_by_diff (&uh->check, skb, - diff, true); + diff, true, true);if (!uh->check) uh->check =CSUM_MANGLED_0 ; }@@ -111,7 +111,7 @@ static void ila_csum_adjust_transport(struct sk_buff *skb, diff =get_csum_diff (ip6h, p);inet_proto_csum_replace_by_diff (&ih->icmp6_cksum, skb, - diff, true); + diff, true, true); }break ; }Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerRe: [PATCH 6.6 257/356] net: Fix checksum update for ILA adj-transport
Quoted 8 lines · Paul Chaignon
Quoted 1 line · Greg Kroah-Hartman
6.6-stable review patch. If anyone has any objections, please let me know.
Not an objection per se, but I've sent the same backport at
https://lore.kernel.org/stable/6520b247c2d367849f41689f71961e9741b1b7eb.1750168920.git.paul.chaignon@gmail.com/
The only difference is that I also backported the second patch in the series, which had a conflict. The backported patchset should apply on 6.1, 6.6, and 6.12. I hope that was the correct way to proceed :)
Ah, that is nicer, I'll drop this and then queue those up for the next round of stable releases, thanks!
greg k-h
Re: [PATCH 6.6 257/356] net: Fix checksum update for ILA adj-transport
Quoted 4 lines · Greg Kroah-Hartman
Quoted 3 lines · Paul Chaignon
Quoted 1 line · Greg Kroah-Hartman
6.6-stable review patch. If anyone has any objections, please let me know.
Quoted 8 lines
Quoted 5 lines
Not an objection per se, but I've sent the same backport at
https://lore.kernel.org/stable/6520b247c2d367849f41689f71961e9741b1b7eb.1750168920.git.paul.chaignon@gmail.com/
The only difference is that I also backported the second patch in the series, which had a conflict. The backported patchset should apply on 6.1, 6.6, and 6.12. I hope that was the correct way to proceed :)Ah, that is nicer, I'll drop this and then queue those up for the next round of stable releases, thanks!
Great, thanks! There's the same for the 6.12 round of course:
https://lore.kernel.org/stable/[email protected]/
The 6.15 round does have both patches from the series.
Quoted 2 lines
greg k-h
Greg Kroah-Hartman
maintainerPATCH 258/356 net: fix udp gso skb_segment after pull from frag_list
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shiming Cheng <[email protected]>
[ Upstream commit 3382a1ed7f778db841063f5d7e317ac55f9e7f72 ]
Commit a1e40ac5b5e9 ("net: gso: fix udp gso fraglist segmentation after pull from frag_list") detected invalid geometry in frag_list skbs and redirects them from skb_segment_list to more robust skb_segment. But some packets with modified geometry can also hit bugs in that code. We don't know how many such cases exist. Addressing each one by one also requires touching the complex skb_segment code, which risks introducing bugs for other types of skbs. Instead, linearize all these packets that fail the basic invariants on gso fraglist skbs. That is more robust.
If only part of the fraglist payload is pulled into head_skb, it will always cause exception when splitting skbs by skb_segment. For detailed call stack information, see below.
Valid SKB_GSO_FRAGLIST skbs
- consist of two or more segments
- the head_skb holds the protocol headers plus first gso_size
- one or more frag_list skbs hold exactly one segment
- all but the last must be gso_size
Optional datapath hooks such as NAT and BPF (bpf_skb_pull_data) can modify fraglist skbs, breaking these invariants.
In extreme cases they pull one part of data into skb linear. For UDP, this causes three payloads with lengths of (11,11,10) bytes were pulled tail to become (12,10,10) bytes.
The skbs no longer meets the above SKB_GSO_FRAGLIST conditions because payload was pulled into head_skb, it needs to be linearized before pass to regular skb_segment.
skb_segment+0xcd0/0xd14
__udp_gso_segment+0x334/0x5f4
udp4_ufo_fragment+0x118/0x15c
inet_gso_segment+0x164/0x338
skb_mac_gso_segment+0xc4/0x13c
__skb_gso_segment+0xc4/0x124
validate_xmit_skb+0x9c/0x2c0
validate_xmit_skb_list+0x4c/0x80
sch_direct_xmit+0x70/0x404
__dev_queue_xmit+0x64c/0xe5c
neigh_resolve_output+0x178/0x1c4
ip_finish_output2+0x37c/0x47c
__ip_finish_output+0x194/0x240
ip_finish_output+0x20/0xf4
ip_output+0x100/0x1a0
NF_HOOK+0xc4/0x16c
ip_forward+0x314/0x32c
ip_rcv+0x90/0x118
__netif_receive_skb+0x74/0x124
process_backlog+0xe8/0x1a4
__napi_poll+0x5c/0x1f8
net_rx_action+0x154/0x314
handle_softirqs+0x154/0x4b8 [118.376811] [C201134] rxq0_pus: [name:bug&]kernel BUG at net/core/skbuff.c:4278!
[118.376829] [C201134] rxq0_pus: [name:traps&]Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
[118.470774] [C201134] rxq0_pus: [name:mrdump&]Kernel Offset: 0x178cc00000 from 0xffffffc008000000
[118.470810] [C201134] rxq0_pus: [name:mrdump&]PHYS_OFFSET: 0x40000000
[118.470827] [C201134] rxq0_pus: [name:mrdump&]pstate: 60400005 (nZCv daif +PAN -UAO)
[118.470848] [C201134] rxq0_pus: [name:mrdump&]pc : [0xffffffd79598aefc] skb_segment+0xcd0/0xd14
[118.470900] [C201134] rxq0_pus: [name:mrdump&]lr : [0xffffffd79598a5e8] skb_segment+0x3bc/0xd14
[118.470928] [C201134] rxq0_pus: [name:mrdump&]sp : ffffffc008013770--- net/ipv4/udp_offload.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ipv4/udp_offload.c +5 -0
@@ -332,6 +332,7 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,bool copy_dtor;__sum16 check;__be16 newlen; +int ret =0 ; mss =skb_shinfo (gso_skb)->gso_size;if (gso_skb->len <=sizeof (*uh) + mss)
@@ -354,6 +355,10 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,if (skb_pagelen (gso_skb) -sizeof (*uh) ==skb_shinfo (gso_skb)->gso_size)return __udp_gso_segment_list (gso_skb, features, is_ipv6); + ret =__skb_linearize (gso_skb); +if (ret) +return ERR_PTR (ret); +/* Setup csum, as fraglist skips this in udp4_gro_receive. */ gso_skb->csum_start =skb_transport_header (gso_skb) - gso_skb->head; gso_skb->csum_offset = offsetof(struct udphdr , check);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 259/356 net: wwan: t7xx: Fix napi rx poll issue
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjian Song <[email protected]>
[ Upstream commit 905fe0845bb27e4eed2ca27ea06e6c4847f1b2b1 ]
When driver handles the napi rx polling requests, the netdev might have been released by the dellink logic triggered by the disconnect operation on user plane. However, in the logic of processing skb in polling, an invalid netdev is still being used, which causes a panic.
BUG: kernel NULL pointer dereference, address: 00000000000000f1 Oops: 0000 [#1] PREEMPT SMP NOPTI RIP: 0010:dev_gro_receive+0x3a/0x620 [...] Call Trace: <IRQ> ? __die_body+0x68/0xb0 ? page_fault_oops+0x379/0x3e0 ? exc_page_fault+0x4f/0xa0 ? asm_exc_page_fault+0x22/0x30 ? __pfx_t7xx_ccmni_recv_skb+0x10/0x10 [mtk_t7xx (HASH:1400 7)] ? dev_gro_receive+0x3a/0x620 napi_gro_receive+0xad/0x170 t7xx_ccmni_recv_skb+0x48/0x70 [mtk_t7xx (HASH:1400 7)] t7xx_dpmaif_napi_rx_poll+0x590/0x800 [mtk_t7xx (HASH:1400 7)] net_rx_action+0x103/0x470 irq_exit_rcu+0x13a/0x310 sysvec_apic_timer_interrupt+0x56/0x90 </IRQ>
--- drivers/net/wwan/t7xx/t7xx_netdev.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/wwan/t7xx/t7xx_netdev.c +6 -5
@@ -296,7 +296,7 @@ static int t7xx_ccmni_wwan_newlink(void *ctxt, struct net_device *dev, u32 if_id ccmni->ctlb = ctlb; ccmni->dev = dev;atomic_set (&ccmni->usage,0 ); - ctlb->ccmni_inst[if_id] = ccmni; +WRITE_ONCE (ctlb->ccmni_inst[if_id], ccmni); ret =register_netdevice (dev);if (ret)
@@ -318,6 +318,7 @@ static void t7xx_ccmni_wwan_dellink(void *ctxt, struct net_device *dev, struct lif (WARN_ON (ctlb->ccmni_inst[if_id] != ccmni))return ; +WRITE_ONCE (ctlb->ccmni_inst[if_id],NULL );unregister_netdevice (dev); }
@@ -413,7 +414,7 @@ static void t7xx_ccmni_recv_skb(struct t7xx_ccmni_ctrl *ccmni_ctlb, struct sk_bu skb_cb =T7XX_SKB_CB (skb); netif_id = skb_cb->netif_idx; - ccmni = ccmni_ctlb->ccmni_inst[netif_id]; + ccmni =READ_ONCE (ccmni_ctlb->ccmni_inst[netif_id]);if (!ccmni) {dev_kfree_skb (skb);return ;
@@ -435,7 +436,7 @@ static void t7xx_ccmni_recv_skb(struct t7xx_ccmni_ctrl *ccmni_ctlb, struct sk_bustatic void t7xx_ccmni_queue_tx_irq_notify (struct t7xx_ccmni_ctrl *ctlb,int qno) { -struct t7xx_ccmni *ccmni = ctlb->ccmni_inst[0 ]; +struct t7xx_ccmni *ccmni =READ_ONCE (ctlb->ccmni_inst[0 ]);struct netdev_queue *net_queue;if (netif_running (ccmni->dev) &&atomic_read (&ccmni->usage) >0 ) {
@@ -447,7 +448,7 @@ static void t7xx_ccmni_queue_tx_irq_notify(struct t7xx_ccmni_ctrl *ctlb, int qnostatic void t7xx_ccmni_queue_tx_full_notify (struct t7xx_ccmni_ctrl *ctlb,int qno) { -struct t7xx_ccmni *ccmni = ctlb->ccmni_inst[0 ]; +struct t7xx_ccmni *ccmni =READ_ONCE (ctlb->ccmni_inst[0 ]);struct netdev_queue *net_queue;if (atomic_read (&ccmni->usage) >0 ) {
@@ -465,7 +466,7 @@ static void t7xx_ccmni_queue_state_notify(struct t7xx_pci_dev *t7xx_dev,if (ctlb->md_sta !=MD_STATE_READY )return ; -if (!ctlb->ccmni_inst[0 ]) { +if (!READ_ONCE (ctlb->ccmni_inst[0 ])) {dev_warn (&t7xx_dev->pdev->dev,"No netdev registered yet\n" );return ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 260/356 vmxnet3: correctly report gso type for UDP tunnels
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ronak Doshi <[email protected]>
[ Upstream commit 982d30c30eaa2ec723df42e3bf526c014c1dbb88 ]
Commit 3d010c8031e3 ("udp: do not accept non-tunnel GSO skbs landing in a tunnel") added checks in linux stack to not accept non-tunnel GRO packets landing in a tunnel. This exposed an issue in vmxnet3 which was not correctly reporting GRO packets for tunnel packets.
This patch fixes this issue by setting correct GSO type for the tunnel packets.
Currently, vmxnet3 does not support reporting inner fields for LRO tunnel packets. The issue is not seen for egress drivers that do not use skb inner fields. The workaround is to enable tnl-segmentation offload on the egress interfaces if the driver supports it. This problem pre-exists this patch fix and can be addressed as a separate future patch.
--- drivers/net/vmxnet3/vmxnet3_drv.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/net/vmxnet3/vmxnet3_drv.c +26 -0
@@ -1499,6 +1499,30 @@ vmxnet3_get_hdr_len(struct vmxnet3_adapter *adapter, struct sk_buff *skb,return (hlen + (hdr.tcp->doff <<2 )); } +static void +vmxnet3_lro_tunnel (struct sk_buff *skb,__be16 ip_proto) +{ +struct udphdr *uh =NULL ; + +if (ip_proto ==htons (ETH_P_IP )) { +struct iphdr *iph = (struct iphdr *)skb->data; + +if (iph->protocol ==IPPROTO_UDP ) + uh = (struct udphdr *)(iph +1 ); + }else { +struct ipv6hdr *iph = (struct ipv6hdr *)skb->data; + +if (iph->nexthdr ==IPPROTO_UDP ) + uh = (struct udphdr *)(iph +1 ); + } +if (uh) { +if (uh->check) +skb_shinfo (skb)->gso_type |=SKB_GSO_UDP_TUNNEL_CSUM ; +else +skb_shinfo (skb)->gso_type |=SKB_GSO_UDP_TUNNEL ; + } +} +static int vmxnet3_rq_rx_complete (struct vmxnet3_rx_queue *rq,struct vmxnet3_adapter *adapter,int quota)
@@ -1803,6 +1827,8 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,if (segCnt !=0 && mss !=0 ) {skb_shinfo (skb)->gso_type = rcd->v4 ?SKB_GSO_TCPV4 :SKB_GSO_TCPV6 ; +if (encap_lro) +vmxnet3_lro_tunnel (skb, skb->protocol);skb_shinfo (skb)->gso_size = mss;skb_shinfo (skb)->gso_segs = segCnt; }else if ((segCnt !=0 || skb->len > mtu) && !encap_lro) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 261/356 PM: sleep: Fix power.is_suspended cleanup for direct-complete devices
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit d46c4c839c20a599a0eb8d73708ce401f9c7d06d ]
Commit 03f1444016b7 ("PM: sleep: Fix handling devices with direct_complete set on errors") caused power.is_suspended to be set for devices with power.direct_complete set, but it forgot to ensure the clearing of that flag for them in device_resume(), so power.is_suspended is still set for them during the next system suspend-resume cycle.
If that cycle is aborted in dpm_suspend(), the subsequent invocation of dpm_resume() will trigger a device_resume() call for every device and because power.is_suspended is set for the devices in question, they will not be skipped by device_resume() as expected which causes scary error messages to be logged (as appropriate).
To address this issue, move the clearing of power.is_suspended in device_resume() immediately after the power.is_suspended check so it will be always cleared for all devices processed by that function.
--- drivers/base/power/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/base/power/main.c +2 -1
@@ -897,6 +897,8 @@ static void __device_resume(struct device *dev, pm_message_t state, bool async)if (!dev->power.is_suspended) goto Complete; + dev->power.is_suspended = false; +if (dev->power.direct_complete) {/* Match the pm_runtime_disable() in __device_suspend(). */ pm_runtime_enable (dev);
@@ -952,7 +954,6 @@ static void __device_resume(struct device *dev, pm_message_t state, bool async) End: error =dpm_run_callback (callback, dev, state, info); - dev->power.is_suspended = false;device_unlock (dev);dpm_watchdog_clear (&wd);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 262/356 gve: add missing NULL check for gve_alloc_pending_packet() in TX DQO
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alok Tiwari <[email protected]>
[ Upstream commit 12c331b29c7397ac3b03584e12902990693bc248 ]
gve_alloc_pending_packet() can return NULL, but gve_tx_add_skb_dqo() did not check for this case before dereferencing the returned pointer.
Add a missing NULL check to prevent a potential NULL pointer dereference when allocation fails.
This improves robustness in low-memory scenarios.
--- drivers/net/ethernet/google/gve/gve_tx_dqo.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/google/gve/gve_tx_dqo.c +3 -0
@@ -716,6 +716,9 @@ static int gve_tx_add_skb_dqo(struct gve_tx_ring *tx,s16 completion_tag; pkt =gve_alloc_pending_packet (tx); +if (!pkt) +return -ENOMEM ; + pkt->skb = skb; completion_tag = pkt - tx->dqo.pending_packets;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 263/356 netfilter: nf_set_pipapo_avx2: fix initial map fill
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit ea77c397bff8b6d59f6d83dae1425b08f465e8b5 ]
If the first field doesn't cover the entire start map, then we must zero out the remainder, else we leak those bits into the next match round map.
The early fix was incomplete and did only fix up the generic C implementation.
A followup patch adds a test case to nft_concat_range.sh.
--- net/netfilter/nft_set_pipapo_avx2.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
net/netfilter/nft_set_pipapo_avx2.c +20 -1
@@ -1113,6 +1113,25 @@ bool nft_pipapo_avx2_estimate(const struct nft_set_desc *desc, u32 features,return true; } +/** +* pipapo_resmap_init_avx2() - Initialise result map before first use +* @m: Matching data, including mapping table +* @res_map: Result map +* +* Like pipapo_resmap_init() but do not set start map bits covered by the first field. +*/ +static inline void pipapo_resmap_init_avx2 (const struct nft_pipapo_match *m,unsigned long *res_map) +{ +const struct nft_pipapo_field *f = m->f; +int i; + +/* Starting map doesn't need to be set to all-ones for this implementation, +* but we do need to zero the remaining bits, if any. +*/ +for (i = f->bsize; i < m->bsize_max; i++) + res_map[i] =0ul ; +} +/** * nft_pipapo_avx2_lookup() - Lookup function for AVX2 implementation * @net: Network namespace
@@ -1171,7 +1190,7 @@ bool nft_pipapo_avx2_lookup(const struct net *net, const struct nft_set *set, res = scratch->map + (map_index ? m->bsize_max :0 ); fill = scratch->map + (map_index ?0 : m->bsize_max); -/* Starting map doesn't need to be set for this implementation */ +pipapo_resmap_init_avx2 (m, res);nft_pipapo_avx2_prepare ();
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 264/356 netfilter: nf_nat: also check reverse tuple to obtain clashing entry
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 50d9ce9679dd50df2dc51ada717fa875bc248fad ]
The logic added in the blamed commit was supposed to only omit nat source port allocation if neither the existing nor the new entry are subject to NAT.
However, its not enough to lookup the conntrack based on the proposed tuple, we must also check the reverse direction.
Otherwise there are esoteric cases where the collision is in the reverse direction because that colliding connection has a port rewrite, but the new entry doesn't. In this case, we only check the new entry and then erronously conclude that no clash exists anymore.
The existing (udp) tuple is:
a:p -> b:P, with nat translation to s:P, i.e. pure daddr rewrite, reverse tuple in conntrack table is s:P -> a:p.
When another UDP packet is sent directly to s, i.e. a:p->s:P, this is correctly detected as a colliding entry: tuple is taken by existing reply tuple in reverse direction.
But the colliding conntrack is only searched for with unreversed direction, and we can't find such entry matching a:p->s:P.
The incorrect conclusion is that the clashing entry has timed out and that no port address translation is required.
Such conntrack will then be discarded at nf_confirm time because the proposed reverse direction clashes with an existing mapping in the conntrack table.
Search for the reverse tuple too, this will then check the NAT bits of the colliding entry and triggers port reallocation.
Followp patch extends nft_nat.sh selftest to cover this scenario.
The IPS_SEQ_ADJUST change is also a bug fix:
Instead of checking for SEQ_ADJ this tested for SEEN_REPLY and ASSURED by accident -- _BIT is only for use with the test_bit() API.
This bug has little consequence in practice, because the sequence number adjustments are only useful for TCP which doesn't support clash resolution.
The existing test case (conntrack_reverse_clash.sh) exercise a race condition path (parallel conntrack creation on different CPUs), so the colliding entries have neither SEEN_REPLY nor ASSURED set.
Thanks to Yafang Shao and Shaun Brady for an initial investigation of this bug.
--- net/netfilter/nf_nat_core.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
net/netfilter/nf_nat_core.c +9 -3
@@ -248,7 +248,7 @@ static noinline bool nf_nat_used_tuple_new(const struct nf_conntrack_tuple *tuple, const struct nf_conn *ignored_ct) { -static const unsigned long uses_nat =IPS_NAT_MASK |IPS_SEQ_ADJUST_BIT ; +static const unsigned long uses_nat =IPS_NAT_MASK |IPS_SEQ_ADJUST ;const struct nf_conntrack_tuple_hash *thash;const struct nf_conntrack_zone *zone;struct nf_conn *ct;
@@ -287,8 +287,14 @@ nf_nat_used_tuple_new(const struct nf_conntrack_tuple *tuple, zone =nf_ct_zone (ignored_ct); thash =nf_conntrack_find_get (net, zone, tuple); -if (unlikely (!thash))/* clashing entry went away */ -return false; +if (unlikely (!thash)) { +struct nf_conntrack_tuple reply; + +nf_ct_invert_tuple (&reply, tuple); + thash =nf_conntrack_find_get (net, zone, &reply); +if (!thash)/* clashing entry went away */ +return false; + } ct =nf_ct_tuplehash_to_ctrack (thash);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 265/356 net: dsa: b53: do not enable RGMII delay on bcm63xx
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Gorski <[email protected]>
[ Upstream commit 4af523551d876ab8b8057d1e5303a860fd736fcb ]
bcm63xx's RGMII ports are always in MAC mode, never in PHY mode, so we shouldn't enable any delays and let the PHY handle any delays as necessary.
This fixes using RGMII ports with normal PHYs like BCM54612E, which will handle the delay in the PHY.
--- drivers/net/dsa/b53/b53_common.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-)
drivers/net/dsa/b53/b53_common.c +1 -18
@@ -1237,24 +1237,7 @@ static void b53_adjust_63xx_rgmii(struct dsa_switch *ds, int port, off =B53_RGMII_CTRL_P (port);b53_read8 (dev,B53_CTRL_PAGE , off, &rgmii_ctrl); - -switch (interface) { -case PHY_INTERFACE_MODE_RGMII_ID : - rgmii_ctrl |= (RGMII_CTRL_DLL_RXC |RGMII_CTRL_DLL_TXC ); -break ; -case PHY_INTERFACE_MODE_RGMII_RXID : - rgmii_ctrl &= ~(RGMII_CTRL_DLL_TXC ); - rgmii_ctrl |=RGMII_CTRL_DLL_RXC ; -break ; -case PHY_INTERFACE_MODE_RGMII_TXID : - rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC ); - rgmii_ctrl |=RGMII_CTRL_DLL_TXC ; -break ; -case PHY_INTERFACE_MODE_RGMII : -default : - rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC |RGMII_CTRL_DLL_TXC ); -break ; - } + rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC |RGMII_CTRL_DLL_TXC );if (port != dev->imp_port) {if (is63268 (dev))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 266/356 net: dsa: b53: allow RGMII for bcm63xx RGMII ports
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Gorski <[email protected]>
[ Upstream commit 5ea0d42c1980e6d10e5cb56a78021db5bfcebaaf ]
Add RGMII to supported interfaces for BCM63xx RGMII ports so they can be actually used in RGMII mode.
Without this, phylink will fail to configure them:
[ 3.580000] b53-switch 10700000.switch GbE3 (uninitialized): validation of rgmii with support 0000000,00000000,00000000,000062ff and advertisement 0000000,00000000,00000000,000062ff failed: -EINVAL [ 3.600000] b53-switch 10700000.switch GbE3 (uninitialized): failed to connect to PHY: -EINVAL [ 3.610000] b53-switch 10700000.switch GbE3 (uninitialized): error -22 setting up PHY for tree 0, switch 0, port 4
--- drivers/net/dsa/b53/b53_common.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/dsa/b53/b53_common.c +4 -0
@@ -1377,6 +1377,10 @@ static void b53_phylink_get_caps(struct dsa_switch *ds, int port,__set_bit (PHY_INTERFACE_MODE_MII , config->supported_interfaces);__set_bit (PHY_INTERFACE_MODE_REVMII , config->supported_interfaces); +/* BCM63xx RGMII ports support RGMII */ +if (is63xx (dev) &&in_range (port,B53_63XX_RGMII0 ,4 )) +phy_interface_set_rgmii (config->supported_interfaces); + config->mac_capabilities =MAC_ASYM_PAUSE |MAC_SYM_PAUSE |MAC_10 |MAC_100 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 267/356 wireguard: device: enable threaded NAPI
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mirco Barone <[email protected]>
[ Upstream commit db9ae3b6b43c79b1ba87eea849fd65efa05b4b2e ]
Enable threaded NAPI by default for WireGuard devices in response to low performance behavior that we observed when multiple tunnels (and thus multiple wg devices) are deployed on a single host. This affects any kind of multi-tunnel deployment, regardless of whether the tunnels share the same endpoints or not (i.e., a VPN concentrator type of gateway would also be affected).
The problem is caused by the fact that, in case of a traffic surge that involves multiple tunnels at the same time, the polling of the NAPI instance of all these wg devices tends to converge onto the same core, causing underutilization of the CPU and bottlenecking performance.
This happens because NAPI polling is hosted by default in softirq context, but the WireGuard driver only raises this softirq after the rx peer queue has been drained, which doesn't happen during high traffic. In this case, the softirq already active on a core is reused instead of raising a new one.
As a result, once two or more tunnel softirqs have been scheduled on the same core, they remain pinned there until the surge ends.
In our experiments, this almost always leads to all tunnel NAPIs being handled on a single core shortly after a surge begins, limiting scalability to less than 3× the performance of a single tunnel, despite plenty of unused CPU cores being available.
The proposed mitigation is to enable threaded NAPI for all WireGuard devices. This moves the NAPI polling context to a dedicated per-device kernel thread, allowing the scheduler to balance the load across all available cores.
On our 32-core gateways, enabling threaded NAPI yields a ~4× performance improvement with 16 tunnels, increasing throughput from ~13 Gbps to ~48 Gbps. Meanwhile, CPU usage on the receiver (which is the bottleneck) jumps from 20% to 100%.
We have found no performance regressions in any scenario we tested. Single-tunnel throughput remains unchanged.
More details are available in our Netdev paper.
--- drivers/net/wireguard/device.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireguard/device.c +1 -0
@@ -369,6 +369,7 @@ static int wg_newlink(struct net *src_net, struct net_device *dev,if (ret <0 ) goto err_free_handshake_queue; +dev_set_threaded (dev, true); ret =register_netdevice (dev);if (ret <0 ) goto err_uninit_ratelimiter;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 268/356 seg6: Fix validation of nexthop addresses
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit 7632fedb266d93ed0ed9f487133e6c6314a9b2d1 ]
The kernel currently validates that the length of the provided nexthop address does not exceed the specified length. This can lead to the kernel reading uninitialized memory if user space provided a shorter length than the specified one.
Fix by validating that the provided length exactly matches the specified one.
--- net/ipv6/seg6_local.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
net/ipv6/seg6_local.c +2 -4
@@ -1638,10 +1638,8 @@ static const struct nla_policy seg6_local_policy[SEG6_LOCAL_MAX + 1] = { [SEG6_LOCAL_SRH] = { .type = NLA_BINARY }, [SEG6_LOCAL_TABLE] = { .type = NLA_U32 }, [SEG6_LOCAL_VRFTABLE] = { .type = NLA_U32 }, - [SEG6_LOCAL_NH4] = { .type = NLA_BINARY, - .len = sizeof(struct in_addr) }, - [SEG6_LOCAL_NH6] = { .type = NLA_BINARY, - .len = sizeof(struct in6_addr) }, + [SEG6_LOCAL_NH4] = NLA_POLICY_EXACT_LEN(sizeof(struct in_addr)), + [SEG6_LOCAL_NH6] = NLA_POLICY_EXACT_LEN(sizeof(struct in6_addr)), [SEG6_LOCAL_IIF] = { .type = NLA_U32 }, [SEG6_LOCAL_OIF] = { .type = NLA_U32 }, [SEG6_LOCAL_BPF] = { .type = NLA_NESTED },
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 269/356 scsi: ufs: qcom: Prevent calling phy_exit() before phy_init()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nitin Rawat <[email protected]>
[ Upstream commit 7831003165d37ecb7b33843fcee05cada0359a82 ]
Prevent calling phy_exit() before phy_init() to avoid abnormal power count and the following warning during boot up.
[5.146763] phy phy-1d80000.phy.0: phy_power_on was called before phy_init
--- drivers/ufs/host/ufs-qcom.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/ufs/host/ufs-qcom.c +2 -3
@@ -453,10 +453,9 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)dev_warn (hba->dev,"%s: host reset returned %d\n" , __func__, ret); -if (phy->power_count) { +if (phy->power_count)phy_power_off (phy); -phy_exit (phy); - } +/* phy initialization - calibrate the phy */ ret =phy_init (phy);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 270/356 ASoC: codecs: hda: Fix RPM usage count underflow
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit ff0045de4ee0288dec683690f66f2f369b7d3466 ]
RPM manipulation in hda_codec_probe_complete()'s error path is superfluous and leads to RPM usage count underflow if the build-controls operation fails.
hda_codec_probe_complete() is called in:
1) hda_codec_probe() for all non-HDMI codecs
2) in card->late_probe() for HDMI codecs
Error path for hda_codec_probe() takes care of bus' RPM already. For 2) if late_probe() fails, ASoC performs card cleanup what triggers hda_codec_remote() - same treatment is in 1).
--- sound/soc/codecs/hda.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/hda.c +2 -2
@@ -150,7 +150,7 @@ int hda_codec_probe_complete(struct hda_codec *codec) ret =snd_hda_codec_build_controls (codec);if (ret <0 ) {dev_err (&hdev->dev,"unable to create controls %d\n" , ret); - goto out; +return ret; }/* Bus suspended codecs as it does not manage their pm */
@@ -158,7 +158,7 @@ int hda_codec_probe_complete(struct hda_codec *codec)/* rpm was forbidden in snd_hda_codec_device_new() */ snd_hda_codec_set_power_save (codec,2000 );snd_hda_codec_register (codec); -out: +/* Complement pm_runtime_get_sync(bus) in probe */ pm_runtime_mark_last_busy (bus->dev);pm_runtime_put_autosuspend (bus->dev);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 271/356 ASoC: Intel: avs: Fix deadlock when the failing IPC is SET_D0IX
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit 9ad1f3cd0d60444c69948854c7e50d2a61b63755 ]
The procedure handling IPC timeouts and EXCEPTION_CAUGHT notification shall cancel any D0IX work before proceeding with DSP recovery. If SET_D0IX called from delayed_work is the failing IPC the procedure will deadlock. Conditionally skip cancelling the work to fix that.
--- sound/soc/intel/avs/ipc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/intel/avs/ipc.c +3 -1
@@ -169,7 +169,9 @@ static void avs_dsp_exception_caught(struct avs_dev *adev, union avs_notify_msgdev_crit (adev->dev,"communication severed, rebooting dsp..\n" ); -cancel_delayed_work_sync (&ipc->d0ix_work); +/* Avoid deadlock as the exception may be the response to SET_D0IX. */ +if (current_work () != &ipc->d0ix_work.work) +cancel_delayed_work_sync (&ipc->d0ix_work); ipc->in_d0ix = false;/* Re-enabled on recovery completion. */ pm_runtime_disable (adev->dev);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 272/356 ASoC: Intel: avs: Verify content returned by parse_int_array()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit 93e246b6769bdacb09cfff4ea0f00fe5ab4f0d7a ]
The first element of the returned array stores its length. If it is 0, any manipulation beyond the element at index 0 ends with null-ptr-deref.
--- sound/soc/intel/avs/debugfs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/intel/avs/debugfs.c +5 -1
@@ -371,7 +371,10 @@ static ssize_t trace_control_write(struct file *file, const char __user *from, sreturn ret; num_elems = *array; - resource_mask = array[1 ]; +if (!num_elems) { + ret = -EINVAL ; + goto free_array; + }/* * Disable if just resource mask is provided - no log priority flags.
@@ -379,6 +382,7 @@ static ssize_t trace_control_write(struct file *file, const char __user *from, s* Enable input format: mask, prio1, .., prioN * Where 'N' equals number of bits set in the 'mask'. */ + resource_mask = array[1 ];if (num_elems ==1 ) { ret =disable_logs (adev, resource_mask); }else {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 273/356 ASoC: ti: omap-hdmi: Re-add dai_link->platform to fix card init
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuuki NAGAO <[email protected]>
[ Upstream commit bae071aa7bcd034054cec91666c80f812adeccd9 ]
The removed dai_link->platform component cause a fail which is exposed at runtime. (ex: when a sound tool is used) This patch re-adds the dai_link->platform component to have a full card registered.
Before this patch:
$ aplay -l **** List of PLAYBACK Hardware Devices **** card 1: HDMI [HDMI], device 0: HDMI snd-soc-dummy-dai-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0
$ speaker-test -D plughw:1,0 -t sine speaker-test 1.2.8 Playback device is plughw:1,0 Stream parameters are 48000Hz, S16_LE, 1 channels Sine wave rate is 440.0000Hz Playback open error: -22,Invalid argument
After this patch which restores the platform component:
$ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: HDMI [HDMI], device 0: HDMI snd-soc-dummy-dai-0 [HDMI snd-soc-dummy-dai-0] Subdevices: 0/1 Subdevice #0: subdevice #0
-> Resolve the playback error.
--- sound/soc/ti/omap-hdmi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
sound/soc/ti/omap-hdmi.c +5 -2
@@ -361,17 +361,20 @@ static int omap_hdmi_audio_probe(struct platform_device *pdev)if (!card->dai_link)return -ENOMEM ; - compnent =devm_kzalloc (dev,sizeof (*compnent),GFP_KERNEL ); + compnent =devm_kzalloc (dev,2 *sizeof (*compnent),GFP_KERNEL );if (!compnent)return -ENOMEM ; - card->dai_link->cpus = compnent; + card->dai_link->cpus = &compnent[0 ]; card->dai_link->num_cpus =1 ; card->dai_link->codecs = &asoc_dummy_dlc; card->dai_link->num_codecs =1 ; + card->dai_link->platforms = &compnent[1 ]; + card->dai_link->num_platforms =1 ; card->dai_link->name = card->name; card->dai_link->stream_name = card->name; card->dai_link->cpus->dai_name =dev_name (ad->dssdev); + card->dai_link->platforms->name =dev_name (ad->dssdev); card->num_links =1 ; card->dev = dev;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 274/356 path_overmount(): avoid false negatives
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit 5f31c549382bcddbbd754c72c5433b19420d485d ]
Holding namespace_sem is enough to make sure that result remains valid. It is *not* enough to avoid false negatives from __lookup_mnt(). Mounts can be unhashed outside of namespace_sem (stuck children getting detached on final mntput() of lazy-umounted mount) and having an unrelated mount removed from the hash chain while we traverse it may end up with false negative from __lookup_mnt(). We need to sample and recheck the seqlock component of mount_lock...
Bug predates the introduction of path_overmount() - it had come from the code in finish_automount() that got abstracted into that helper.
--- fs/namespace.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
fs/namespace.c +13 -6
@@ -3020,18 +3020,25 @@ static int do_set_group(struct path *from_path, struct path *to_path)* Check if path is overmounted, i.e., if there's a mount on top of * @path->mnt with @path->dentry as mountpoint. * -* Context: This function expects namespace_lock() to be held. +* Context: namespace_sem must be held at least shared. +* MUST NOT be called under lock_mount_hash() (there one should just +* call __lookup_mnt() and check if it returns NULL). * Return: If path is overmounted true is returned, false if not. */ static inline bool path_overmounted (const struct path *path) { +unsigned seq =read_seqbegin (&mount_lock); +bool no_child; +rcu_read_lock (); -if (unlikely (__lookup_mnt (path->mnt, path->dentry))) { -rcu_read_unlock (); -return true; - } + no_child = !__lookup_mnt (path->mnt, path->dentry);rcu_read_unlock (); -return false; +if (need_seqretry (&mount_lock, seq)) { +read_seqlock_excl (&mount_lock); + no_child = !__lookup_mnt (path->mnt, path->dentry); +read_sequnlock_excl (&mount_lock); + } +return unlikely (!no_child); }/**
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 275/356 fix propagation graph breakage by MOVE_MOUNT_SET_GROUP move_mount(2)
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit d8cc0362f918d020ca1340d7694f07062dc30f36 ]
9ffb14ef61ba "move_mount: allow to add a mount into an existing group" breaks assertions on ->mnt_share/->mnt_slave. For once, the data structures in question are actually documented.
Documentation/filesystem/sharedsubtree.rst:
All vfsmounts in a peer group have the same ->mnt_master. If it is non-NULL, they form a contiguous (ordered) segment of slave list.
do_set_group() puts a mount into the same place in propagation graph as the old one. As the result, if old mount gets events from somewhere and is not a pure event sink, new one needs to be placed next to the old one in the slave list the old one's on. If it is a pure event sink, we only need to make sure the new one doesn't end up in the middle of some peer group.
"move_mount: allow to add a mount into an existing group" ends up putting the new one in the beginning of list; that's definitely not going to be in the middle of anything, so that's fine for case when old is not marked shared. In case when old one _is_ marked shared (i.e. is not a pure event sink), that breaks the assumptions of propagation graph iterators.
Put the new mount next to the old one on the list - that does the right thing in "old is marked shared" case and is just as correct as the current behaviour if old is not marked shared (kudos to Pavel for pointing that out - my original suggested fix changed behaviour in the "nor marked" case, which complicated things for no good reason).
--- fs/namespace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/namespace.c +1 -1
@@ -2995,7 +2995,7 @@ static int do_set_group(struct path *from_path, struct path *to_path)if (IS_MNT_SLAVE (from)) {struct mount *m = from->mnt_master; -list_add (&to->mnt_slave, &m->mnt_slave_list); +list_add (&to->mnt_slave, &from->mnt_slave); to->mnt_master = m; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 276/356 do_change_type(): refuse to operate on unmounted/not ours mounts
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit 12f147ddd6de7382dad54812e65f3f08d05809fc ]
Ensure that propagation settings can only be changed for mounts located in the caller's mount namespace. This change aligns permission checking with the rest of mount(2).
--- fs/namespace.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/namespace.c +4 -0
@@ -2557,6 +2557,10 @@ static int do_change_type(struct path *path, int ms_flags)return -EINVAL ;namespace_lock (); +if (!check_mnt (mnt)) { + err = -EINVAL ; + goto out_unlock; + }if (type ==MS_SHARED ) { err =invent_group_ids (mnt, recurse);if (err)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 277/356 net: dsa: microchip: update tag_ksz masks for KSZ9477 family
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pieter Van Trappen <[email protected]>
[ Upstream commit 3f464b193d40e49299dcd087b10cc3b77cbbea68 ]
Remove magic number 7 by introducing a GENMASK macro instead. Remove magic number 0x80 by using the BIT macro instead.
Stable-dep-of: ba54bce747fa ("net: dsa: microchip: linearize skb for tail-tagging switches")
--- net/dsa/tag_ksz.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/dsa/tag_ksz.c +3 -2
@@ -176,8 +176,9 @@ MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ8795, KSZ8795_NAME);#define KSZ9477_INGRESS_TAG_LEN 2#define KSZ9477_PTP_TAG_LEN 4 -#define KSZ9477_PTP_TAG_INDICATION 0x80 +#define KSZ9477_PTP_TAG_INDICATION BIT(7) +#define KSZ9477_TAIL_TAG_EG_PORT_M GENMASK(2, 0)#define KSZ9477_TAIL_TAG_PRIO GENMASK(8, 7)#define KSZ9477_TAIL_TAG_OVERRIDE BIT(9)#define KSZ9477_TAIL_TAG_LOOKUP BIT(10)
@@ -302,7 +303,7 @@ static struct sk_buff *ksz9477_rcv(struct sk_buff *skb, struct net_device *dev) {/* Tag decoding */ u8 *tag =skb_tail_pointer (skb) -KSZ_EGRESS_TAG_LEN ; -unsigned int port = tag[0 ] &7 ; +unsigned int port = tag[0 ] &KSZ9477_TAIL_TAG_EG_PORT_M ;unsigned int len =KSZ_EGRESS_TAG_LEN ;/* Extra 4-bytes PTP timestamp */
Signature · 1 line
2.39.5
Re: [PATCH 6.6 277/356] net: dsa: microchip: update tag_ksz masks for KSZ9477 family
Quoted 1 line · Greg Kroah-Hartman
6.6-stable review patch. If anyone has any objections, please let me know.
Hi Greg, no objection since it's a cosmetic patch really. However there's two related commits from 6.12 upstream that are worth considering and do contain fixes, see below. I checked with stable linux-6.6.y and they don't apply cleanly but resolving the merge conflicts is easy enough; not sure if that's worth the hassle and how to go about it - let me know.
6f2b72c04d58a40c16f3cd858776517f162261190d3edc90c4a0ac77332a25e1e6b709a39b202de9
Cheers, Pieter
Quoted 43 lines
------------------
From: Pieter Van Trappen <[email protected]>
[ Upstream commit
3f464b193d40e49299dcd087b10cc3b77cbbea68]Remove magic number 7 by introducing a GENMASK macro instead. Remove magic number
0x80by using the BIT macro instead.Signed-off-by Pieter Van Trappen <[email protected]>Reviewed-by Florian Fainelli <[email protected]>Signed-off-by Jakub Kicinski <[email protected]>Stable-dep-of:
ba54bce747fa("net: dsa: microchip: linearize skb for tail-tagging switches")Signed-off-by Sasha Levin <[email protected]>--- net/dsa/tag_ksz.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)net/dsa/tag_ksz.c +3
-2@@ -176,8 +176,9 @@ MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ8795, KSZ8795_NAME);#define KSZ9477_INGRESS_TAG_LEN 2#define KSZ9477_PTP_TAG_LEN 4 -#define KSZ9477_PTP_TAG_INDICATION 0x80 +#define KSZ9477_PTP_TAG_INDICATION BIT(7) +#define KSZ9477_TAIL_TAG_EG_PORT_M GENMASK(2, 0)#define KSZ9477_TAIL_TAG_PRIO GENMASK(8, 7)#define KSZ9477_TAIL_TAG_OVERRIDE BIT(9)#define KSZ9477_TAIL_TAG_LOOKUP BIT(10)@@ -302,7 +303,7 @@ static struct sk_buff *ksz9477_rcv(struct sk_buff *skb, struct net_device *dev) {/* Tag decoding */ u8 *tag =skb_tail_pointer (skb) -KSZ_EGRESS_TAG_LEN ; -unsigned int port = tag[0 ] &7 ; +unsigned int port = tag[0 ] &KSZ9477_TAIL_TAG_EG_PORT_M ;unsigned int len =KSZ_EGRESS_TAG_LEN ;/* Extra 4-bytes PTP timestamp */
Greg Kroah-Hartman
maintainerRe: [PATCH 6.6 277/356] net: dsa: microchip: update tag_ksz masks for KSZ9477 family
Quoted 11 lines · Pieter Van Trappen
Quoted 1 line · Greg Kroah-Hartman
6.6-stable review patch. If anyone has any objections, please let me know.
Hi Greg, no objection since it's a cosmetic patch really. However there's two related commits from 6.12 upstream that are worth considering and do contain fixes, see below. I checked with stable linux-6.6.y and they don't apply cleanly but resolving the merge conflicts is easy enough; not sure if that's worth the hassle and how to go about it - let me know.
6f2b72c04d58a40c16f3cd858776517f162261190d3edc90c4a0ac77332a25e1e6b709a39b202de9
Thanks for letting me know, I've just dropped this, and the patch after this from all queues.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 278/356 net: dsa: microchip: linearize skb for tail-tagging switches
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakob Unterwurzacher <[email protected]>
[ Upstream commit ba54bce747fa9e07896c1abd9b48545f7b4b31d2 ]
The pointer arithmentic for accessing the tail tag only works for linear skbs.
For nonlinear skbs, it reads uninitialized memory inside the skb headroom, essentially randomizing the tag. I have observed it gets set to 6 most of the time.
Example where ksz9477_rcv thinks that the packet from port 1 comes from port 6 (which does not exist for the ksz9896 that's in use), dropping the packet. Debug prints added by me (not included in this patch):
[ 256.645337] ksz9477_rcv:323 tag0=6 [ 256.645349] skb len=47 headroom=78 headlen=0 tailroom=0 mac=(64,14) mac_len=14 net=(78,0) trans=78 shinfo(txflags=0 nr_frags=1 gso(size=0 type=0 segs=0)) csum(0x0 start=0 offset=0 ip_summed=0 complete_sw=0 valid=0 level=0) hash(0x0 sw=0 l4=0) proto=0x00f8 pkttype=1 iif=3 priority=0x0 mark=0x0 alloc_cpu=0 vlan_all=0x0 encapsulation=0 inner(proto=0x0000, mac=0, net=0, trans=0) [ 256.645377] dev name=end1 feat=0x0002e10200114bb3 [ 256.645386] skb headroom: 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 256.645395] skb headroom: 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 256.645403] skb headroom: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 256.645411] skb headroom: 00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 256.645420] skb headroom: 00000040: ff ff ff ff ff ff 00 1c 19 f2 e2 db 08 06 [ 256.645428] skb frag: 00000000: 00 01 08 00 06 04 00 01 00 1c 19 f2 e2 db 0a 02 [ 256.645436] skb frag: 00000010: 00 83 00 00 00 00 00 00 0a 02 a0 2f 00 00 00 00 [ 256.645444] skb frag: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 [ 256.645452] ksz_common_rcv:92 dsa_conduit_find_user returned NULL
Call skb_linearize before trying to access the tag.
This patch fixes ksz9477_rcv which is used by the ksz9896 I have at hand, and also applies the same fix to ksz8795_rcv which seems to have the same problem.
--- net/dsa/tag_ksz.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
net/dsa/tag_ksz.c +15 -4
@@ -139,7 +139,12 @@ static struct sk_buff *ksz8795_xmit(struct sk_buff *skb, struct net_device *dev)static struct sk_buff *ksz8795_rcv (struct sk_buff *skb,struct net_device *dev) { -u8 *tag =skb_tail_pointer (skb) -KSZ_EGRESS_TAG_LEN ; +u8 *tag; + +if (skb_linearize (skb)) +return NULL ; + + tag =skb_tail_pointer (skb) -KSZ_EGRESS_TAG_LEN ;return ksz_common_rcv (skb, dev, tag[0 ] &7 ,KSZ_EGRESS_TAG_LEN ); }
@@ -301,10 +306,16 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb,static struct sk_buff *ksz9477_rcv (struct sk_buff *skb,struct net_device *dev) { -/* Tag decoding */ -u8 *tag =skb_tail_pointer (skb) -KSZ_EGRESS_TAG_LEN ; -unsigned int port = tag[0 ] &KSZ9477_TAIL_TAG_EG_PORT_M ;unsigned int len =KSZ_EGRESS_TAG_LEN ; +unsigned int port; +u8 *tag; + +if (skb_linearize (skb)) +return NULL ; + +/* Tag decoding */ + tag =skb_tail_pointer (skb) -KSZ_EGRESS_TAG_LEN ; + port = tag[0 ] &KSZ9477_TAIL_TAG_EG_PORT_M ;/* Extra 4-bytes PTP timestamp */ if (tag[0 ] &KSZ9477_PTP_TAG_INDICATION ) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 279/356 pmdomain: core: Fix error checking in genpd_dev_pm_attach_by_id()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 0f5757667ec0aaf2456c3b76fcf0c6c3ea3591fe ]
The error checking for of_count_phandle_with_args() does not handle negative error codes correctly. The problem is that "index" is a u32 so in the condition "if (index >= num_domains)" negative error codes stored in "num_domains" are type promoted to very high positive values and "index" is always going to be valid.
Test for negative error codes first and then test if "index" is valid.
--- drivers/base/power/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/domain.c +1 -1
@@ -2856,7 +2856,7 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev,/* Verify that the index is within a valid range. */ num_domains =of_count_phandle_with_args (dev->of_node,"power-domains" ,"#power-domain-cells" ); -if (index >= num_domains) +if (num_domains <0 || index >= num_domains)return NULL ;/* Allocate and register device on the genpd bus. */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 280/356 Input: synaptics-rmi - fix crash with unsupported versions of F34
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
[ Upstream commit ca39500f6af9cfe6823dc5aa8fbaed788d6e35b2 ]
Sysfs interface for updating firmware for RMI devices is available even when F34 probe fails. The code checks for presence of F34 "container" pointer and then tries to use the function data attached to the sub-device. F34 assigns the function data early, before it knows if probe will succeed, leaving behind a stale pointer.
Fix this by expanding checks to not only test for presence of F34 "container" but also check if there is driver data assigned to the sub-device, and call dev_set_drvdata() only after we are certain that probe is successful.
This is not a complete fix, since F34 will be freed during firmware update, so there is still a race when fetching and accessing this pointer. This race will be addressed in follow-up changes.
--- drivers/input/rmi4/rmi_f34.c | 135 ++++++++++++++++++++--------------- 1 file changed, 76 insertions(+), 59 deletions(-)
drivers/input/rmi4/rmi_f34.c +76 -59
@@ -4,6 +4,7 @@* Copyright (C) 2016 Zodiac Inflight Innovations */ +#include "linux/device.h" #include <linux/kernel.h> #include <linux/rmi.h> #include <linux/firmware.h>
@@ -298,39 +299,30 @@ static int rmi_f34_update_firmware(struct f34_data *f34,return ret; } -static int rmi_f34_status (struct rmi_function *fn) -{ -struct f34_data *f34 =dev_get_drvdata (&fn->dev); - -/* -* The status is the percentage complete, or once complete, -* zero for success or a negative return code. -*/ -return f34->update_status; -} -static ssize_t rmi_driver_bootloader_id_show (struct device *dev,struct device_attribute *dattr,char *buf) {struct rmi_driver_data *data =dev_get_drvdata (dev); -struct rmi_function *fn = data->f34_container; +struct rmi_function *fn;struct f34_data *f34; -if (fn) { - f34 =dev_get_drvdata (&fn->dev); - -if (f34->bl_version ==5 ) -return sysfs_emit (buf,"%c%c\n" , - f34->bootloader_id[0 ], - f34->bootloader_id[1 ]); -else -return sysfs_emit (buf,"V%d.%d\n" , - f34->bootloader_id[1 ], - f34->bootloader_id[0 ]); - } + fn = data->f34_container; +if (!fn) +return -ENODEV ; -return 0 ; + f34 =dev_get_drvdata (&fn->dev); +if (!f34) +return -ENODEV ; + +if (f34->bl_version ==5 ) +return sysfs_emit (buf,"%c%c\n" , + f34->bootloader_id[0 ], + f34->bootloader_id[1 ]); +else +return sysfs_emit (buf,"V%d.%d\n" , + f34->bootloader_id[1 ], + f34->bootloader_id[0 ]); } static DEVICE_ATTR(bootloader_id, 0444, rmi_driver_bootloader_id_show, NULL);
@@ -343,13 +335,16 @@ static ssize_t rmi_driver_configuration_id_show(struct device *dev,struct rmi_function *fn = data->f34_container;struct f34_data *f34; -if (fn) { - f34 =dev_get_drvdata (&fn->dev); + fn = data->f34_container; +if (!fn) +return -ENODEV ; -return sysfs_emit (buf,"%s\n" , f34->configuration_id); - } + f34 =dev_get_drvdata (&fn->dev); +if (!f34) +return -ENODEV ; -return 0 ; + +return sysfs_emit (buf,"%s\n" , f34->configuration_id); } static DEVICE_ATTR(configuration_id, 0444,
@@ -365,10 +360,14 @@ static int rmi_firmware_update(struct rmi_driver_data *data,if (!data->f34_container) {dev_warn (dev,"%s: No F34 present!\n" , __func__); -return -EINVAL ; +return -ENODEV ; } f34 =dev_get_drvdata (&data->f34_container->dev); +if (!f34) { +dev_warn (dev,"%s: No valid F34 present!\n" , __func__); +return -ENODEV ; + }if (f34->bl_version >=7 ) {if (data->pdt_props &HAS_BSR ) {
@@ -494,10 +493,18 @@ static ssize_t rmi_driver_update_fw_status_show(struct device *dev, char *buf) {struct rmi_driver_data *data =dev_get_drvdata (dev); -int update_status =0 ; +struct f34_data *f34; +int update_status = -ENODEV ; -if (data->f34_container) - update_status =rmi_f34_status (data->f34_container); +/* +* The status is the percentage complete, or once complete, +* zero for success or a negative return code. +*/ +if (data->f34_container) { + f34 =dev_get_drvdata (&data->f34_container->dev); +if (f34) + update_status = f34->update_status; + }return sysfs_emit (buf,"%d\n" , update_status); }
@@ -517,33 +524,21 @@ static const struct attribute_group rmi_firmware_attr_group = { .attrs = rmi_firmware_attrs, }; -static int rmi_f34_probe (struct rmi_function *fn) +static int rmi_f34v5_probe (struct f34_data *f34) { -struct f34_data *f34; -unsigned char f34_queries[9 ]; +struct rmi_function *fn = f34->fn; +u8 f34_queries[9 ];bool has_config_id; -u8 version = fn->fd.function_version; -int ret; - - f34 =devm_kzalloc (&fn->dev,sizeof (struct f34_data ),GFP_KERNEL ); -if (!f34) -return -ENOMEM ; - - f34->fn = fn; -dev_set_drvdata (&fn->dev, f34); - -/* v5 code only supported version 0, try V7 probe */ -if (version >0 ) -return rmi_f34v7_probe (f34); +int error; f34->bl_version =5 ; - ret =rmi_read_block (fn->rmi_dev, fn->fd.query_base_addr, - f34_queries,sizeof (f34_queries)); -if (ret) { + error =rmi_read_block (fn->rmi_dev, fn->fd.query_base_addr, + f34_queries,sizeof (f34_queries)); +if (error) {dev_err (&fn->dev,"%s: Failed to query properties\n" , __func__); -return ret; +return error; } snprintf(f34->bootloader_id, sizeof(f34->bootloader_id),
@@ -569,11 +564,11 @@ static int rmi_f34_probe(struct rmi_function *fn) f34->v5.config_blocks);if (has_config_id) { - ret =rmi_read_block (fn->rmi_dev, fn->fd.control_base_addr, - f34_queries,sizeof (f34_queries)); -if (ret) { + error =rmi_read_block (fn->rmi_dev, fn->fd.control_base_addr, + f34_queries,sizeof (f34_queries)); +if (error) {dev_err (&fn->dev,"Failed to read F34 config ID\n" ); -return ret; +return error; } snprintf(f34->configuration_id, sizeof(f34->configuration_id),
@@ -582,12 +577,34 @@ static int rmi_f34_probe(struct rmi_function *fn) f34_queries[2], f34_queries[3]);rmi_dbg (RMI_DEBUG_FN , &fn->dev,"Configuration ID: %s\n" , - f34->configuration_id); + f34->configuration_id); }return 0 ; } +static int rmi_f34_probe (struct rmi_function *fn) +{ +struct f34_data *f34; +u8 version = fn->fd.function_version; +int error; + + f34 =devm_kzalloc (&fn->dev,sizeof (struct f34_data ),GFP_KERNEL ); +if (!f34) +return -ENOMEM ; + + f34->fn = fn; + +/* v5 code only supported version 0 */ + error = version ==0 ?rmi_f34v5_probe (f34) :rmi_f34v7_probe (f34); +if (error) +return error; + +dev_set_drvdata (&fn->dev, f34); + +return 0 ; +} +int rmi_f34_create_sysfs (struct rmi_device *rmi_dev) {return sysfs_create_group (&rmi_dev->dev.kobj, &rmi_firmware_attr_group);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 281/356 kasan: use unchecked __memset internally
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Konovalov <[email protected]>
[ Upstream commit 01a5ad81637672940844052404678678a0ec8854 ]
KASAN code is supposed to use the unchecked __memset implementation when accessing its metadata.
Change uses of memset to __memset in mm/kasan/.
Stable-dep-of: b6ea95a34cbd ("kasan: avoid sleepable page allocation from atomic context")
--- mm/kasan/report.c | 4 ++-- mm/kasan/shadow.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
mm/kasan/report.c +2 -2
@@ -538,7 +538,7 @@ void kasan_report_invalid_free(void *ptr, unsigned long ip, enum kasan_report_tystart_report (&flags, true); -memset (&info,0 ,sizeof (info)); +__memset (&info,0 ,sizeof (info)); info.type = type; info.access_addr = ptr; info.access_size =0 ;
@@ -576,7 +576,7 @@ bool kasan_report(const void *addr, size_t size, bool is_write,start_report (&irq_flags, true); -memset (&info,0 ,sizeof (info)); +__memset (&info,0 ,sizeof (info)); info.type =KASAN_REPORT_ACCESS ; info.access_addr = addr; info.access_size = size;
mm/kasan/shadow.c +1 -1
@@ -324,7 +324,7 @@ static int kasan_populate_vmalloc_pte(pte_t *ptep, unsigned long addr,if (!page)return -ENOMEM ; -memset ((void *)page,KASAN_VMALLOC_INVALID ,PAGE_SIZE ); +__memset ((void *)page,KASAN_VMALLOC_INVALID ,PAGE_SIZE ); pte =pfn_pte (PFN_DOWN (__pa (page)),PAGE_KERNEL );spin_lock (&init_mm.page_table_lock);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 282/356 arm64: dts: ti: k3-am65-main: Fix sdhci node properties
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Judith Mendez <[email protected]>
[ Upstream commit 8ffe9cb889f2b831a9d5bbb1f7ad42d30e31170f ]
Update otap-del-sel properties as per datasheet [0].
Add missing clkbuf-sel and itap-del-sel values also as per datasheet [0].
Move clkbuf-sel and ti,trm-icp above the otap-del-sel properties so the sdhci nodes could be more uniform across platforms.
[0] https://www.ti.com/lit/ds/symlink/am6548.pdf
Stable-dep-of: f55c9f087cc2 ("arm64: dts: ti: k3-am65-main: Add missing taps to sdhci0")
--- arch/arm64/boot/dts/ti/k3-am65-main.dtsi | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +11 -6
@@ -436,6 +436,8 @@ sdhci0: mmc@4f80000 { interrupts = <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>; mmc-ddr-1_8v; mmc-hs200-1_8v; + ti,clkbuf-sel = <0x7>; + ti,trm-icp = <0x8>; ti,otap-del-sel-legacy = <0x0>; ti,otap-del-sel-mmc-hs = <0x0>; ti,otap-del-sel-sd-hs = <0x0>;
@@ -446,8 +448,7 @@ sdhci0: mmc@4f80000 { ti,otap-del-sel-ddr50 = <0x5>; ti,otap-del-sel-ddr52 = <0x5>; ti,otap-del-sel-hs200 = <0x5>; - ti,otap-del-sel-hs400 = <0x0>; - ti,trm-icp = <0x8>; + ti,itap-del-sel-ddr52 = <0x0>; dma-coherent; };
@@ -458,18 +459,22 @@ sdhci1: mmc@4fa0000 { clocks = <&k3_clks 48 0>, <&k3_clks 48 1>; clock-names = "clk_ahb", "clk_xin"; interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>; + ti,clkbuf-sel = <0x7>; + ti,trm-icp = <0x8>; ti,otap-del-sel-legacy = <0x0>; ti,otap-del-sel-mmc-hs = <0x0>; ti,otap-del-sel-sd-hs = <0x0>; - ti,otap-del-sel-sdr12 = <0x0>; - ti,otap-del-sel-sdr25 = <0x0>; + ti,otap-del-sel-sdr12 = <0xf>; + ti,otap-del-sel-sdr25 = <0xf>; ti,otap-del-sel-sdr50 = <0x8>; ti,otap-del-sel-sdr104 = <0x7>; ti,otap-del-sel-ddr50 = <0x4>; ti,otap-del-sel-ddr52 = <0x4>; ti,otap-del-sel-hs200 = <0x7>; - ti,clkbuf-sel = <0x7>; - ti,trm-icp = <0x8>; + ti,itap-del-sel-legacy = <0xa>; + ti,itap-del-sel-sd-hs = <0x1>; + ti,itap-del-sel-sdr12 = <0xa>; + ti,itap-del-sel-sdr25 = <0x1>; dma-coherent; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 283/356 arm64: dts: ti: k3-am65-main: Add missing taps to sdhci0
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Judith Mendez <[email protected]>
[ Upstream commit f55c9f087cc2e2252d44ffd9d58def2066fc176e ]
For am65x, add missing ITAPDLYSEL values for Default Speed and High Speed SDR modes to sdhci0 node according to the device datasheet [0].
[0] https://www.ti.com/lit/gpn/am6548
--- arch/arm64/boot/dts/ti/k3-am65-main.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +2 -0
@@ -448,6 +448,8 @@ sdhci0: mmc@4f80000 { ti,otap-del-sel-ddr50 = <0x5>; ti,otap-del-sel-ddr52 = <0x5>; ti,otap-del-sel-hs200 = <0x5>; + ti,itap-del-sel-legacy = <0xa>; + ti,itap-del-sel-mmc-hs = <0x1>; ti,itap-del-sel-ddr52 = <0x0>; dma-coherent; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 284/356 arm64: dts: ti: k3-j721e-sk: Model CSI2RX connector mux
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vaishnav Achath <[email protected]>
[ Upstream commit f87c88947396674586a42a163b72efa3999e3dee ]
J721E SK has the CSI2RX routed to a MIPI CSI connector and to 15-pin RPi camera connector through an analog mux with GPIO control, model that so that an overlay can control the mux state according to connected cameras. Also provide labels to the I2C mux bus instances so that a generic overlay can be used across multiple platforms.
J721E SK schematics: https://www.ti.com/lit/zip/sprr438
Stable-dep-of: 97b67cc102dc ("arm64: dts: ti: k3-j721e-sk: Add DT nodes for power regulators")
--- arch/arm64/boot/dts/ti/k3-j721e-sk.dts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/ti/k3-j721e-sk.dts +17 -2
@@ -286,6 +286,15 @@ tfp410_out: endpoint { }; }; }; + + csi_mux: mux-controller { + compatible = "gpio-mux"; + #mux-state-cells = <1>; + mux-gpios = <&main_gpio0 88 GPIO_ACTIVE_HIGH>; + idle-state = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&main_csi_mux_sel_pins_default>; + }; }; &main_pmx0 {
@@ -352,6 +361,12 @@ J721E_IOPAD(0x214, PIN_OUTPUT, 4) /* (V4) MCAN1_TX.USB1_DRVVBUS */ >; }; + main_csi_mux_sel_pins_default: main-csi-mux-sel-default-pins { + pinctrl-single,pins = < + J721E_IOPAD(0x164, PIN_OUTPUT, 7) /* (V29) RGMII5_TD2 */ + >; + }; + dp0_pins_default: dp0-default-pins { pinctrl-single,pins = < J721E_IOPAD(0x1c4, PIN_INPUT, 5) /* SPI0_CS1.DP0_HPD */
@@ -707,14 +722,14 @@ i2c-mux@70 { reg = <0x70>; /* CSI0 I2C */ - i2c@0 { + cam0_i2c: i2c@0 { #address-cells = <1>; #size-cells = <0>; reg = <0>; }; /* CSI1 I2C */ - i2c@1 { + cam1_i2c: i2c@1 { #address-cells = <1>; #size-cells = <0>; reg = <1>;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 285/356 arm64: dts: ti: k3-j721e-sk: Add support for multiple CAN instances
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Beleswar Padhi <[email protected]>
[ Upstream commit 021d3d5f0741e5393a7a110ac909fc746b1e0a4d ]
CAN instance 0 in the mcu domain is brought on the J721E-SK board through header J1. Thus, add its respective transceiver 1 dt node to add support for this CAN instance.
CAN instances 0, 5 and 9 in the main domain are brought on the J721E-SK board through headers J5, J6 and J2 respectively. Thus, add their respective transceivers 2, 3 and 4 dt nodes to add support for these CAN instances.
Stable-dep-of: 97b67cc102dc ("arm64: dts: ti: k3-j721e-sk: Add DT nodes for power regulators")
--- arch/arm64/boot/dts/ti/k3-j721e-sk.dts | 116 +++++++++++++++++++++++++ 1 file changed, 116 insertions(+)
arch/arm64/boot/dts/ti/k3-j721e-sk.dts +116 -0
@@ -210,6 +210,42 @@ vdd_sd_dv_alt: gpio-regulator-tps659411 { <3300000 0x1>; }; + transceiver1: can-phy1 { + compatible = "ti,tcan1042"; + #phy-cells = <0>; + max-bitrate = <5000000>; + pinctrl-names = "default"; + pinctrl-0 = <&mcu_mcan0_gpio_pins_default>; + standby-gpios = <&wkup_gpio0 3 GPIO_ACTIVE_HIGH>; + }; + + transceiver2: can-phy2 { + compatible = "ti,tcan1042"; + #phy-cells = <0>; + max-bitrate = <5000000>; + pinctrl-names = "default"; + pinctrl-0 = <&main_mcan0_gpio_pins_default>; + standby-gpios = <&main_gpio0 65 GPIO_ACTIVE_HIGH>; + }; + + transceiver3: can-phy3 { + compatible = "ti,tcan1042"; + #phy-cells = <0>; + max-bitrate = <5000000>; + pinctrl-names = "default"; + pinctrl-0 = <&main_mcan5_gpio_pins_default>; + standby-gpios = <&main_gpio0 66 GPIO_ACTIVE_HIGH>; + }; + + transceiver4: can-phy4 { + compatible = "ti,tcan1042"; + #phy-cells = <0>; + max-bitrate = <5000000>; + pinctrl-names = "default"; + pinctrl-0 = <&main_mcan9_gpio_pins_default>; + standby-gpios = <&main_gpio0 67 GPIO_ACTIVE_HIGH>; + }; + dp_pwr_3v3: fixedregulator-dp-prw { compatible = "regulator-fixed"; regulator-name = "dp-pwr";
@@ -367,6 +403,45 @@ J721E_IOPAD(0x164, PIN_OUTPUT, 7) /* (V29) RGMII5_TD2 */ >; }; + main_mcan0_pins_default: main-mcan0-default-pins { + pinctrl-single,pins = < + J721E_IOPAD(0x208, PIN_INPUT, 0) /* (W5) MCAN0_RX */ + J721E_IOPAD(0x20c, PIN_OUTPUT, 0) /* (W6) MCAN0_TX */ + >; + }; + + main_mcan0_gpio_pins_default: main-mcan0-gpio-default-pins { + pinctrl-single,pins = < + J721E_IOPAD(0x108, PIN_INPUT, 7) /* (AD27) PRG0_PRU1_GPO2.GPIO0_65 */ + >; + }; + + main_mcan5_pins_default: main-mcan5-default-pins { + pinctrl-single,pins = < + J721E_IOPAD(0x050, PIN_INPUT, 6) /* (AE21) PRG1_PRU0_GPO18.MCAN5_RX */ + J721E_IOPAD(0x04c, PIN_OUTPUT, 6) /* (AJ21) PRG1_PRU0_GPO17.MCAN5_TX */ + >; + }; + + main_mcan5_gpio_pins_default: main-mcan5-gpio-default-pins { + pinctrl-single,pins = < + J721E_IOPAD(0x10c, PIN_INPUT, 7) /* (AC25) PRG0_PRU1_GPO3.GPIO0_66 */ + >; + }; + + main_mcan9_pins_default: main-mcan9-default-pins { + pinctrl-single,pins = < + J721E_IOPAD(0x0d0, PIN_INPUT, 6) /* (AC27) PRG0_PRU0_GPO8.MCAN9_RX */ + J721E_IOPAD(0x0cc, PIN_OUTPUT, 6) /* (AC28) PRG0_PRU0_GPO7.MCAN9_TX */ + >; + }; + + main_mcan9_gpio_pins_default: main-mcan9-gpio-default-pins { + pinctrl-single,pins = < + J721E_IOPAD(0x110, PIN_INPUT, 7) /* (AD29) PRG0_PRU1_GPO4.GPIO0_67 */ + >; + }; + dp0_pins_default: dp0-default-pins { pinctrl-single,pins = < J721E_IOPAD(0x1c4, PIN_INPUT, 5) /* SPI0_CS1.DP0_HPD */
@@ -549,6 +624,19 @@ J721E_WKUP_IOPAD(0xfc, PIN_INPUT_PULLUP, 0) /* (H24) WKUP_I2C0_SDA */ >; }; + mcu_mcan0_pins_default: mcu-mcan0-default-pins { + pinctrl-single,pins = < + J721E_WKUP_IOPAD(0x0ac, PIN_INPUT, 0) /* (C29) MCU_MCAN0_RX */ + J721E_WKUP_IOPAD(0x0a8, PIN_OUTPUT, 0) /* (D29) MCU_MCAN0_TX */ + >; + }; + + mcu_mcan0_gpio_pins_default: mcu-mcan0-gpio-default-pins { + pinctrl-single,pins = < + J721E_WKUP_IOPAD(0x0bc, PIN_INPUT, 7) /* (F27) WKUP_GPIO0_3 */ + >; + }; + /* Reset for M.2 M Key slot on PCIe1 */ mkey_reset_pins_default: mkey-reset-pns-default-pins { pinctrl-single,pins = <
@@ -957,6 +1045,34 @@ &pcie1_rc { num-lanes = <2>; }; +&mcu_mcan0 { + pinctrl-names = "default"; + pinctrl-0 = <&mcu_mcan0_pins_default>; + phys = <&transceiver1>; + status = "okay"; +}; + +&main_mcan0 { + pinctrl-names = "default"; + pinctrl-0 = <&main_mcan0_pins_default>; + phys = <&transceiver2>; + status = "okay"; +}; + +&main_mcan5 { + pinctrl-names = "default"; + pinctrl-0 = <&main_mcan5_pins_default>; + phys = <&transceiver3>; + status = "okay"; +}; + +&main_mcan9 { + pinctrl-names = "default"; + pinctrl-0 = <&main_mcan9_pins_default>; + phys = <&transceiver4>; + status = "okay"; +}; + &ufs_wrapper { status = "disabled"; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 286/356 arm64: dts: ti: k3-j721e-sk: Add DT nodes for power regulators
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yemike Abhilash Chandra <[email protected]>
[ Upstream commit 97b67cc102dc2cc8aa39a569c22a196e21af5a21 ]
Add device tree nodes for two power regulators on the J721E SK board.vsys_5v0: A fixed regulator representing the 5V supply output from the LM61460 and vdd_sd_dv: A GPIO-controlled TLV71033 regulator.
J721E-SK schematics: https://www.ti.com/lit/zip/sprr438
--- arch/arm64/boot/dts/ti/k3-j721e-sk.dts | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
arch/arm64/boot/dts/ti/k3-j721e-sk.dts +31 -0
@@ -183,6 +183,17 @@ vsys_3v3: fixedregulator-vsys3v3 { regulator-boot-on; }; + vsys_5v0: fixedregulator-vsys5v0 { + /* Output of LM61460 */ + compatible = "regulator-fixed"; + regulator-name = "vsys_5v0"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vusb_main>; + regulator-always-on; + regulator-boot-on; + }; + vdd_mmc1: fixedregulator-sd { compatible = "regulator-fixed"; pinctrl-names = "default";
@@ -210,6 +221,20 @@ vdd_sd_dv_alt: gpio-regulator-tps659411 { <3300000 0x1>; }; + vdd_sd_dv: gpio-regulator-TLV71033 { + compatible = "regulator-gpio"; + pinctrl-names = "default"; + pinctrl-0 = <&vdd_sd_dv_pins_default>; + regulator-name = "tlv71033"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + vin-supply = <&vsys_5v0>; + gpios = <&main_gpio0 118 GPIO_ACTIVE_HIGH>; + states = <1800000 0x0>, + <3300000 0x1>; + }; + transceiver1: can-phy1 { compatible = "ti,tcan1042"; #phy-cells = <0>;
@@ -601,6 +626,12 @@ J721E_WKUP_IOPAD(0xd4, PIN_OUTPUT, 7) /* (G26) WKUP_GPIO0_9 */ >; }; + vdd_sd_dv_pins_default: vdd-sd-dv-default-pins { + pinctrl-single,pins = < + J721E_IOPAD(0x1dc, PIN_OUTPUT, 7) /* (Y1) SPI1_CLK.GPIO0_118 */ + >; + }; + wkup_uart0_pins_default: wkup-uart0-default-pins { pinctrl-single,pins = < J721E_WKUP_IOPAD(0xa0, PIN_INPUT, 0) /* (J29) WKUP_UART0_RXD */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 287/356 serial: sh-sci: Check if TX data was written to device in .tx_empty()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
commit 7cc0e0a43a91052477c2921f924a37d9c3891f0c upstream.
On the Renesas RZ/G3S, when doing suspend to RAM, the uart_suspend_port() is called. The uart_suspend_port() calls 3 times the
struct uart_port::ops::tx_empty() before shutting down the port.
According to the documentation, the struct uart_port::ops::tx_empty() API tests whether the transmitter FIFO and shifter for the port is empty.
The Renesas RZ/G3S SCIFA IP reports the number of data units stored in the transmit FIFO through the FDR (FIFO Data Count Register). The data units in the FIFOs are written in the shift register and transmitted from there. The TEND bit in the Serial Status Register reports if the data was transmitted from the shift register.
In the previous code, in the tx_empty() API implemented by the sh-sci driver, it is considered that the TX is empty if the hardware reports the TEND bit set and the number of data units in the FIFO is zero.
According to the HW manual, the TEND bit has the following meaning:
0: Transmission is in the waiting state or in progress. 1: Transmission is completed.
It has been noticed that when opening the serial device w/o using it and then switch to a power saving mode, the tx_empty() call in the uart_port_suspend() function fails, leading to the "Unable to drain transmitter" message being printed on the console. This is because the TEND=0 if nothing has been transmitted and the FIFOs are empty. As the TEND=0 has double meaning (waiting state, in progress) we can't determined the scenario described above.
Add a software workaround for this. This sets a variable if any data has been sent on the serial console (when using PIO) or if the DMA callback has been called (meaning something has been transmitted). In the tx_empty() API the status of the DMA transaction is also checked and if it is completed or in progress the code falls back in checking the hardware registers instead of relying on the software variable.
[claudiu.beznea: fixed conflict by:
- keeping serial_port_out() instead of sci_port_out() in sci_transmit_chars()
- keeping !uart_circ_empty(xmit) condition in sci_dma_tx_complete(), after s->tx_occurred = true; assignement]
--- drivers/tty/serial/sh-sci.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/tty/serial/sh-sci.c +29 -0
@@ -174,6 +174,7 @@ struct sci_port {bool has_rtscts;bool autorts; +bool tx_occurred; };#define SCI_NPORTS CONFIG_SERIAL_SH_SCI_NR_UARTS
@@ -838,6 +839,7 @@ static void sci_transmit_chars(struct uart_port *port) {struct circ_buf *xmit = &port->state->xmit;unsigned int stopped =uart_tx_stopped (port); +struct sci_port *s =to_sci_port (port);unsigned short status;unsigned short ctrl;int count;
@@ -874,6 +876,7 @@ static void sci_transmit_chars(struct uart_port *port) }serial_port_out (port, SCxTDR, c); + s->tx_occurred = true; port->icount.tx++; }while (--count >0 );
@@ -1230,6 +1233,8 @@ static void sci_dma_tx_complete(void *arg)if (uart_circ_chars_pending (xmit) <WAKEUP_CHARS )uart_write_wakeup (port); + s->tx_occurred = true; +if (!uart_circ_empty (xmit)) { s->cookie_tx =0 ;schedule_work (&s->work_tx);
@@ -1719,6 +1724,19 @@ static void sci_flush_buffer(struct uart_port *port) s->cookie_tx = -EINVAL; } } + +static void sci_dma_check_tx_occurred (struct sci_port *s) +{ +struct dma_tx_state state; +enum dma_status status; + +if (!s->chan_tx) +return ; + + status =dmaengine_tx_status (s->chan_tx, s->cookie_tx, &state); +if (status ==DMA_COMPLETE || status ==DMA_IN_PROGRESS ) + s->tx_occurred = true; +}#else /* !CONFIG_SERIAL_SH_SCI_DMA */ static inline void sci_request_dma (struct uart_port *port) {
@@ -1728,6 +1746,10 @@ static inline void sci_free_dma(struct uart_port *port) { } +static void sci_dma_check_tx_occurred (struct sci_port *s) +{ +} +#define sci_flush_buffer NULL#endif /* !CONFIG_SERIAL_SH_SCI_DMA */
@@ -2064,6 +2086,12 @@ static unsigned int sci_tx_empty(struct uart_port *port) {unsigned short status =serial_port_in (port, SCxSR);unsigned short in_tx_fifo =sci_txfill (port); +struct sci_port *s =to_sci_port (port); + +sci_dma_check_tx_occurred (s); + +if (!s->tx_occurred) +return TIOCSER_TEMT ;return (status &SCxSR_TEND (port)) && !in_tx_fifo ?TIOCSER_TEMT :0 ; }
@@ -2234,6 +2262,7 @@ static int sci_startup(struct uart_port *port)dev_dbg (port->dev,"%s(%d)\n" , __func__, port->line); + s->tx_occurred = false;sci_request_dma (port); ret =sci_request_irq (s);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 288/356 serial: sh-sci: Move runtime PM enable to sci_probe_single()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
commit 239f11209e5f282e16f5241b99256e25dd0614b6 upstream.
Relocate the runtime PM enable operation to sci_probe_single(). This change prepares the codebase for upcoming fixes.
While at it, replace the existing logic with a direct call to devm_pm_runtime_enable() and remove sci_cleanup_single(). The devm_pm_runtime_enable() function automatically handles disabling runtime PM during driver removal.
--- drivers/tty/serial/sh-sci.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-)
drivers/tty/serial/sh-sci.c +6 -18
@@ -3043,10 +3043,6 @@ static int sci_init_single(struct platform_device *dev, ret =sci_init_clocks (sci_port, &dev->dev);if (ret <0 )return ret; - - port->dev = &dev->dev; - -pm_runtime_enable (&dev->dev); } port->type = p->type;
@@ -3076,11 +3072,6 @@ static int sci_init_single(struct platform_device *dev,return 0 ; } -static void sci_cleanup_single (struct sci_port *port) -{ -pm_runtime_disable (port->port.dev); -} -#if defined(CONFIG_SERIAL_SH_SCI_CONSOLE ) || \ defined(CONFIG_SERIAL_SH_SCI_EARLYCON )static void serial_console_putchar (struct uart_port *port,unsigned char ch)
@@ -3250,8 +3241,6 @@ static int sci_remove(struct platform_device *dev) sci_ports_in_use &= ~BIT (port->port.line);uart_remove_one_port (&sci_uart_driver, &port->port); -sci_cleanup_single (port); -if (port->port.fifosize >1 )device_remove_file (&dev->dev, &dev_attr_rx_fifo_trigger);if (type ==PORT_SCIFA || type ==PORT_SCIFB || type ==PORT_HSCIF )
@@ -3414,6 +3403,11 @@ static int sci_probe_single(struct platform_device *dev,if (ret)return ret; + sciport->port.dev = &dev->dev; + ret =devm_pm_runtime_enable (&dev->dev); +if (ret) +return ret; + sciport->gpios =mctrl_gpio_init (&sciport->port,0 );if (IS_ERR (sciport->gpios))return PTR_ERR (sciport->gpios);
@@ -3427,13 +3421,7 @@ static int sci_probe_single(struct platform_device *dev, sciport->port.flags |=UPF_HARD_FLOW ; } - ret =uart_add_one_port (&sci_uart_driver, &sciport->port); -if (ret) { -sci_cleanup_single (sciport); -return ret; - } - -return 0 ; +return uart_add_one_port (&sci_uart_driver, &sciport->port); }static int sci_probe (struct platform_device *dev)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 289/356 serial: sh-sci: Clean sci_ports[0] after at earlycon exit
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
commit 5f1017069933489add0c08659673443c9905659e upstream.
The early_console_setup() function initializes sci_ports[0].port with an object of type struct uart_port obtained from the struct earlycon_device passed as an argument to early_console_setup().
Later, during serial port probing, the serial port used as earlycon (e.g., port A) might be remapped to a different position in the sci_ports[] array, and a different serial port (e.g., port B) might be assigned to slot
0. For example:
sci_ports[0] = port B
sci_ports[X] = port A
In this scenario, the new port mapped at index zero (port B) retains the data associated with the earlycon configuration. Consequently, after the Linux boot process, any access to the serial port now mapped to sci_ports[0] (port B) will block the original earlycon port (port A).
To address this, introduce an early_console_exit() function to clean up sci_ports[0] when earlycon is exited.
To prevent the cleanup of sci_ports[0] while the serial device is still being used by earlycon, introduce the struct sci_port::probing flag and account for it in early_console_exit().
--- drivers/tty/serial/sh-sci.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-)
drivers/tty/serial/sh-sci.c +30 -2
@@ -183,6 +183,7 @@ static struct sci_port sci_ports[SCI_NPORTS];static unsigned long sci_ports_in_use;static struct uart_driver sci_uart_driver;static bool sci_uart_earlycon; +static bool sci_uart_earlycon_dev_probing;static inline struct sci_port *to_sci_port (struct uart_port *uart)
@@ -3374,7 +3375,8 @@ static struct plat_sci_port *sci_parse_dt(struct platform_device *pdev,static int sci_probe_single (struct platform_device *dev,unsigned int index,struct plat_sci_port *p, -struct sci_port *sciport) +struct sci_port *sciport, +struct resource *sci_res) {int ret;
@@ -3421,6 +3423,14 @@ static int sci_probe_single(struct platform_device *dev, sciport->port.flags |=UPF_HARD_FLOW ; } +if (sci_uart_earlycon && sci_ports[0 ].port.mapbase == sci_res->start) { +/* +* Skip cleanup the sci_port[0] in early_console_exit(), this +* port is the same as the earlycon one. +*/ + sci_uart_earlycon_dev_probing = true; + } +return uart_add_one_port (&sci_uart_driver, &sciport->port); }
@@ -3479,7 +3489,7 @@ static int sci_probe(struct platform_device *dev)platform_set_drvdata (dev, sp); - ret =sci_probe_single (dev, dev_id, p, sp); + ret =sci_probe_single (dev, dev_id, p, sp, res);if (ret)return ret;
@@ -3636,6 +3646,22 @@ sh_early_platform_init_buffer("earlyprintk", &sci_driver,#ifdef CONFIG_SERIAL_SH_SCI_EARLYCON static struct plat_sci_port port_cfg; +static int early_console_exit (struct console *co) +{ +struct sci_port *sci_port = &sci_ports[0 ]; + +/* +* Clean the slot used by earlycon. A new SCI device might +* map to this slot. +*/ +if (!sci_uart_earlycon_dev_probing) { +memset (sci_port,0 ,sizeof (*sci_port)); + sci_uart_earlycon = false; + } + +return 0 ; +} +static int __init early_console_setup (struct earlycon_device *device,int type) {
@@ -3655,6 +3681,8 @@ static int __init early_console_setup(struct earlycon_device *device, SCSCR_RE | SCSCR_TE | port_cfg.scscr); device->con->write = serial_console_write; + device->con->exit = early_console_exit; +return 0 ; } static int __init sci_early_console_setup(struct earlycon_device *device,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 290/356 scsi: core: ufs: Fix a hang in the error handler
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sanjeev Yadav <[email protected]>
[ Upstream commit 8a3514d348de87a9d5e2ac00fbac4faae0b97996 ]
ufshcd_err_handling_prepare() calls ufshcd_rpm_get_sync(). The latter function can only succeed if UFSHCD_EH_IN_PROGRESS is not set because resuming involves submitting a SCSI command and ufshcd_queuecommand() returns SCSI_MLQUEUE_HOST_BUSY if UFSHCD_EH_IN_PROGRESS is set. Fix this hang by setting UFSHCD_EH_IN_PROGRESS after ufshcd_rpm_get_sync() has been called instead of before.
Backtrace: __switch_to+0x174/0x338 __schedule+0x600/0x9e4 schedule+0x7c/0xe8 schedule_timeout+0xa4/0x1c8 io_schedule_timeout+0x48/0x70 wait_for_common_io+0xa8/0x160 //waiting on START_STOP wait_for_completion_io_timeout+0x10/0x20 blk_execute_rq+0xe4/0x1e4 scsi_execute_cmd+0x108/0x244 ufshcd_set_dev_pwr_mode+0xe8/0x250 __ufshcd_wl_resume+0x94/0x354 ufshcd_wl_runtime_resume+0x3c/0x174 scsi_runtime_resume+0x64/0xa4 rpm_resume+0x15c/0xa1c __pm_runtime_resume+0x4c/0x90 // Runtime resume ongoing ufshcd_err_handler+0x1a0/0xd08 process_one_work+0x174/0x808 worker_thread+0x15c/0x490 kthread+0xf4/0x1ec ret_from_fork+0x10/0x20
--- drivers/ufs/core/ufshcd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +6 -1
@@ -6500,9 +6500,14 @@ static void ufshcd_err_handler(struct work_struct *work)up (&hba->host_sem);return ; } -ufshcd_set_eh_in_progress (hba);spin_unlock_irqrestore (hba->host->host_lock, flags); +ufshcd_err_handling_prepare (hba); + +spin_lock_irqsave (hba->host->host_lock, flags); +ufshcd_set_eh_in_progress (hba); +spin_unlock_irqrestore (hba->host->host_lock, flags); +/* Complete requests that have door-bell cleared by h/w */ ufshcd_complete_requests (hba, false);spin_lock_irqsave (hba->host->host_lock, flags);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 291/356 Bluetooth: hci_core: fix list_for_each_entry_rcu usage
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pauli Virtanen <[email protected]>
[ Upstream commit 308a3a8ce8ea41b26c46169f3263e50f5997c28e ]
Releasing + re-acquiring RCU lock inside list_for_each_entry_rcu() loop body is not correct.
Fix by taking the update-side hdev->lock instead.
--- net/bluetooth/hci_core.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
net/bluetooth/hci_core.c +3 -8
@@ -3380,23 +3380,18 @@ static void hci_link_tx_to(struct hci_dev *hdev, __u8 type)bt_dev_err (hdev,"link tx timeout" ); -rcu_read_lock (); +hci_dev_lock (hdev);/* Kill stalled connections */ -list_for_each_entry_rcu (c, &h->list, list) { +list_for_each_entry (c, &h->list, list) {if (c->type == type && c->sent) {bt_dev_err (hdev,"killing stalled connection %pMR" , &c->dst); -/* hci_disconnect might sleep, so, we have to release -* the RCU read lock before calling it. -*/ -rcu_read_unlock ();hci_disconnect (c,HCI_ERROR_REMOTE_USER_TERM ); -rcu_read_lock (); } } -rcu_read_unlock (); +hci_dev_unlock (hdev); } static struct hci_chan *hci_chan_sent(struct hci_dev *hdev, __u8 type,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 292/356 Bluetooth: MGMT: Fix UAF on mgmt_remove_adv_monitor_complete
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit e6ed54e86aae9e4f7286ce8d5c73780f91b48d1c ]
This reworks MGMT_OP_REMOVE_ADV_MONITOR to not use mgmt_pending_add to avoid crashes like bellow:
==================================================================
BUG: KASAN: slab-use-after-free in mgmt_remove_adv_monitor_complete+0xe5/0x540 net/bluetooth/mgmt.c:5406 Read of size 8 at addr ffff88801c53f318 by task kworker/u5:5/5341 CPU: 0 UID: 0 PID: 5341 Comm: kworker/u5:5 Not tainted 6.15.0-syzkaller-10402-g4cb6c8af8591 #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Workqueue: hci0 hci_cmd_sync_work Call Trace: <TASK> dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0xd2/0x2b0 mm/kasan/report.c:521 kasan_report+0x118/0x150 mm/kasan/report.c:634 mgmt_remove_adv_monitor_complete+0xe5/0x540 net/bluetooth/mgmt.c:5406 hci_cmd_sync_work+0x261/0x3a0 net/bluetooth/hci_sync.c:334 process_one_work kernel/workqueue.c:3238 [inline] process_scheduled_works+0xade/0x17b0 kernel/workqueue.c:3321 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402 kthread+0x711/0x8a0 kernel/kthread.c:464 ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 </TASK> Allocated by task 5987: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:260 [inline] __kmalloc_cache_noprof+0x230/0x3d0 mm/slub.c:4358 kmalloc_noprof include/linux/slab.h:905 [inline] kzalloc_noprof include/linux/slab.h:1039 [inline] mgmt_pending_new+0x65/0x240 net/bluetooth/mgmt_util.c:252 mgmt_pending_add+0x34/0x120 net/bluetooth/mgmt_util.c:279 remove_adv_monitor+0x103/0x1b0 net/bluetooth/mgmt.c:5454 hci_mgmt_cmd+0x9c9/0xef0 net/bluetooth/hci_sock.c:1719 hci_sock_sendmsg+0x6ca/0xef0 net/bluetooth/hci_sock.c:1839 sock_sendmsg_nosec net/socket.c:712 [inline] __sock_sendmsg+0x219/0x270 net/socket.c:727 sock_write_iter+0x258/0x330 net/socket.c:1131 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x548/0xa90 fs/read_write.c:686 ksys_write+0x145/0x250 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 5989: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:576 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x62/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2380 [inline] slab_free mm/slub.c:4642 [inline] kfree+0x18e/0x440 mm/slub.c:4841 mgmt_pending_foreach+0xc9/0x120 net/bluetooth/mgmt_util.c:242 mgmt_index_removed+0x10d/0x2f0 net/bluetooth/mgmt.c:9366 hci_sock_bind+0xbe9/0x1000 net/bluetooth/hci_sock.c:1314 __sys_bind_socket net/socket.c:1810 [inline] __sys_bind+0x2c3/0x3e0 net/socket.c:1841 __do_sys_bind net/socket.c:1846 [inline] __se_sys_bind net/socket.c:1844 [inline] __x64_sys_bind+0x7a/0x90 net/socket.c:1844 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- include/net/bluetooth/hci_core.h | 1 - net/bluetooth/hci_core.c | 4 +--- net/bluetooth/mgmt.c | 37 ++++++++++---------------------- 3 files changed, 12 insertions(+), 30 deletions(-)
include/net/bluetooth/hci_core.h +0 -1
@@ -2305,7 +2305,6 @@ void mgmt_advertising_added(struct sock *sk, struct hci_dev *hdev, u8 instance);void mgmt_advertising_removed (struct sock *sk,struct hci_dev *hdev,u8 instance); -void mgmt_adv_monitor_removed (struct hci_dev *hdev,u16 handle);int mgmt_phy_configuration_changed (struct hci_dev *hdev,struct sock *skip);void mgmt_adv_monitor_device_lost (struct hci_dev *hdev,u16 handle,bdaddr_t *bdaddr,u8 addr_type);
net/bluetooth/hci_core.c +1 -3
@@ -1862,10 +1862,8 @@ void hci_free_adv_monitor(struct hci_dev *hdev, struct adv_monitor *monitor)if (monitor->handle)idr_remove (&hdev->adv_monitors_idr, monitor->handle); -if (monitor->state !=ADV_MONITOR_STATE_NOT_REGISTERED ) { +if (monitor->state !=ADV_MONITOR_STATE_NOT_REGISTERED ) hdev->adv_monitors_cnt--; -mgmt_adv_monitor_removed (hdev, monitor->handle); - }kfree (monitor); }
net/bluetooth/mgmt.c +11 -26
@@ -5165,24 +5165,14 @@ static void mgmt_adv_monitor_added(struct sock *sk, struct hci_dev *hdev,mgmt_event (MGMT_EV_ADV_MONITOR_ADDED , hdev, &ev,sizeof (ev), sk); } -void mgmt_adv_monitor_removed (struct hci_dev *hdev,u16 handle) +static void mgmt_adv_monitor_removed (struct sock *sk,struct hci_dev *hdev, +u16 handle) {struct mgmt_ev_adv_monitor_removed ev; -struct mgmt_pending_cmd *cmd; -struct sock *sk_skip =NULL ; -struct mgmt_cp_remove_adv_monitor *cp; - - cmd =pending_find (MGMT_OP_REMOVE_ADV_MONITOR , hdev); -if (cmd) { - cp = cmd->param; - -if (cp->monitor_handle) - sk_skip = cmd->sk; - } ev.monitor_handle =cpu_to_le16 (handle); -mgmt_event (MGMT_EV_ADV_MONITOR_REMOVED , hdev, &ev,sizeof (ev), sk_skip); +mgmt_event (MGMT_EV_ADV_MONITOR_REMOVED , hdev, &ev,sizeof (ev), sk); } static int read_adv_mon_features(struct sock *sk, struct hci_dev *hdev,
@@ -5284,8 +5274,7 @@ static int __add_adv_patterns_monitor(struct sock *sk, struct hci_dev *hdev,if (pending_find (MGMT_OP_SET_LE , hdev) ||pending_find (MGMT_OP_ADD_ADV_PATTERNS_MONITOR , hdev) || -pending_find (MGMT_OP_ADD_ADV_PATTERNS_MONITOR_RSSI , hdev) || -pending_find (MGMT_OP_REMOVE_ADV_MONITOR , hdev)) { +pending_find (MGMT_OP_ADD_ADV_PATTERNS_MONITOR_RSSI , hdev)) { status =MGMT_STATUS_BUSY ; goto unlock; }
@@ -5455,8 +5444,7 @@ static void mgmt_remove_adv_monitor_complete(struct hci_dev *hdev,struct mgmt_pending_cmd *cmd = data;struct mgmt_cp_remove_adv_monitor *cp; -if (status == -ECANCELED || - cmd !=pending_find (MGMT_OP_REMOVE_ADV_MONITOR , hdev)) +if (status == -ECANCELED )return ;hci_dev_lock (hdev);
@@ -5465,12 +5453,14 @@ static void mgmt_remove_adv_monitor_complete(struct hci_dev *hdev, rp.monitor_handle = cp->monitor_handle; -if (!status) +if (!status) { +mgmt_adv_monitor_removed (cmd->sk, hdev, cp->monitor_handle);hci_update_passive_scan (hdev); + }mgmt_cmd_complete (cmd->sk, cmd->index, cmd->opcode,mgmt_status (status), &rp,sizeof (rp)); -mgmt_pending_remove (cmd); +mgmt_pending_free (cmd);hci_dev_unlock (hdev); bt_dev_dbg(hdev, "remove monitor %d complete, status %d",
@@ -5480,10 +5470,6 @@ static void mgmt_remove_adv_monitor_complete(struct hci_dev *hdev,static int mgmt_remove_adv_monitor_sync (struct hci_dev *hdev,void *data) {struct mgmt_pending_cmd *cmd = data; - -if (cmd !=pending_find (MGMT_OP_REMOVE_ADV_MONITOR , hdev)) -return -ECANCELED ; -struct mgmt_cp_remove_adv_monitor *cp = cmd->param;u16 handle =__le16_to_cpu (cp->monitor_handle);
@@ -5502,14 +5488,13 @@ static int remove_adv_monitor(struct sock *sk, struct hci_dev *hdev,hci_dev_lock (hdev);if (pending_find (MGMT_OP_SET_LE , hdev) || -pending_find (MGMT_OP_REMOVE_ADV_MONITOR , hdev) ||pending_find (MGMT_OP_ADD_ADV_PATTERNS_MONITOR , hdev) ||pending_find (MGMT_OP_ADD_ADV_PATTERNS_MONITOR_RSSI , hdev)) { status =MGMT_STATUS_BUSY ; goto unlock; } - cmd =mgmt_pending_add (sk,MGMT_OP_REMOVE_ADV_MONITOR , hdev, data, len); + cmd =mgmt_pending_new (sk,MGMT_OP_REMOVE_ADV_MONITOR , hdev, data, len);if (!cmd) { status =MGMT_STATUS_NO_RESOURCES ; goto unlock;
@@ -5519,7 +5504,7 @@ static int remove_adv_monitor(struct sock *sk, struct hci_dev *hdev, mgmt_remove_adv_monitor_complete);if (err) { -mgmt_pending_remove (cmd); +mgmt_pending_free (cmd);if (err == -ENOMEM ) status =MGMT_STATUS_NO_RESOURCES ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 293/356 Bluetooth: MGMT: Remove unused mgmt_pending_find_data
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dr. David Alan Gilbert <[email protected]>
[ Upstream commit 276af34d82f13bda0b2a4d9786c90b8bbf1cd064 ]
mgmt_pending_find_data() last use was removed in 2021 by
commit 5a7501374664 ("Bluetooth: hci_sync: Convert MGMT_OP_GET_CLOCK_INFO")
Remove it.
Stable-dep-of: 6fe26f694c82 ("Bluetooth: MGMT: Protect mgmt_pending list with its own lock")
--- net/bluetooth/mgmt_util.c | 17 ----------------- net/bluetooth/mgmt_util.h | 4 ---- 2 files changed, 21 deletions(-)
net/bluetooth/mgmt_util.c +0 -17
@@ -229,23 +229,6 @@ struct mgmt_pending_cmd *mgmt_pending_find(unsigned short channel, u16 opcode,return NULL ; } -struct mgmt_pending_cmd *mgmt_pending_find_data (unsigned short channel, -u16 opcode, -struct hci_dev *hdev, -const void *data) -{ -struct mgmt_pending_cmd *cmd; - -list_for_each_entry (cmd, &hdev->mgmt_pending, list) { -if (cmd->user_data != data) -continue ; -if (cmd->opcode == opcode) -return cmd; - } - -return NULL ; -} -void mgmt_pending_foreach (u16 opcode,struct hci_dev *hdev,void (*cb)(struct mgmt_pending_cmd *cmd,void *data),void *data)
net/bluetooth/mgmt_util.h +0 -4
@@ -54,10 +54,6 @@ int mgmt_cmd_complete(struct sock *sk, u16 index, u16 cmd, u8 status,struct mgmt_pending_cmd *mgmt_pending_find (unsigned short channel,u16 opcode,struct hci_dev *hdev); -struct mgmt_pending_cmd *mgmt_pending_find_data (unsigned short channel, -u16 opcode, -struct hci_dev *hdev, -const void *data);void mgmt_pending_foreach (u16 opcode,struct hci_dev *hdev,void (*cb)(struct mgmt_pending_cmd *cmd,void *data),void *data);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 294/356 Bluetooth: MGMT: Protect mgmt_pending list with its own lock
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 6fe26f694c824b8a4dbf50c635bee1302e3f099c ]
This uses a mutex to protect from concurrent access of mgmt_pending list which can cause crashes like:
==================================================================
BUG: KASAN: slab-use-after-free in hci_sock_get_channel+0x60/0x68 net/bluetooth/hci_sock.c:91 Read of size 2 at addr ffff0000c48885b2 by task syz.4.334/7318 CPU: 0 UID: 0 PID: 7318 Comm: syz.4.334 Not tainted 6.15.0-rc7-syzkaller-g187899f4124a #0 PREEMPT Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:466 (C) __dump_stack+0x30/0x40 lib/dump_stack.c:94 dump_stack_lvl+0xd8/0x12c lib/dump_stack.c:120 print_address_description+0xa8/0x254 mm/kasan/report.c:408 print_report+0x68/0x84 mm/kasan/report.c:521 kasan_report+0xb0/0x110 mm/kasan/report.c:634 __asan_report_load2_noabort+0x20/0x2c mm/kasan/report_generic.c:379 hci_sock_get_channel+0x60/0x68 net/bluetooth/hci_sock.c:91 mgmt_pending_find+0x7c/0x140 net/bluetooth/mgmt_util.c:223 pending_find net/bluetooth/mgmt.c:947 [inline] remove_adv_monitor+0x44/0x1a4 net/bluetooth/mgmt.c:5445 hci_mgmt_cmd+0x780/0xc00 net/bluetooth/hci_sock.c:1712 hci_sock_sendmsg+0x544/0xbb0 net/bluetooth/hci_sock.c:1832 sock_sendmsg_nosec net/socket.c:712 [inline] __sock_sendmsg net/socket.c:727 [inline] sock_write_iter+0x25c/0x378 net/socket.c:1131 new_sync_write fs/read_write.c:591 [inline] vfs_write+0x62c/0x97c fs/read_write.c:684 ksys_write+0x120/0x210 fs/read_write.c:736 __do_sys_write fs/read_write.c:747 [inline] __se_sys_write fs/read_write.c:744 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:744 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x58/0x17c arch/arm64/kernel/entry-common.c:767 el0t_64_sync_handler+0x78/0x108 arch/arm64/kernel/entry-common.c:786 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 Allocated by task 7037: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x40/0x78 mm/kasan/common.c:68 kasan_save_alloc_info+0x44/0x54 mm/kasan/generic.c:562 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0x9c/0xb4 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:260 [inline] __do_kmalloc_node mm/slub.c:4327 [inline] __kmalloc_noprof+0x2fc/0x4c8 mm/slub.c:4339 kmalloc_noprof include/linux/slab.h:909 [inline] sk_prot_alloc+0xc4/0x1f0 net/core/sock.c:2198 sk_alloc+0x44/0x3ac net/core/sock.c:2254 bt_sock_alloc+0x4c/0x300 net/bluetooth/af_bluetooth.c:148 hci_sock_create+0xa8/0x194 net/bluetooth/hci_sock.c:2202 bt_sock_create+0x14c/0x24c net/bluetooth/af_bluetooth.c:132 __sock_create+0x43c/0x91c net/socket.c:1541 sock_create net/socket.c:1599 [inline] __sys_socket_create net/socket.c:1636 [inline] __sys_socket+0xd4/0x1c0 net/socket.c:1683 __do_sys_socket net/socket.c:1697 [inline] __se_sys_socket net/socket.c:1695 [inline] __arm64_sys_socket+0x7c/0x94 net/socket.c:1695 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x58/0x17c arch/arm64/kernel/entry-common.c:767 el0t_64_sync_handler+0x78/0x108 arch/arm64/kernel/entry-common.c:786 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 Freed by task 6607: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x40/0x78 mm/kasan/common.c:68 kasan_save_free_info+0x58/0x70 mm/kasan/generic.c:576 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x68/0x88 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2380 [inline] slab_free mm/slub.c:4642 [inline] kfree+0x17c/0x474 mm/slub.c:4841 sk_prot_free net/core/sock.c:2237 [inline] __sk_destruct+0x4f4/0x760 net/core/sock.c:2332 sk_destruct net/core/sock.c:2360 [inline] __sk_free+0x320/0x430 net/core/sock.c:2371 sk_free+0x60/0xc8 net/core/sock.c:2382 sock_put include/net/sock.h:1944 [inline] mgmt_pending_free+0x88/0x118 net/bluetooth/mgmt_util.c:290 mgmt_pending_remove+0xec/0x104 net/bluetooth/mgmt_util.c:298 mgmt_set_powered_complete+0x418/0x5cc net/bluetooth/mgmt.c:1355 hci_cmd_sync_work+0x204/0x33c net/bluetooth/hci_sync.c:334 process_one_work+0x7e8/0x156c kernel/workqueue.c:3238 process_scheduled_works kernel/workqueue.c:3319 [inline] worker_thread+0x958/0xed8 kernel/workqueue.c:3400 kthread+0x5fc/0x75c kernel/kthread.c:464 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:847
--- include/net/bluetooth/hci_core.h | 1 + net/bluetooth/hci_core.c | 1 + net/bluetooth/mgmt.c | 101 +++++++++++++++---------------- net/bluetooth/mgmt_util.c | 32 ++++++++-- net/bluetooth/mgmt_util.h | 4 +- 5 files changed, 80 insertions(+), 59 deletions(-)
include/net/bluetooth/hci_core.h +1 -0
@@ -542,6 +542,7 @@ struct hci_dev {struct hci_conn_hash conn_hash;struct list_head mesh_pending; +struct mutex mgmt_pending_lock;struct list_head mgmt_pending;struct list_head reject_list;struct list_head accept_list;
net/bluetooth/hci_core.c +1 -0
@@ -2490,6 +2490,7 @@ struct hci_dev *hci_alloc_dev_priv(int sizeof_priv)mutex_init (&hdev->lock);mutex_init (&hdev->req_lock); +mutex_init (&hdev->mgmt_pending_lock);ida_init (&hdev->unset_handle_ida);
net/bluetooth/mgmt.c +49 -52
331 lines not on this page · raw message
net/bluetooth/mgmt_util.c +27 -5
@@ -217,30 +217,47 @@ int mgmt_cmd_complete(struct sock *sk, u16 index, u16 cmd, u8 status,struct mgmt_pending_cmd *mgmt_pending_find (unsigned short channel,u16 opcode,struct hci_dev *hdev) { -struct mgmt_pending_cmd *cmd; +struct mgmt_pending_cmd *cmd, *tmp; + +mutex_lock (&hdev->mgmt_pending_lock); -list_for_each_entry (cmd, &hdev->mgmt_pending, list) { +list_for_each_entry_safe (cmd, tmp, &hdev->mgmt_pending, list) {if (hci_sock_get_channel (cmd->sk) != channel)continue ; -if (cmd->opcode == opcode) + +if (cmd->opcode == opcode) { +mutex_unlock (&hdev->mgmt_pending_lock);return cmd; + } } +mutex_unlock (&hdev->mgmt_pending_lock); +return NULL ; } -void mgmt_pending_foreach (u16 opcode,struct hci_dev *hdev, +void mgmt_pending_foreach (u16 opcode,struct hci_dev *hdev,bool remove,void (*cb)(struct mgmt_pending_cmd *cmd,void *data),void *data) {struct mgmt_pending_cmd *cmd, *tmp; +mutex_lock (&hdev->mgmt_pending_lock); +list_for_each_entry_safe (cmd, tmp, &hdev->mgmt_pending, list) {if (opcode >0 && cmd->opcode != opcode)continue ; +if (remove) +list_del (&cmd->list); +cb (cmd, data); + +if (remove) +mgmt_pending_free (cmd); } + +mutex_unlock (&hdev->mgmt_pending_lock); } struct mgmt_pending_cmd *mgmt_pending_new(struct sock *sk, u16 opcode,
@@ -254,7 +271,7 @@ struct mgmt_pending_cmd *mgmt_pending_new(struct sock *sk, u16 opcode,return NULL ; cmd->opcode = opcode; - cmd->index = hdev->id; + cmd->hdev = hdev; cmd->param =kmemdup (data, len,GFP_KERNEL );if (!cmd->param) {
@@ -280,7 +297,9 @@ struct mgmt_pending_cmd *mgmt_pending_add(struct sock *sk, u16 opcode,if (!cmd)return NULL ; +mutex_lock (&hdev->mgmt_pending_lock);list_add_tail (&cmd->list, &hdev->mgmt_pending); +mutex_unlock (&hdev->mgmt_pending_lock);return cmd; }
@@ -294,7 +313,10 @@ void mgmt_pending_free(struct mgmt_pending_cmd *cmd)void mgmt_pending_remove (struct mgmt_pending_cmd *cmd) { +mutex_lock (&cmd->hdev->mgmt_pending_lock);list_del (&cmd->list); +mutex_unlock (&cmd->hdev->mgmt_pending_lock); +mgmt_pending_free (cmd); }
net/bluetooth/mgmt_util.h +2 -2
@@ -33,7 +33,7 @@ struct mgmt_mesh_tx {struct mgmt_pending_cmd {struct list_head list;u16 opcode; -int index; +struct hci_dev *hdev;void *param;size_t param_len;struct sock *sk;
@@ -54,7 +54,7 @@ int mgmt_cmd_complete(struct sock *sk, u16 index, u16 cmd, u8 status,struct mgmt_pending_cmd *mgmt_pending_find (unsigned short channel,u16 opcode,struct hci_dev *hdev); -void mgmt_pending_foreach (u16 opcode,struct hci_dev *hdev, +void mgmt_pending_foreach (u16 opcode,struct hci_dev *hdev,bool remove,void (*cb)(struct mgmt_pending_cmd *cmd,void *data),void *data); struct mgmt_pending_cmd *mgmt_pending_add(struct sock *sk, u16 opcode,
Signature · 1 line
2.39.5