6.1.53-rc1 review
Subsystems (13)
Daniel Borkmann
maintainerRe: [PATCH 6.1 562/600] bpf: Fix issue in verifying allow_ptr_leaks
In reply to Greg KHQuoted 14 lines · Greg KH
Quoted 4 lines · Luis Gerhorst
Quoted 4 lines
6.1-stable review patch. If anyone has any objections, please let me know.
From: Yafang Shao <[email protected]>
Quoted 8 lines
Quoted 1 line
commit
d75e30dddf73449bc2d10bb8e2f1a2c446bc67a2upstream.I unfortunately have objections, they are pending discussion at [1].
Same applies to the 6.4-stable review patch [2] and all other backports.
[1] https://lore.kernel.org/bpf/[email protected]/
[2] https://lore.kernel.org/stable/[email protected]/
Quoted 6 lines
As this is in the tree already, and in Linus's tree, I'll wait to see if any changes are merged into Linus's tree for this before removing it from the stable trees.
Let us know if there's a commit that resolves this and we will be glad to queue that up.
Commit d75e30dddf73 ("bpf: Fix issue in verifying allow_ptr_leaks") is not stable material. It's not really a "fix", but it will simply make direct packet access available to applications without CAP_PERFMON - the latter was required so far given Spectre v1. However, there is ongoing discussion [1] that potentially not much useful information can be leaked out and therefore lifting it may or may not be ok. If we queue this to stable and later figure we need to revert the whole thing again because someone managed to come up with a PoC in the meantime, then there's higher risk of breakage.
Thanks,
Daniel
Greg KH
maintainerRe: [PATCH 6.1 562/600] bpf: Fix issue in verifying allow_ptr_leaks
Quoted 22 lines · Daniel Borkmann
Quoted 14 lines · Greg KH
Quoted 4 lines · Luis Gerhorst
Quoted 4 lines
6.1-stable review patch. If anyone has any objections, please let me know.
From: Yafang Shao <[email protected]>
Quoted 8 lines
Quoted 1 line
commit
d75e30dddf73449bc2d10bb8e2f1a2c446bc67a2upstream.I unfortunately have objections, they are pending discussion at [1].
Same applies to the 6.4-stable review patch [2] and all other backports.
[1] https://lore.kernel.org/bpf/[email protected]/
[2] https://lore.kernel.org/stable/[email protected]/Quoted 6 lines
As this is in the tree already, and in Linus's tree, I'll wait to see if any changes are merged into Linus's tree for this before removing it from the stable trees.
Let us know if there's a commit that resolves this and we will be glad to queue that up.
Quoted 8 lines
Commit
d75e30dddf73("bpf: Fix issue in verifyingallow_ptr_leaks") is not stable material. It's not really a "fix", but it will simply make direct packet access available to applications withoutCAP_PERFMON- the latter was required so far given Spectre v1. However, there is ongoing discussion [1] that potentially not much useful information can be leaked out and therefore lifting it may or may not be ok. If we queue this to stable and later figure we need to revert the whole thing again because someone managed to come up with a PoC in the meantime, then there's higher risk of breakage.
Ick, ok, so just this one commit should be reverted? Or any others as well?
thanks,
greg k-h
Re: [PATCH 6.1 562/600] bpf: Fix issue in verifying allow_ptr_leaks
Quoted 33 lines · Greg KH
Quoted 22 lines · Daniel Borkmann
Quoted 14 lines · Greg KH
Quoted 4 lines · Luis Gerhorst
Quoted 4 lines
6.1-stable review patch. If anyone has any objections, please let me know.
From: Yafang Shao <[email protected]>
Quoted 8 lines
Quoted 1 line
commit
d75e30dddf73449bc2d10bb8e2f1a2c446bc67a2upstream.I unfortunately have objections, they are pending discussion at [1].
Same applies to the 6.4-stable review patch [2] and all other backports.
[1] https://lore.kernel.org/bpf/[email protected]/
[2] https://lore.kernel.org/stable/[email protected]/Quoted 6 lines
As this is in the tree already, and in Linus's tree, I'll wait to see if any changes are merged into Linus's tree for this before removing it from the stable trees.
Let us know if there's a commit that resolves this and we will be glad to queue that up.
Quoted 8 lines
Commit
d75e30dddf73("bpf: Fix issue in verifyingallow_ptr_leaks") is not stable material. It's not really a "fix", but it will simply make direct packet access available to applications withoutCAP_PERFMON- the latter was required so far given Spectre v1. However, there is ongoing discussion [1] that potentially not much useful information can be leaked out and therefore lifting it may or may not be ok. If we queue this to stable and later figure we need to revert the whole thing again because someone managed to come up with a PoC in the meantime, then there's higher risk of breakage.
Quoted 2 lines
Ick, ok, so just this one commit should be reverted? Or any others as well?
I don't think revert is necessary. Just don't backport any further.
Greg KH
maintainerRe: [PATCH 6.1 562/600] bpf: Fix issue in verifying allow_ptr_leaks
Quoted 34 lines · Alexei Starovoitov
Quoted 33 lines · Greg KH
Quoted 30 lines · Daniel Borkmann
Quoted 14 lines · Greg KH
Quoted 4 lines · Luis Gerhorst
Quoted 4 lines
6.1-stable review patch. If anyone has any objections, please let me know.
From: Yafang Shao <[email protected]>
Quoted 8 lines
Quoted 1 line
commit
d75e30dddf73449bc2d10bb8e2f1a2c446bc67a2upstream.I unfortunately have objections, they are pending discussion at [1].
Same applies to the 6.4-stable review patch [2] and all other backports.
[1] https://lore.kernel.org/bpf/[email protected]/
[2] https://lore.kernel.org/stable/[email protected]/Quoted 6 lines
As this is in the tree already, and in Linus's tree, I'll wait to see if any changes are merged into Linus's tree for this before removing it from the stable trees.
Let us know if there's a commit that resolves this and we will be glad to queue that up.
Commit
d75e30dddf73("bpf: Fix issue in verifyingallow_ptr_leaks") is not stable material. It's not really a "fix", but it will simply make direct packet access available to applications withoutCAP_PERFMON- the latter was required so far given Spectre v1. However, there is ongoing discussion [1] that potentially not much useful information can be leaked out and therefore lifting it may or may not be ok. If we queue this to stable and later figure we need to revert the whole thing again because someone managed to come up with a PoC in the meantime, then there's higher risk of breakage.
Quoted 4 lines
Quoted 2 lines
Ick, ok, so just this one commit should be reverted? Or any others as well?
I don't think revert is necessary. Just don't backport any further.
Ok, thanks, it's not backported into any other kernels at the moment, so I'll not worry about this anymore :)
greg k-h
Daniel Borkmann
maintainerRe: [PATCH 6.1 562/600] bpf: Fix issue in verifying allow_ptr_leaks
In reply to Alexei StarovoitovQuoted 34 lines · Alexei Starovoitov
Quoted 33 lines · Greg KH
Quoted 30 lines · Daniel Borkmann
Quoted 14 lines · Greg KH
Quoted 4 lines · Luis Gerhorst
Quoted 4 lines
6.1-stable review patch. If anyone has any objections, please let me know.
From: Yafang Shao <[email protected]>
Quoted 8 lines
Quoted 1 line
commit
d75e30dddf73449bc2d10bb8e2f1a2c446bc67a2upstream.I unfortunately have objections, they are pending discussion at [1].
Same applies to the 6.4-stable review patch [2] and all other backports.
[1] https://lore.kernel.org/bpf/[email protected]/
[2] https://lore.kernel.org/stable/[email protected]/Quoted 6 lines
As this is in the tree already, and in Linus's tree, I'll wait to see if any changes are merged into Linus's tree for this before removing it from the stable trees.
Let us know if there's a commit that resolves this and we will be glad to queue that up.
Commit
d75e30dddf73("bpf: Fix issue in verifyingallow_ptr_leaks") is not stable material. It's not really a "fix", but it will simply make direct packet access available to applications withoutCAP_PERFMON- the latter was required so far given Spectre v1. However, there is ongoing discussion [1] that potentially not much useful information can be leaked out and therefore lifting it may or may not be ok. If we queue this to stable and later figure we need to revert the whole thing again because someone managed to come up with a PoC in the meantime, then there's higher risk of breakage.
Quoted 4 lines
Quoted 2 lines
Ick, ok, so just this one commit should be reverted? Or any others as well?
I don't think revert is necessary. Just don't backport any further.
Yeah agree lets not backport further.
Greg Kroah-Hartman
maintainerPATCH 563/600 dlm: fix plock lookup when using multiple lockspaces
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Aring <[email protected]>
commit 7c53e847ff5e97f033fdd31f71949807633d506b upstream.
All posix lock ops, for all lockspaces (gfs2 file systems) are sent to userspace (dlm_controld) through a single misc device. The dlm_controld daemon reads the ops from the misc device and sends them to other cluster nodes using separate, per-lockspace cluster api communication channels. The ops for a single lockspace are ordered at this level, so that the results are received in the same sequence that the requests were sent. When the results are sent back to the kernel via the misc device, they are again funneled through the single misc device for all lockspaces. When the dlm code in the kernel processes the results from the misc device, these results will be returned in the same sequence that the requests were sent, on a per-lockspace basis. A recent change in this request/reply matching code missed the "per-lockspace" check (fsid comparison) when matching request and reply, so replies could be incorrectly matched to requests from other lockspaces.
--- fs/dlm/plock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/dlm/plock.c +3 -3
@@ -455,7 +455,8 @@ static ssize_t dev_write(struct file *fi } }else {list_for_each_entry (iter, &recv_list, list) { -if (!iter->info.wait) { +if (!iter->info.wait && + iter->info.fsid == info.fsid) { op = iter;break ; }
@@ -467,8 +468,7 @@ static ssize_t dev_write(struct file *fiif (info.wait)WARN_ON (op->info.optype !=DLM_PLOCK_OP_LOCK );else -WARN_ON (op->info.fsid != info.fsid || - op->info.number != info.number || +WARN_ON (op->info.number != info.number || op->info.owner != info.owner || op->info.optype != info.optype);
Greg Kroah-Hartman
maintainerPATCH 564/600 dccp: Fix out of bounds access in DCCP error handler
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 977ad86c2a1bcaf58f01ab98df5cc145083c489c upstream.
There was a previous attempt to fix an out-of-bounds access in the DCCP error handlers, but that fix assumed that the error handlers only want to access the first 8 bytes of the DCCP header. Actually, they also look at the DCCP sequence number, which is stored beyond 8 bytes, so an explicit pskb_may_pull() is required.
--- net/dccp/ipv4.c | 13 +++++++++---- net/dccp/ipv6.c | 15 ++++++++++----- 2 files changed, 19 insertions(+), 9 deletions(-)
net/dccp/ipv4.c +9 -4
@@ -255,12 +255,17 @@ static int dccp_v4_err(struct sk_buff *sint err;struct net *net =dev_net (skb->dev); -/* Only need dccph_dport & dccph_sport which are the first -* 4 bytes in dccp header. +/* For the first __dccp_basic_hdr_len() check, we only need dh->dccph_x, +* which is in byte 7 of the dccp header. * Our caller (icmp_socket_deliver()) already pulled 8 bytes for us. +* +* Later on, we want to access the sequence number fields, which are +* beyond 8 bytes, so we have to pskb_may_pull() ourselves. */ - BUILD_BUG_ON(offsetofend(struct dccp_hdr, dccph_sport) > 8); - BUILD_BUG_ON(offsetofend(struct dccp_hdr, dccph_dport) > 8); + dh = (struct dccp_hdr *)(skb->data + offset); +if (!pskb_may_pull (skb, offset +__dccp_basic_hdr_len (dh))) +return -EINVAL ; + iph = (struct iphdr *)skb->data; dh = (struct dccp_hdr *)(skb->data + offset); sk = __inet_lookup_established(net, &dccp_hashinfo,
net/dccp/ipv6.c +10 -5
@@ -74,7 +74,7 @@ static inline __u64 dccp_v6_init_sequencstatic int dccp_v6_err (struct sk_buff *skb,struct inet6_skb_parm *opt,u8 type,u8 code,int offset,__be32 info) { -const struct ipv6hdr *hdr = (const struct ipv6hdr *)skb->data; +const struct ipv6hdr *hdr;const struct dccp_hdr *dh;struct dccp_sock *dp;struct ipv6_pinfo *np;
@@ -83,12 +83,17 @@ static int dccp_v6_err(struct sk_buff *s__u64 seq;struct net *net =dev_net (skb->dev); -/* Only need dccph_dport & dccph_sport which are the first -* 4 bytes in dccp header. +/* For the first __dccp_basic_hdr_len() check, we only need dh->dccph_x, +* which is in byte 7 of the dccp header. * Our caller (icmpv6_notify()) already pulled 8 bytes for us. +* +* Later on, we want to access the sequence number fields, which are +* beyond 8 bytes, so we have to pskb_may_pull() ourselves. */ - BUILD_BUG_ON(offsetofend(struct dccp_hdr, dccph_sport) > 8); - BUILD_BUG_ON(offsetofend(struct dccp_hdr, dccph_dport) > 8); + dh = (struct dccp_hdr *)(skb->data + offset); +if (!pskb_may_pull (skb, offset +__dccp_basic_hdr_len (dh))) +return -EINVAL ; + hdr = (const struct ipv6hdr *)skb->data; dh = (struct dccp_hdr *)(skb->data + offset); sk = __inet6_lookup_established(net, &dccp_hashinfo,
Greg Kroah-Hartman
maintainerPATCH 565/600 x86/sev: Make enc_dec_hypercall() accept a size instead of npages
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve Rutherford <[email protected]>
commit ac3f9c9f1b37edaa7d1a9b908bc79d843955a1a2 upstream.
enc_dec_hypercall() accepted a page count instead of a size, which forced its callers to round up. As a result, non-page aligned vaddrs caused pages to be spuriously marked as decrypted via the encryption status hypercall, which in turn caused consistent corruption of pages during live migration. Live migration requires accurate encryption status information to avoid migrating pages from the wrong perspective.
--- arch/x86/include/asm/mem_encrypt.h | 6 +++--- arch/x86/kernel/kvm.c | 4 +--- arch/x86/mm/mem_encrypt_amd.c | 13 ++++++------- 3 files changed, 10 insertions(+), 13 deletions(-)
arch/x86/include/asm/mem_encrypt.h +3 -3
@@ -50,8 +50,8 @@ void __init sme_enable(struct boot_paramint __init early_set_memory_decrypted (unsigned long vaddr,unsigned long size);int __init early_set_memory_encrypted (unsigned long vaddr,unsigned long size); -void __init early_set_mem_enc_dec_hypercall (unsigned long vaddr,int npages, -bool enc); +void __init early_set_mem_enc_dec_hypercall (unsigned long vaddr, +unsigned long size,bool enc);void __init mem_encrypt_free_decrypted_mem (void );
@@ -84,7 +84,7 @@ early_set_memory_decrypted(unsigned longstatic inline int __init early_set_memory_encrypted (unsigned long vaddr,unsigned long size) {return 0 ; }static inline void __init -early_set_mem_enc_dec_hypercall (unsigned long vaddr,int npages,bool enc) {} +early_set_mem_enc_dec_hypercall (unsigned long vaddr,unsigned long size,bool enc) {}static inline void mem_encrypt_free_decrypted_mem (void ) { }
arch/x86/kernel/kvm.c +1 -3
@@ -972,10 +972,8 @@ static void __init kvm_init_platform(voi* Ensure that _bss_decrypted section is marked as decrypted in the * shared pages list. */ - nr_pages =DIV_ROUND_UP (__end_bss_decrypted - __start_bss_decrypted, -PAGE_SIZE );early_set_mem_enc_dec_hypercall ((unsigned long )__start_bss_decrypted, - nr_pages,0 ); + __end_bss_decrypted - __start_bss_decrypted,0 );/* * If not booted using EFI, enable Live migration support.
arch/x86/mm/mem_encrypt_amd.c +6 -7
@@ -288,11 +288,10 @@ static bool amd_enc_cache_flush_requiredreturn !cpu_feature_enabled (X86_FEATURE_SME_COHERENT ); } -static void enc_dec_hypercall (unsigned long vaddr,int npages,bool enc) +static void enc_dec_hypercall (unsigned long vaddr,unsigned long size,bool enc) {#ifdef CONFIG_PARAVIRT -unsigned long sz = npages <<PAGE_SHIFT ; -unsigned long vaddr_end = vaddr + sz; +unsigned long vaddr_end = vaddr + size;while (vaddr < vaddr_end) {int psize, pmask, level;
@@ -342,7 +341,7 @@ static bool amd_enc_status_change_finishsnp_set_memory_private (vaddr, npages);if (!cc_platform_has (CC_ATTR_HOST_MEM_ENCRYPT )) -enc_dec_hypercall (vaddr, npages, enc); +enc_dec_hypercall (vaddr, npages <<PAGE_SHIFT , enc);return true; }
@@ -466,7 +465,7 @@ static int __init early_set_memory_enc_d ret =0 ; -early_set_mem_enc_dec_hypercall (start,PAGE_ALIGN (size) >>PAGE_SHIFT , enc); +early_set_mem_enc_dec_hypercall (start, size, enc); out:__flush_tlb_all ();return ret;
@@ -482,9 +481,9 @@ int __init early_set_memory_encrypted(unreturn early_set_memory_enc_dec (vaddr, size, true); } -void __init early_set_mem_enc_dec_hypercall (unsigned long vaddr,int npages,bool enc) +void __init early_set_mem_enc_dec_hypercall (unsigned long vaddr,unsigned long size,bool enc) { -enc_dec_hypercall (vaddr, npages, enc); +enc_dec_hypercall (vaddr, size, enc); }void __init sme_early_init (void )
Greg Kroah-Hartman
maintainerPATCH 566/600 r8169: fix ASPM-related issues on a number of systems with NIC version from RTL8168h
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiner Kallweit <[email protected]>
commit 90ca51e8c654699b672ba61aeaa418dfb3252e5e upstream.
This effectively reverts 4b5f82f6aaef. On a number of systems ASPM L1 causes tx timeouts with RTL8168h, see referenced bug report.
--- drivers/net/ethernet/realtek/r8169_main.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/net/ethernet/realtek/r8169_main.c +0 -4
@@ -5201,13 +5201,9 @@ static int rtl_init_one(struct pci_dev */* Disable ASPM L1 as that cause random device stop working * problems as well as full system hangs for some PCIe devices users. -* Chips from RTL8168h partially have issues with L1.2, but seem -* to work fine with L1 and L1.1. */ if (rtl_aspm_is_safe (tp)) rc =0 ; -else if (tp->mac_version >=RTL_GIGA_MAC_VER_46 ) - rc =pci_disable_link_state (pdev,PCIE_LINK_STATE_L1_2 );else rc =pci_disable_link_state (pdev,PCIE_LINK_STATE_L1 ); tp->aspm_manageable = !rc;
Greg Kroah-Hartman
maintainerPATCH 567/600 X.509: if signature is unsupported skip validation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thore Sommer <[email protected]>
commit ef5b52a631f8c18353e80ccab8408b963305510c upstream.
When the hash algorithm for the signature is not available the digest size is 0 and the signature in the certificate is marked as unsupported.
When validating a self-signed certificate, this needs to be checked, because otherwise trying to validate the signature will fail with an warning:
Loading compiled-in X.509 certificates
WARNING: CPU: 0 PID: 1 at crypto/rsa-pkcs1pad.c:537 \ pkcs1pad_verify+0x46/0x12c
...
Problem loading in-kernel X.509 certificate (-22)
--- crypto/asymmetric_keys/x509_public_key.c | 5 +++++ 1 file changed, 5 insertions(+)
crypto/asymmetric_keys/x509_public_key.c +5 -0
@@ -117,6 +117,11 @@ int x509_check_for_self_signed(struct x5 goto out; } +if (cert->unsupported_sig) { + ret =0 ; + goto out; + } + ret =public_key_verify_signature (cert->pub, cert->sig);if (ret <0 ) {if (ret == -ENOPKG ) {
Greg Kroah-Hartman
maintainerPATCH 568/600 net: handle ARPHRD_PPP in dev_is_mac_header_xmit()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Dichtel <[email protected]>
commit a4f39c9f14a634e4cd35fcd338c239d11fcc73fc upstream.
The goal is to support a bpf_redirect() from an ethernet device (ingress) to a ppp device (egress).
The l2 header is added automatically by the ppp driver, thus the ethernet header should be removed.
--- include/linux/if_arp.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/if_arp.h +4 -0
@@ -53,6 +53,10 @@ static inline bool dev_is_mac_header_xmicase ARPHRD_NONE :case ARPHRD_RAWIP :case ARPHRD_PIMREG : +/* PPP adds its l2 header automatically in ppp_start_xmit(). +* This makes it look like an l3 device to __bpf_redirect() and tcf_mirred_init(). +*/ +case ARPHRD_PPP :return false;default :return true;
Greg Kroah-Hartman
maintainerPATCH 569/600 fsverity: skip PKCS#7 parser when keyring is empty
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 919dc320956ea353a7fb2d84265195ad5ef525ac upstream.
If an fsverity builtin signature is given for a file but the ".fs-verity" keyring is empty, there's no real reason to run the PKCS#7 parser. Skip this to avoid the PKCS#7 attack surface when builtin signature support is configured into the kernel but is not being used.
This is a hardening improvement, not a fix per se, but I've added Fixes and Cc stable to get it out to more users.
--- fs/verity/signature.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
fs/verity/signature.c +16 -0
@@ -54,6 +54,22 @@ int fsverity_verify_signature(const strureturn 0 ; } +if (fsverity_keyring->keys.nr_leaves_on_tree ==0 ) { +/* +* The ".fs-verity" keyring is empty, due to builtin signatures +* being supported by the kernel but not actually being used. +* In this case, verify_pkcs7_signature() would always return an +* error, usually ENOKEY. It could also be EBADMSG if the +* PKCS#7 is malformed, but that isn't very important to +* distinguish. So, just skip to ENOKEY to avoid the attack +* surface of the PKCS#7 parser, which would otherwise be +* reachable by any task able to execute FS_IOC_ENABLE_VERITY. +*/ +fsverity_err (inode, +"fs-verity keyring is empty, rejecting signed file!" ); +return -ENOKEY ; + } + d =kzalloc (sizeof (*d) + hash_alg->digest_size,GFP_KERNEL );if (!d)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 570/600 x86/MCE: Always save CS register on AMD Zen IF Poison errors
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yazen Ghannam <[email protected]>
commit 4240e2ebe67941ce2c4f5c866c3af4b5ac7a0c67 upstream.
The Instruction Fetch (IF) units on current AMD Zen-based systems do not guarantee a synchronous #MC is delivered for poison consumption errors. Therefore, MCG_STATUS[EIPV|RIPV] will not be set. However, the microarchitecture does guarantee that the exception is delivered within the same context. In other words, the exact rIP is not known, but the context is known to not have changed.
There is no architecturally-defined method to determine this behavior.
The Code Segment (CS) register is always valid on such IF unit poison errors regardless of the value of MCG_STATUS[EIPV|RIPV].
Add a quirk to save the CS register for poison consumption from the IF unit banks.
This is needed to properly determine the context of the error. Otherwise, the severity grading function will assume the context is IN_KERNEL due to the m->cs value being 0 (the initialized value). This leads to unnecessary kernel panics on data poison errors due to the kernel believing the poison consumption occurred in kernel context.
--- arch/x86/kernel/cpu/mce/core.c | 26 ++++++++++++++++++++++++++ arch/x86/kernel/cpu/mce/internal.h | 5 ++++- 2 files changed, 30 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/mce/core.c +26 -0
@@ -857,6 +857,26 @@ static noinstr bool quirk_skylake_repmov }/* +* Some Zen-based Instruction Fetch Units set EIPV=RIPV=0 on poison consumption +* errors. This means mce_gather_info() will not save the "ip" and "cs" registers. +* +* However, the context is still valid, so save the "cs" register for later use. +* +* The "ip" register is truly unknown, so don't save it or fixup EIPV/RIPV. +* +* The Instruction Fetch Unit is at MCA bank 1 for all affected systems. +*/ +static __always_inline void quirk_zen_ifu(int bank, struct mce *m, struct pt_regs *regs) +{ +if (bank !=1 ) +return ; +if (!(m->status &MCI_STATUS_POISON )) +return ; + + m->cs = regs->cs; +} + +/* * Do a quick check if any of the events requires a panic. * This decides if we keep the events around or clear them. */
@@ -875,6 +895,9 @@ static __always_inline int mce_no_way_ouif (mce_flags.snb_ifu_quirk)quirk_sandybridge_ifu (i, m, regs); +if (mce_flags.zen_ifu_quirk) +quirk_zen_ifu (i, m, regs); + m->bank = i;if (mce_severity (m, regs, &tmp, true) >=MCE_PANIC_SEVERITY ) {mce_read_aux (m, i);
@@ -1852,6 +1875,9 @@ static int __mcheck_cpu_apply_quirks(strif (c->x86 ==0x15 && c->x86_model <=0xf ) mce_flags.overflow_recov =1 ; +if (c->x86 >=0x17 && c->x86 <=0x1A ) + mce_flags.zen_ifu_quirk =1 ; + }if (c->x86_vendor ==X86_VENDOR_INTEL ) {
arch/x86/kernel/cpu/mce/internal.h +4 -1
@@ -157,6 +157,9 @@ struct mce_vendor_flags {*/ smca : 1, + /* Zen IFU quirk */ + zen_ifu_quirk : 1, + /* AMD-style error thresholding banks present. */ amd_threshold : 1,
@@ -172,7 +175,7 @@ struct mce_vendor_flags {/* Skylake, Cascade Lake, Cooper Lake REP;MOVS* quirk */ skx_repmov_quirk :1 , - __reserved_0 : 56; + __reserved_0 : 55; };extern struct mce_vendor_flags mce_flags;
Greg Kroah-Hartman
maintainerPATCH 571/600 platform/chrome: chromeos_acpi: print hex string for ACPI_TYPE_BUFFER
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tzung-Bi Shih <[email protected]>
commit 0820debb7d489e9eb1f68b7bb69e6ae210699b3f upstream.
element->buffer.pointer should be binary blob. %s doesn't work perfect for them.
Print hex string for ACPI_TYPE_BUFFER. Also update the documentation to reflect this.
--- Documentation/ABI/testing/sysfs-driver-chromeos-acpi | 2 - drivers/platform/chrome/chromeos_acpi.c | 31 ++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-)
Documentation/ABI/testing/sysfs-driver-chromeos-acpi +1 -1
@@ -134,4 +134,4 @@ KernelVersion: 5.19 Description: Returns the verified boot data block shared between the firmware verification step and the kernel verification step - (binary). + (hex dump).
drivers/platform/chrome/chromeos_acpi.c +30 -1
@@ -90,7 +90,36 @@ static int chromeos_acpi_handle_package(case ACPI_TYPE_STRING :return sysfs_emit (buf,"%s\n" , element->string.pointer);case ACPI_TYPE_BUFFER : -return sysfs_emit (buf,"%s\n" , element->buffer.pointer); + { +int i, r, at, room_left; +const int byte_per_line =16 ; + + at =0 ; + room_left =PAGE_SIZE -1 ; +for (i =0 ; i < element->buffer.length && room_left; i += byte_per_line) { + r =hex_dump_to_buffer (element->buffer.pointer + i, + element->buffer.length - i, + byte_per_line,1 , buf + at, room_left, + false); +if (r > room_left) + goto truncating; + at += r; + room_left -= r; + + r =sysfs_emit_at (buf, at,"\n" ); +if (!r) + goto truncating; + at += r; + room_left -= r; + } + + buf[at] =0 ; +return at; +truncating: +dev_info_once (dev,"truncating sysfs content for %s\n" , name); +sysfs_emit_at (buf,PAGE_SIZE -4 ,"..\n" ); +return PAGE_SIZE -1 ; + }default :dev_err (dev,"element type %d not supported\n" , element->type);return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 572/600 mmc: renesas_sdhi: register irqs before registering controller
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
commit 74f45de394d979cc7770271f92fafa53e1ed3119 upstream.
IRQs should be ready to serve when we call mmc_add_host() via tmio_mmc_host_probe(). To achieve that, ensure that all irqs are masked before registering the handlers.
--- drivers/mmc/host/renesas_sdhi_core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/mmc/host/renesas_sdhi_core.c +7 -3
@@ -1006,6 +1006,8 @@ int renesas_sdhi_probe(struct platform_d host->sdcard_irq_setbit_mask =TMIO_STAT_ALWAYS_SET_27 ; host->sdcard_irq_mask_all =TMIO_MASK_ALL_RCAR2 ; host->reset = renesas_sdhi_reset; + }else { + host->sdcard_irq_mask_all =TMIO_MASK_ALL ; }/* Orginally registers were 16 bit apart, could be 32 or 64 nowadays */
@@ -1102,9 +1104,7 @@ int renesas_sdhi_probe(struct platform_d host->ops.hs400_complete = renesas_sdhi_hs400_complete; } - ret =tmio_mmc_host_probe (host); -if (ret <0 ) - goto edisclk; +sd_ctrl_write32_as_16_and_16 (host,CTL_IRQ_MASK , host->sdcard_irq_mask_all); num_irqs =platform_irq_count (pdev);if (num_irqs <0 ) {
@@ -1131,6 +1131,10 @@ int renesas_sdhi_probe(struct platform_d goto eirq; } + ret =tmio_mmc_host_probe (host); +if (ret <0 ) + goto edisclk; +dev_info (&pdev->dev,"%s base at %pa, max clock rate %u MHz\n" ,mmc_hostname (host->mmc), &res->start, host->mmc->f_max /1000000 );
Greg Kroah-Hartman
maintainerPATCH 573/600 pstore/ram: Check start of empty przs during init
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Enlin Mu <[email protected]>
commit fe8c3623ab06603eb760444a032d426542212021 upstream.
After commit 30696378f68a ("pstore/ram: Do not treat empty buffers as valid"), initialization would assume a prz was valid after seeing that the buffer_size is zero (regardless of the buffer start position). This unchecked start value means it could be outside the bounds of the buffer, leading to future access panics when written to:
sysdump_panic_event+0x3b4/0x5b8 atomic_notifier_call_chain+0x54/0x90 panic+0x1c8/0x42c die+0x29c/0x2a8 die_kernel_fault+0x68/0x78 __do_kernel_fault+0x1c4/0x1e0 do_bad_area+0x40/0x100 do_translation_fault+0x68/0x80 do_mem_abort+0x68/0xf8 el1_da+0x1c/0xc0 __raw_writeb+0x38/0x174 __memcpy_toio+0x40/0xac persistent_ram_update+0x44/0x12c persistent_ram_write+0x1a8/0x1b8 ramoops_pstore_write+0x198/0x1e8 pstore_console_write+0x94/0xe0 ...
To avoid this, also check if the prz start is 0 during the initialization phase. If not, the next prz sanity check case will discover it (start > size) and zap the buffer back to a sane state.
--- fs/pstore/ram_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/pstore/ram_core.c +1 -1
@@ -518,7 +518,7 @@ static int persistent_ram_post_init(stru sig ^=PERSISTENT_RAM_SIG ;if (prz->buffer->sig == sig) { -if (buffer_size (prz) ==0 ) { +if (buffer_size (prz) ==0 &&buffer_start (prz) ==0 ) {pr_debug ("found existing empty buffer\n" );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 574/600 arm64: sdei: abort running SDEI handlers during crash
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: D Scott Phillips <[email protected]>
commit 5cd474e57368f0957c343bb21e309cf82826b1ef upstream.
Interrupts are blocked in SDEI context, per the SDEI spec: "The client interrupts cannot preempt the event handler." If we crashed in the SDEI handler-running context (as with ACPI's AGDI) then we need to clean up the SDEI state before proceeding to the crash kernel so that the crash kernel can have working interrupts.
Track the active SDEI handler per-cpu so that we can COMPLETE_AND_RESUME the handler, discarding the interrupted context.
--- arch/arm64/include/asm/sdei.h | 6 ++++++ arch/arm64/kernel/entry.S | 27 +++++++++++++++++++++++++-- arch/arm64/kernel/sdei.c | 3 +++ arch/arm64/kernel/smp.c | 8 ++++---- drivers/firmware/arm_sdei.c | 19 +++++++++++++++++++ include/linux/arm_sdei.h | 2 ++ 6 files changed, 59 insertions(+), 6 deletions(-)
arch/arm64/include/asm/sdei.h +6 -0
@@ -17,6 +17,9 @@#include <asm/virt.h> +DECLARE_PER_CPU(struct sdei_registered_event *, sdei_active_normal_event); +DECLARE_PER_CPU(struct sdei_registered_event *, sdei_active_critical_event); +extern unsigned long sdei_exit_mode;/* Software Delegated Exception entry point from firmware*/
@@ -29,6 +32,9 @@ asmlinkage void __sdei_asm_entry_trampolunsigned long pc, unsigned long pstate); +/* Abort a running handler. Context is discarded. */ +void __sdei_handler_abort (void ); +/* * The above entry point does the minimum to call C code. This function does * anything else, before calling the driver.
arch/arm64/kernel/entry.S +25 -2
@@ -993,9 +993,13 @@ SYM_CODE_START(__sdei_asm_handler) mov x19, x1 -#if defined(CONFIG_VMAP_STACK) || defined(CONFIG_SHADOW_CALL_STACK) + /* Store the registered-event for crash_smp_send_stop() */ ldrb w4, [x19, #SDEI_EVENT_PRIORITY] -#endif + cbnz w4, 1f + adr_this_cpu dst=x5, sym=sdei_active_normal_event, tmp=x6 + b 2f +1: adr_this_cpu dst=x5, sym=sdei_active_critical_event, tmp=x6 +2: str x19, [x5] #ifdef CONFIG_VMAP_STACK /*
@@ -1062,6 +1066,14 @@ SYM_CODE_START(__sdei_asm_handler) ldr_l x2, sdei_exit_mode + /* Clear the registered-event seen by crash_smp_send_stop() */ + ldrb w3, [x4, #SDEI_EVENT_PRIORITY] + cbnz w3, 1f + adr_this_cpu dst=x5, sym=sdei_active_normal_event, tmp=x6 + b 2f +1: adr_this_cpu dst=x5, sym=sdei_active_critical_event, tmp=x6 +2: str xzr, [x5] + alternative_if_not ARM64_UNMAP_KERNEL_AT_EL0 sdei_handler_exit exit_mode=x2 alternative_else_nop_endif
@@ -1072,4 +1084,15 @@ alternative_else_nop_endif #endif SYM_CODE_END(__sdei_asm_handler) NOKPROBE(__sdei_asm_handler) + +SYM_CODE_START(__sdei_handler_abort) + mov_q x0, SDEI_1_0_FN_SDEI_EVENT_COMPLETE_AND_RESUME + adr x1, 1f + ldr_l x2, sdei_exit_mode + sdei_handler_exit exit_mode=x2 + // exit the handler and jump to the next instruction. + // Exit will stomp x0-x17, PSTATE, ELR_ELx, and SPSR_ELx. +1: ret +SYM_CODE_END(__sdei_handler_abort) +NOKPROBE(__sdei_handler_abort) #endif /* CONFIG_ARM_SDE_INTERFACE */
arch/arm64/kernel/sdei.c +3 -0
@@ -47,6 +47,9 @@ DEFINE_PER_CPU(unsigned long *, sdei_sha DEFINE_PER_CPU(unsigned long *, sdei_shadow_call_stack_critical_ptr);#endif +DEFINE_PER_CPU(struct sdei_registered_event *, sdei_active_normal_event); +DEFINE_PER_CPU(struct sdei_registered_event *, sdei_active_critical_event); +static void _free_sdei_stack (unsigned long *__percpu *ptr,int cpu) {unsigned long *p;
arch/arm64/kernel/smp.c +4 -4
@@ -1047,10 +1047,8 @@ void crash_smp_send_stop(void)* If this cpu is the only one alive at this point in time, online or * not, there are no stop messages to be sent around, so just back out. */ -if (num_other_online_cpus () ==0 ) { -sdei_mask_local_cpu (); -return ; - } +if (num_other_online_cpus () ==0 ) + goto skip_ipi;cpumask_copy (&mask, cpu_online_mask);cpumask_clear_cpu (smp_processor_id (), &mask);
@@ -1069,7 +1067,9 @@ void crash_smp_send_stop(void)pr_warn ("SMP: failed to stop secondary CPUs %*pbl\n" ,cpumask_pr_args (&mask)); +skip_ipi:sdei_mask_local_cpu (); +sdei_handler_abort (); }bool smp_crash_stop_failed (void )
drivers/firmware/arm_sdei.c +19 -0
@@ -1095,3 +1095,22 @@ int sdei_event_handler(struct pt_regs *rreturn err; }NOKPROBE_SYMBOL (sdei_event_handler); + +void sdei_handler_abort (void ) +{ +/* +* If the crash happened in an SDEI event handler then we need to +* finish the handler with the firmware so that we can have working +* interrupts in the crash kernel. +*/ +if (__this_cpu_read (sdei_active_critical_event)) { +pr_warn ("still in SDEI critical event context, attempting to finish handler.\n" ); +__sdei_handler_abort (); +__this_cpu_write (sdei_active_critical_event,NULL ); + } +if (__this_cpu_read (sdei_active_normal_event)) { +pr_warn ("still in SDEI normal event context, attempting to finish handler.\n" ); +__sdei_handler_abort (); +__this_cpu_write (sdei_active_normal_event,NULL ); + } +}
include/linux/arm_sdei.h +2 -0
@@ -47,10 +47,12 @@ int sdei_unregister_ghes(struct ghes *ghint sdei_mask_local_cpu (void );int sdei_unmask_local_cpu (void );void __init sdei_init (void ); +void sdei_handler_abort (void );#else static inline int sdei_mask_local_cpu (void ) {return 0 ; }static inline int sdei_unmask_local_cpu (void ) {return 0 ; }static inline void sdei_init (void ) { } +static inline void sdei_handler_abort (void ) { }#endif /* CONFIG_ARM_SDE_INTERFACE */
Greg Kroah-Hartman
maintainerPATCH 575/600 s390/dcssblk: fix kernel crash with list_add corruption
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gerald Schaefer <[email protected]>
commit c8f40a0bccefd613748d080147469a4652d6e74c upstream.
Commit fb08a1908cb1 ("dax: simplify the dax_device <-> gendisk association") introduced new logic for gendisk association, requiring drivers to explicitly call dax_add_host() and dax_remove_host().
For dcssblk driver, some dax_remove_host() calls were missing, e.g. in device remove path. The commit also broke error handling for out_dax case in device add path, resulting in an extra put_device() w/o the previous get_device() in that case.
This lead to stale xarray entries after device add / remove cycles. In the case when a previously used struct gendisk pointer (xarray index) would be used again, because blk_alloc_disk() happened to return such a pointer, the xa_insert() in dax_add_host() would fail and go to out_dax, doing the extra put_device() in the error path. In combination with an already flawed error handling in dcssblk (device_register() cleanup), which needs to be addressed in a separate patch, this resulted in a missing device_del() / klist_del(), and eventually in the kernel crash with list_add corruption on a subsequent device_add() / klist_add().
Fix this by adding the missing dax_remove_host() calls, and also move the put_device() in the error path to restore the previous logic.
--- drivers/s390/block/dcssblk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/s390/block/dcssblk.c +3 -1
@@ -411,6 +411,7 @@ removeseg: }list_del (&dev_info->lh); +dax_remove_host (dev_info->gd);kill_dax (dev_info->dax_dev);put_dax (dev_info->dax_dev);del_gendisk (dev_info->gd);
@@ -706,9 +707,9 @@ dcssblk_add_store(struct device *dev, st goto out; out_dax_host: +put_device (&dev_info->dev);dax_remove_host (dev_info->gd); out_dax: -put_device (&dev_info->dev);kill_dax (dev_info->dax_dev);put_dax (dev_info->dax_dev); put_dev:
@@ -788,6 +789,7 @@ dcssblk_remove_store(struct device *dev, }list_del (&dev_info->lh); +dax_remove_host (dev_info->gd);kill_dax (dev_info->dax_dev);put_dax (dev_info->dax_dev);del_gendisk (dev_info->gd);
Greg Kroah-Hartman
maintainerPATCH 576/600 s390/ipl: add missing secure/has_secure file to ipl type unknown
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Schnelle <[email protected]>
commit ea5717cb13468323a7c3dd394748301802991f39 upstream.
OS installers are relying on /sys/firmware/ipl/has_secure to be present on machines supporting secure boot. This file is present for all IPL types, but not the unknown type, which prevents a secure installation when an LPAR is booted in HMC via FTP(s), because this is an unknown IPL type in linux. While at it, also add the secure file.
--- arch/s390/kernel/ipl.c | 2 ++ 1 file changed, 2 insertions(+)
arch/s390/kernel/ipl.c +2 -0
@@ -503,6 +503,8 @@ static struct attribute_group ipl_ccw_atstatic struct attribute *ipl_unknown_attrs[] = { &sys_ipl_type_attr.attr, + &sys_ipl_secure_attr.attr, + &sys_ipl_has_secure_attr.attr,NULL , };
Greg Kroah-Hartman
maintainerPATCH 577/600 s390/dasd: fix string length handling
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
commit f7cf22424665043787a96a66a048ff6b2cfd473c upstream.
Building dasd_eckd.o with latest clang reveals this bug:
CC drivers/s390/block/dasd_eckd.o
drivers/s390/block/dasd_eckd.c:1082:3: warning: 'snprintf' will always be truncated; specified size is 1, but format string expands to at least 11 [-Wfortify-source]
1082 | snprintf(print_uid, sizeof(*print_uid),
| ^
drivers/s390/block/dasd_eckd.c:1087:3: warning: 'snprintf' will always be truncated; specified size is 1, but format string expands to at least 10 [-Wfortify-source]
1087 | snprintf(print_uid, sizeof(*print_uid),
| ^
Fix this by moving and using the existing UID_STRLEN for the arrays that are being written to. Also rename UID_STRLEN to DASD_UID_STRLEN to clarify its scope.
--- drivers/s390/block/dasd_devmap.c | 6 +----- drivers/s390/block/dasd_eckd.c | 10 +++++----- drivers/s390/block/dasd_int.h | 4 ++++ 3 files changed, 10 insertions(+), 10 deletions(-)
drivers/s390/block/dasd_devmap.c +1 -5
@@ -1377,16 +1377,12 @@ static ssize_t dasd_vendor_show(struct d static DEVICE_ATTR(vendor, 0444, dasd_vendor_show, NULL); -#define UID_STRLEN ( /* vendor */ 3 + 1 + /* serial */ 14 + 1 +\ - /* SSID */ 4 + 1 + /* unit addr */ 2 + 1 +\ - /* vduit */ 32 + 1) -static ssize_t dasd_uid_show (struct device *dev,struct device_attribute *attr,char *buf) { +char uid_string[DASD_UID_STRLEN ];struct dasd_device *device;struct dasd_uid uid; -char uid_string[UID_STRLEN ];char ua_string[3 ]; device =dasd_device_from_cdev (to_ccwdev (dev));
drivers/s390/block/dasd_eckd.c +5 -5
@@ -1079,12 +1079,12 @@ static void dasd_eckd_get_uid_string(strcreate_uid (conf, &uid);if (strlen (uid.vduit) >0 ) -snprintf (print_uid,sizeof (*print_uid), +snprintf (print_uid,DASD_UID_STRLEN ,"%s.%s.%04x.%02x.%s" , uid.vendor, uid.serial, uid.ssid, uid.real_unit_addr, uid.vduit);else -snprintf (print_uid,sizeof (*print_uid), +snprintf (print_uid,DASD_UID_STRLEN ,"%s.%s.%04x.%02x" , uid.vendor, uid.serial, uid.ssid, uid.real_unit_addr);
@@ -1093,8 +1093,8 @@ static void dasd_eckd_get_uid_string(strstatic int dasd_eckd_check_cabling (struct dasd_device *device,void *conf_data,__u8 lpm) { +char print_path_uid[DASD_UID_STRLEN ], print_device_uid[DASD_UID_STRLEN ];struct dasd_eckd_private *private = device->private; -char print_path_uid[60 ], print_device_uid[60 ];struct dasd_conf path_conf; path_conf.data = conf_data;
@@ -1293,9 +1293,9 @@ static void dasd_eckd_path_available_act__u8 path_rcd_buf[DASD_ECKD_RCD_DATA_SIZE ];__u8 lpm, opm, npm, ppm, epm, hpfpm, cablepm;struct dasd_conf_data *conf_data; +char print_uid[DASD_UID_STRLEN ];struct dasd_conf path_conf;unsigned long flags; -char print_uid[60 ];int rc, pos; opm =0 ;
@@ -5856,8 +5856,8 @@ static void dasd_eckd_dump_sense(structstatic int dasd_eckd_reload_device (struct dasd_device *device) {struct dasd_eckd_private *private = device->private; +char print_uid[DASD_UID_STRLEN ];int rc, old_base; -char print_uid[60 ];struct dasd_uid uid;unsigned long flags;
drivers/s390/block/dasd_int.h +4 -0
@@ -259,6 +259,10 @@ struct dasd_uid {char vduit[33 ]; }; +#define DASD_UID_STRLEN (/* vendor */ 3 +1 +/* serial */ 14 +1 + \ +/* SSID */ 4 +1 +/* unit addr */ 2 +1 + \ + /* vduit */ 32 + 1) +/* * PPRC Status data */
Greg Kroah-Hartman
maintainerPATCH 578/600 crypto: stm32 - fix loop iterating through scatterlist for DMA
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Bourgoin <[email protected]>
commit d9c83f71eeceed2cb54bb78be84f2d4055fd9a1f upstream.
We were reading the length of the scatterlist sg after copying value of tsg inside.
So we are using the size of the previous scatterlist and for the first one we are using an unitialised value.
Fix this by copying tsg in sg[0] before reading the size.
--- drivers/crypto/stm32/stm32-hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/stm32/stm32-hash.c +1 -1
@@ -565,9 +565,9 @@ static int stm32_hash_dma_send(struct st }for_each_sg (rctx->sg, tsg, rctx->nents, i) { + sg[0 ] = *tsg; len = sg->length; - sg[0 ] = *tsg;if (sg_is_last (sg)) {if (hdev->dma_mode ==1 ) { len = (ALIGN (sg->length,16 ) -16 );
Greg Kroah-Hartman
maintainerPATCH 579/600 cpufreq: brcmstb-avs-cpufreq: Fix -Warray-bounds bug
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
commit e520d0b6be950ce3738cf4b9bd3b392be818f1dc upstream.
Allocate extra space for terminating element at:
drivers/cpufreq/brcmstb-avs-cpufreq.c:
449 table[i].frequency = CPUFREQ_TABLE_END;
and add code comment to make this clear.
This fixes the following -Warray-bounds warning seen after building
ARM with multi_v7_defconfig (GCC 13):
In function 'brcm_avs_get_freq_table',
inlined from 'brcm_avs_cpufreq_init' at drivers/cpufreq/brcmstb-avs-cpufreq.c:623:15:drivers/cpufreq/brcmstb-avs-cpufreq.c:449:28: warning: array subscript 5 is outside array bounds of 'void[60]' [-Warray-bounds=]
449 | table[i].frequency = CPUFREQ_TABLE_END;
In file included from include/linux/node.h:18,
from include/linux/cpu.h:17,
from include/linux/cpufreq.h:12,
from drivers/cpufreq/brcmstb-avs-cpufreq.c:44:
In function 'devm_kmalloc_array',
inlined from 'devm_kcalloc' at include/linux/device.h:328:9,
inlined from 'brcm_avs_get_freq_table' at drivers/cpufreq/brcmstb-avs-cpufreq.c:437:10,
inlined from 'brcm_avs_cpufreq_init' at drivers/cpufreq/brcmstb-avs-cpufreq.c:623:15:include/linux/device.h:323:16: note: at offset 60 into object of size 60 allocated by 'devm_kmalloc'
323 | return devm_kmalloc(dev, bytes, flags);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy() and help us make progress towards globally enabling -Warray-bounds.
--- drivers/cpufreq/brcmstb-avs-cpufreq.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/cpufreq/brcmstb-avs-cpufreq.c +5 -1
@@ -434,7 +434,11 @@ brcm_avs_get_freq_table(struct device *dif (ret)return ERR_PTR (ret); - table =devm_kcalloc (dev,AVS_PSTATE_MAX +1 ,sizeof (*table), +/* +* We allocate space for the 5 different P-STATES AVS, +* plus extra space for a terminating element. +*/ + table =devm_kcalloc (dev,AVS_PSTATE_MAX +1 +1 ,sizeof (*table),GFP_KERNEL );if (!table)return ERR_PTR (-ENOMEM );
Greg Kroah-Hartman
maintainerPATCH 580/600 of: property: fw_devlink: Add a devlink for panel followers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
commit fbf0ea2da3c7cd0b33ed7ae53a67ab1c24838cba upstream.
Inform fw_devlink of the fact that a panel follower (like a touchscreen) is effectively a consumer of the panel from the purposes of fw_devlink.
NOTE: this patch isn't required for correctness but instead optimizes probe order / helps avoid deferrals.
--- drivers/of/property.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/of/property.c +2 -0
@@ -1266,6 +1266,7 @@ DEFINE_SIMPLE_PROP(pwms, "pwms", "#pwm-c DEFINE_SIMPLE_PROP(resets, "resets", "#reset-cells") DEFINE_SIMPLE_PROP(leds, "leds", NULL) DEFINE_SIMPLE_PROP(backlight, "backlight", NULL) +DEFINE_SIMPLE_PROP(panel, "panel", NULL) DEFINE_SUFFIX_PROP(regulators, "-supply", NULL)DEFINE_SUFFIX_PROP (gpio,"-gpio" ,"#gpio-cells" )
@@ -1354,6 +1355,7 @@ static const struct supplier_bindings of { .parse_prop = parse_resets, }, { .parse_prop = parse_leds, }, { .parse_prop = parse_backlight, }, + { .parse_prop = parse_panel, }, { .parse_prop = parse_gpio_compat, }, { .parse_prop = parse_interrupts, }, { .parse_prop = parse_regulators, },
Greg Kroah-Hartman
maintainerPATCH 581/600 usb: typec: tcpm: set initial svdm version based on pd revision
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: RD Babiera <[email protected]>
commit c97cd0b4b54eb42aed7f6c3c295a2d137f6d2416 upstream.
When sending Discover Identity messages to a Port Partner that uses Power Delivery v2 and SVDM v1, we currently send PD v2 messages with SVDM v2.0, expecting the port partner to respond with its highest supported SVDM version as stated in Section 6.4.4.2.3 in the Power Delivery v3 specification. However, sending SVDM v2 to some Power Delivery v2 port partners results in a NAK whereas sending SVDM v1 does not.
NAK messages can be handled by the initiator (PD v3 section 6.4.4.2.5.1), and one solution could be to resend Discover Identity on a lower SVDM version if possible. But, Section 6.4.4.3 of PD v2 states that "A NAK response Should be taken as an indication not to retry that particular Command."
Instead, we can set the SVDM version to the maximum one supported by the negotiated PD revision. When operating in PD v2, this obeys Section 6.4.4.2.3, which states the SVDM field "Shall be set to zero to indicate Version 1.0." In PD v3, the SVDM field "Shall be set to 01b to indicate Version 2.0."
--- drivers/usb/typec/tcpm/tcpm.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-)
drivers/usb/typec/tcpm/tcpm.c +31 -4
@@ -3929,6 +3929,29 @@ static enum typec_cc_status tcpm_pwr_opm } } +static void tcpm_set_initial_svdm_version (struct tcpm_port *port) +{ +switch (port->negotiated_rev) { +case PD_REV30 : +break ; +/* +* 6.4.4.2.3 Structured VDM Version +* 2.0 states "At this time, there is only one version (1.0) defined. +* This field Shall be set to zero to indicate Version 1.0." +* 3.0 states "This field Shall be set to 01b to indicate Version 2.0." +* To ensure that we follow the Power Delivery revision we are currently +* operating on, downgrade the SVDM version to the highest one supported +* by the Power Delivery revision. +*/ +case PD_REV20 : +typec_partner_set_svdm_version (port->partner,SVDM_VER_1_0 ); +break ; +default : +typec_partner_set_svdm_version (port->partner,SVDM_VER_1_0 ); +break ; + } +} +static void run_state_machine (struct tcpm_port *port) {int ret;
@@ -4153,10 +4176,12 @@ static void run_state_machine(struct tcp* For now, this driver only supports SOP for DISCOVER_IDENTITY, thus using * port->explicit_contract to decide whether to send the command. */ -if (port->explicit_contract) +if (port->explicit_contract) { +tcpm_set_initial_svdm_version (port);mod_send_discover_delayed_work (port,0 ); -else + }else { port->send_discover = false; + }/* * 6.3.5
@@ -4439,10 +4464,12 @@ static void run_state_machine(struct tcp* For now, this driver only supports SOP for DISCOVER_IDENTITY, thus using * port->explicit_contract. */ -if (port->explicit_contract) +if (port->explicit_contract) { +tcpm_set_initial_svdm_version (port);mod_send_discover_delayed_work (port,0 ); -else + }else { port->send_discover = false; + }power_supply_changed (port->psy);break ;
Greg Kroah-Hartman
maintainerPATCH 582/600 usb: typec: bus: verify partner exists in typec_altmode_attention
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: RD Babiera <[email protected]>
commit f23643306430f86e2f413ee2b986e0773e79da31 upstream.
Some usb hubs will negotiate DisplayPort Alt mode with the device but will then negotiate a data role swap after entering the alt mode. The data role swap causes the device to unregister all alt modes, however the usb hub will still send Attention messages even after failing to reregister the Alt Mode. type_altmode_attention currently does not verify whether or not a device's altmode partner exists, which results in a NULL pointer error when dereferencing the typec_altmode and typec_altmode_ops belonging to the altmode partner.
Verify the presence of a device's altmode partner before sending the Attention message to the Alt Mode driver.
--- drivers/usb/typec/bus.c | 12 ++++++++++-- drivers/usb/typec/tcpm/tcpm.c | 3 ++- include/linux/usb/typec_altmode.h | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-)
drivers/usb/typec/bus.c +10 -2
@@ -154,12 +154,20 @@ EXPORT_SYMBOL_GPL(typec_altmode_exit);* * Notifies the partner of @adev about Attention command. */ -void typec_altmode_attention (struct typec_altmode *adev,u32 vdo) +int typec_altmode_attention (struct typec_altmode *adev,u32 vdo) { -struct typec_altmode *pdev = &to_altmode (adev)->partner->adev; +struct altmode *partner =to_altmode (adev)->partner; +struct typec_altmode *pdev; + +if (!partner) +return -ENODEV ; + + pdev = &partner->adev;if (pdev->ops && pdev->ops->attention) pdev->ops->attention (pdev, vdo); + +return 0 ; }EXPORT_SYMBOL_GPL (typec_altmode_attention);
drivers/usb/typec/tcpm/tcpm.c +2 -1
@@ -1871,7 +1871,8 @@ static void tcpm_handle_vdm_request(stru }break ;case ADEV_ATTENTION : -typec_altmode_attention (adev, p[1 ]); +if (typec_altmode_attention (adev, p[1 ])) +tcpm_log (port,"typec_altmode_attention no port partner altmode" );break ; } }
include/linux/usb/typec_altmode.h +1 -1
@@ -67,7 +67,7 @@ struct typec_altmode_ops {int typec_altmode_enter (struct typec_altmode *altmode,u32 *vdo);int typec_altmode_exit (struct typec_altmode *altmode); -void typec_altmode_attention (struct typec_altmode *altmode,u32 vdo); +int typec_altmode_attention (struct typec_altmode *altmode,u32 vdo);int typec_altmode_vdm (struct typec_altmode *altmode,const u32 header,const u32 *vdo,int count); int typec_altmode_notify(struct typec_altmode *altmode, unsigned long conf,
Greg Kroah-Hartman
maintainerPATCH 583/600 USB: core: Unite old scheme and new scheme descriptor reads
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 85d07c55621676d47d873d2749b88f783cd4d5a1 upstream.
In preparation for reworking the usb_get_device_descriptor() routine, it is desirable to unite the two different code paths responsible for initially determining endpoint 0's maximum packet size in a newly discovered USB device. Making this determination presents a chicken-and-egg sort of problem, in that the only way to learn the maxpacket value is to get it from the device descriptor retrieved from the device, but communicating with the device to retrieve a descriptor requires us to know beforehand the ep0 maxpacket size.
In practice this problem is solved in two different ways, referred to in hub.c as the "old scheme" and the "new scheme". The old scheme (which is the approach recommended by the USB-2 spec) involves asking the device to send just the first eight bytes of its device descriptor. Such a transfer uses packets containing no more than eight bytes each, and every USB device must have an ep0 maxpacket size
Quoted 1 line
= 8, so this should succeed. Since the bMaxPacketSize0 field of the
device descriptor lies within the first eight bytes, this is all we need.
The new scheme is an imitation of the technique used in an early Windows USB implementation, giving it the happy advantage of working with a wide variety of devices (some of them at the time would not work with the old scheme, although that's probably less true now). It involves making an initial guess of the ep0 maxpacket size, asking the device to send up to 64 bytes worth of its device descriptor (which is only 18 bytes long), and then resetting the device to clear any error condition that might have resulted from the guess being wrong. The initial guess is determined by the connection speed; it should be correct in all cases other than full speed, for which the allowed values are 8, 16, 32, and 64 (in this case the initial guess is 64).
The reason for this patch is that the old- and new-scheme parts of hub_port_init() use different code paths, one involving usb_get_device_descriptor() and one not, for their initial reads of the device descriptor. Since these reads have essentially the same purpose and are made under essentially the same circumstances, this is illogical. It makes more sense to have both of them use a common subroutine.
This subroutine does basically what the new scheme's code did, because that approach is more general than the one used by the old scheme. It only needs to know how many bytes to transfer and whether or not it is being called for the first iteration of a retry loop (in case of certain time-out errors). There are two main differences from the former code:
We initialize the bDescriptorType field of the transfer buffer to 0 before performing the transfer, to avoid possibly accessing an uninitialized value afterward.
We read the device descriptor into a temporary buffer rather than storing it directly into udev->descriptor, which the old scheme implementation used to do.
Since the whole point of this first read of the device descriptor is to determine the bMaxPacketSize0 value, that is what the new routine returns (or an error code). The value is stored in a local variable rather than in udev->descriptor. As a side effect, this necessitates moving a section of code that checks the bcdUSB field for SuperSpeed devices until after the full device descriptor has been retrieved.
--- drivers/usb/core/hub.c | 173 ++++++++++++++++++++++++++----------------------- 1 file changed, 94 insertions(+), 79 deletions(-)
drivers/usb/core/hub.c +94 -79
@@ -4661,6 +4661,67 @@ static int hub_enable_device(struct usb_return hcd->driver->enable_device (hcd, udev); } +/* +* Get the bMaxPacketSize0 value during initialization by reading the +* device's device descriptor. Since we don't already know this value, +* the transfer is unsafe and it ignores I/O errors, only testing for +* reasonable received values. +* +* For "old scheme" initialization, size will be 8 so we read just the +* start of the device descriptor, which should work okay regardless of +* the actual bMaxPacketSize0 value. For "new scheme" initialization, +* size will be 64 (and buf will point to a sufficiently large buffer), +* which might not be kosher according to the USB spec but it's what +* Windows does and what many devices expect. +* +* Returns: bMaxPacketSize0 or a negative error code. +*/ +static int get_bMaxPacketSize0 (struct usb_device *udev, +struct usb_device_descriptor *buf,int size,bool first_time) +{ +int i, rc; + +/* +* Retry on all errors; some devices are flakey. +* 255 is for WUSB devices, we actually need to use +* 512 (WUSB1.0[4.8.1]). +*/ +for (i =0 ; i <GET_MAXPACKET0_TRIES ; ++i) { +/* Start with invalid values in case the transfer fails */ + buf->bDescriptorType = buf->bMaxPacketSize0 =0 ; + rc =usb_control_msg (udev,usb_rcvaddr0pipe (), +USB_REQ_GET_DESCRIPTOR ,USB_DIR_IN , +USB_DT_DEVICE <<8 ,0 , + buf, size, + initial_descriptor_timeout); +switch (buf->bMaxPacketSize0) { +case 8 :case 16 :case 32 :case 64 :case 255 : +if (buf->bDescriptorType ==USB_DT_DEVICE ) { + rc = buf->bMaxPacketSize0; +break ; + } + fallthrough; +default : +if (rc >=0 ) + rc = -EPROTO ; +break ; + } + +/* +* Some devices time out if they are powered on +* when already connected. They need a second +* reset, so return early. But only on the first +* attempt, lest we get into a time-out/reset loop. +*/ +if (rc >0 || (rc == -ETIMEDOUT && first_time && + udev->speed >USB_SPEED_FULL )) +break ; + } +return rc; +} + +#define GET_DESCRIPTOR_BUFSIZE 64 +/* Reset device, (re)assign address, get device descriptor. * Device connection must be stable, no more debouncing needed. * Returns device in USB_STATE_ADDRESS, except on error.
@@ -4685,6 +4746,12 @@ hub_port_init(struct usb_hub *hub, strucint devnum = udev->devnum;const char *driver_name;bool do_new_scheme; +int maxp0; +struct usb_device_descriptor *buf; + + buf =kmalloc (GET_DESCRIPTOR_BUFSIZE ,GFP_NOIO ); +if (!buf) +return -ENOMEM ;/* root hub ports have a slightly longer reset period * (from USB 2.0 spec, section 7.1.7.5)
@@ -4799,9 +4866,6 @@ hub_port_init(struct usb_hub *hub, strucfor (retries =0 ; retries <GET_DESCRIPTOR_TRIES ; (++retries,msleep (100 ))) {if (do_new_scheme) { -struct usb_device_descriptor *buf; -int r =0 ; - retval =hub_enable_device (udev);if (retval <0 ) { dev_err(&udev->dev,
@@ -4810,52 +4874,8 @@ hub_port_init(struct usb_hub *hub, struc goto fail; } -#define GET_DESCRIPTOR_BUFSIZE 64 - buf =kmalloc (GET_DESCRIPTOR_BUFSIZE ,GFP_NOIO ); -if (!buf) { - retval = -ENOMEM ; -continue ; - } - -/* Retry on all errors; some devices are flakey. -* 255 is for WUSB devices, we actually need to use -* 512 (WUSB1.0[4.8.1]). -*/ -for (operations =0 ; operations <GET_MAXPACKET0_TRIES ; - ++operations) { - buf->bMaxPacketSize0 =0 ; - r =usb_control_msg (udev,usb_rcvaddr0pipe (), -USB_REQ_GET_DESCRIPTOR ,USB_DIR_IN , -USB_DT_DEVICE <<8 ,0 , - buf,GET_DESCRIPTOR_BUFSIZE , - initial_descriptor_timeout); -switch (buf->bMaxPacketSize0) { -case 8 :case 16 :case 32 :case 64 :case 255 : -if (buf->bDescriptorType == -USB_DT_DEVICE ) { - r =0 ; -break ; - } - fallthrough; -default : -if (r ==0 ) - r = -EPROTO ; -break ; - } -/* -* Some devices time out if they are powered on -* when already connected. They need a second -* reset. But only on the first attempt, -* lest we get into a time out/reset loop -*/ -if (r ==0 || (r == -ETIMEDOUT && - retries ==0 && - udev->speed >USB_SPEED_FULL )) -break ; - } - udev->descriptor.bMaxPacketSize0 = - buf->bMaxPacketSize0; -kfree (buf); + maxp0 =get_bMaxPacketSize0 (udev, buf, +GET_DESCRIPTOR_BUFSIZE , retries ==0 ); retval =hub_port_reset (hub, port1, udev, delay, false);if (retval <0 )/* error or disconnect */
@@ -4866,14 +4886,13 @@ hub_port_init(struct usb_hub *hub, struc retval = -ENODEV ; goto fail; } -if (r) { -if (r != -ENODEV ) +if (maxp0 <0 ) { +if (maxp0 != -ENODEV )dev_err (&udev->dev,"device descriptor read/64, error %d\n" , - r); - retval = -EMSGSIZE ; + maxp0); + retval = maxp0;continue ; } -#undef GET_DESCRIPTOR_BUFSIZE }/*
@@ -4919,19 +4938,17 @@ hub_port_init(struct usb_hub *hub, strucbreak ; } - retval =usb_get_device_descriptor (udev,8 ); -if (retval <8 ) { +/* !do_new_scheme || wusb */ + maxp0 =get_bMaxPacketSize0 (udev, buf,8 , retries ==0 ); +if (maxp0 <0 ) { + retval = maxp0;if (retval != -ENODEV )dev_err (&udev->dev,"device descriptor read/8, error %d\n" , retval); -if (retval >=0 ) - retval = -EMSGSIZE ; }else {u32 delay; - retval =0 ; - delay = udev->parent->hub_delay; udev->hub_delay =min_t (u32, delay,USB_TP_TRANSMISSION_DELAY_MAX );
@@ -4948,27 +4965,10 @@ hub_port_init(struct usb_hub *hub, strucif (retval) goto fail; -/* -* Some superspeed devices have finished the link training process -* and attached to a superspeed hub port, but the device descriptor -* got from those devices show they aren't superspeed devices. Warm -* reset the port attached by the devices can fix them. -*/ -if ((udev->speed >=USB_SPEED_SUPER ) && - (le16_to_cpu (udev->descriptor.bcdUSB) <0x0300 )) { -dev_err (&udev->dev,"got a wrong device descriptor, " -"warm reset device\n" ); -hub_port_reset (hub, port1, udev, -HUB_BH_RESET_TIME , true); - retval = -EINVAL ; - goto fail; - } - -if (udev->descriptor.bMaxPacketSize0 ==0xff || - udev->speed >=USB_SPEED_SUPER ) +if (maxp0 ==0xff || udev->speed >=USB_SPEED_SUPER ) i =512 ;else - i = udev->descriptor.bMaxPacketSize0; + i = maxp0;if (usb_endpoint_maxp (&udev->ep0.desc) != i) {if (udev->speed ==USB_SPEED_LOW || !(i ==8 || i ==16 || i ==32 || i ==64 )) {
@@ -4994,6 +4994,20 @@ hub_port_init(struct usb_hub *hub, struc goto fail; } +/* +* Some superspeed devices have finished the link training process +* and attached to a superspeed hub port, but the device descriptor +* got from those devices show they aren't superspeed devices. Warm +* reset the port attached by the devices can fix them. +*/ +if ((udev->speed >=USB_SPEED_SUPER ) && + (le16_to_cpu (udev->descriptor.bcdUSB) <0x0300 )) { +dev_err (&udev->dev,"got a wrong device descriptor, warm reset device\n" ); +hub_port_reset (hub, port1, udev,HUB_BH_RESET_TIME , true); + retval = -EINVAL ; + goto fail; + } +usb_detect_quirks (udev);if (udev->wusb ==0 &&le16_to_cpu (udev->descriptor.bcdUSB) >=0x0201 ) {
@@ -5016,6 +5030,7 @@ fail:hub_port_disable (hub, port1,0 );update_devnum (udev, devnum);/* for disconnect processing */ } +kfree (buf);return retval; }
Greg Kroah-Hartman
maintainerPATCH 584/600 USB: core: Change usb_get_device_descriptor() API
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit de28e469da75359a2bb8cd8778b78aa64b1be1f4 upstream.
The usb_get_device_descriptor() routine reads the device descriptor from the udev device and stores it directly in udev->descriptor. This interface is error prone, because the USB subsystem expects in-memory copies of a device's descriptors to be immutable once the device has been initialized.
The interface is changed so that the device descriptor is left in a kmalloc-ed buffer, not copied into the usb_device structure. A pointer to the buffer is returned to the caller, who is then responsible for kfree-ing it. The corresponding changes needed in the various callers are fairly small.
--- drivers/usb/core/hcd.c | 10 +++++++--- drivers/usb/core/hub.c | 44 +++++++++++++++++++++++--------------------- drivers/usb/core/message.c | 29 ++++++++++++----------------- drivers/usb/core/usb.h | 4 ++-- 4 files changed, 44 insertions(+), 43 deletions(-)
drivers/usb/core/hcd.c +7 -3
@@ -983,6 +983,7 @@ static int register_root_hub(struct usb_ {struct device *parent_dev = hcd->self.controller;struct usb_device *usb_dev = hcd->self.root_hub; +struct usb_device_descriptor *descr;const int devnum =1 ;int retval;
@@ -994,13 +995,16 @@ static int register_root_hub(struct usb_mutex_lock (&usb_bus_idr_lock); usb_dev->ep0.desc.wMaxPacketSize =cpu_to_le16 (64 ); - retval =usb_get_device_descriptor (usb_dev,USB_DT_DEVICE_SIZE ); -if (retval !=sizeof usb_dev->descriptor) { + descr =usb_get_device_descriptor (usb_dev); +if (IS_ERR (descr)) { + retval =PTR_ERR (descr);mutex_unlock (&usb_bus_idr_lock);dev_dbg (parent_dev,"can't read %s device descriptor %d\n" ,dev_name (&usb_dev->dev), retval); -return (retval <0 ) ? retval : -EMSGSIZE ; +return retval; } + usb_dev->descriptor = *descr; +kfree (descr);if (le16_to_cpu (usb_dev->descriptor.bcdUSB) >=0x0201 ) { retval =usb_get_bos_descriptor (usb_dev);
drivers/usb/core/hub.c +23 -21
104 lines not on this page · raw message
drivers/usb/core/message.c +12 -17
@@ -1039,40 +1039,35 @@ char *usb_cache_string(struct usb_device }/* -* usb_get_device_descriptor - (re)reads the device descriptor (usbcore) -* @dev: the device whose device descriptor is being updated -* @size: how much of the descriptor to read +* usb_get_device_descriptor - read the device descriptor +* @udev: the device whose device descriptor should be read * * Context: task context, might sleep. * -* Updates the copy of the device descriptor stored in the device structure, -* which dedicates space for this purpose. -* * Not exported, only for use by the core. If drivers really want to read * the device descriptor directly, they can call usb_get_descriptor() with * type = USB_DT_DEVICE and index = 0. * -* This call is synchronous, and may not be used in an interrupt context. -* -* Return: The number of bytes received on success, or else the status code -* returned by the underlying usb_control_msg() call. +* Returns: a pointer to a dynamically allocated usb_device_descriptor +* structure (which the caller must deallocate), or an ERR_PTR value. */ -int usb_get_device_descriptor (struct usb_device *dev,unsigned int size) +struct usb_device_descriptor *usb_get_device_descriptor (struct usb_device *udev) {struct usb_device_descriptor *desc;int ret; -if (size >sizeof (*desc)) -return -EINVAL ; desc =kmalloc (sizeof (*desc),GFP_NOIO );if (!desc) -return -ENOMEM ; +return ERR_PTR (-ENOMEM ); + + ret =usb_get_descriptor (udev,USB_DT_DEVICE ,0 , desc,sizeof (*desc)); +if (ret ==sizeof (*desc)) +return desc; - ret =usb_get_descriptor (dev,USB_DT_DEVICE ,0 , desc, size);if (ret >=0 ) -memcpy (&dev->descriptor, desc, size); + ret = -EMSGSIZE ;kfree (desc); -return ret; +return ERR_PTR (ret); }/*
drivers/usb/core/usb.h +2 -2
@@ -42,8 +42,8 @@ extern bool usb_endpoint_is_ignored(stru struct usb_endpoint_descriptor *epd);extern int usb_remove_device (struct usb_device *udev); -extern int usb_get_device_descriptor (struct usb_device *dev, -unsigned int size); +extern struct usb_device_descriptor *usb_get_device_descriptor ( +struct usb_device *udev);extern int usb_set_isoch_delay (struct usb_device *dev);extern int usb_get_bos_descriptor (struct usb_device *dev);extern void usb_release_bos_descriptor (struct usb_device *dev);
Greg Kroah-Hartman
maintainerPATCH 585/600 USB: core: Fix race by not overwriting udev->descriptor in hub_port_init()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit ff33299ec8bb80cdcc073ad9c506bd79bb2ed20b upstream.
Syzbot reported an out-of-bounds read in sysfs.c:read_descriptors():
BUG: KASAN: slab-out-of-bounds in read_descriptors+0x263/0x280 drivers/usb/core/sysfs.c:883 Read of size 8 at addr ffff88801e78b8c8 by task udevd/5011 CPU: 0 PID: 5011 Comm: udevd Not tainted 6.4.0-rc6-syzkaller-00195-g40f71e7cd3c6 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351 print_report mm/kasan/report.c:462 [inline] kasan_report+0x11c/0x130 mm/kasan/report.c:572 read_descriptors+0x263/0x280 drivers/usb/core/sysfs.c:883 ... Allocated by task 758: ... __do_kmalloc_node mm/slab_common.c:966 [inline] __kmalloc+0x5e/0x190 mm/slab_common.c:979 kmalloc include/linux/slab.h:563 [inline] kzalloc include/linux/slab.h:680 [inline] usb_get_configuration+0x1f7/0x5170 drivers/usb/core/config.c:887 usb_enumerate_device drivers/usb/core/hub.c:2407 [inline] usb_new_device+0x12b0/0x19d0 drivers/usb/core/hub.c:2545
As analyzed by Khazhy Kumykov, the cause of this bug is a race between read_descriptors() and hub_port_init(): The first routine uses a field in udev->descriptor, not expecting it to change, while the second overwrites it.
Prior to commit 45bf39f8df7f ("USB: core: Don't hold device lock while reading the "descriptors" sysfs file") this race couldn't occur, because the routines were mutually exclusive thanks to the device locking. Removing that locking from read_descriptors() exposed it to the race.
The best way to fix the bug is to keep hub_port_init() from changing udev->descriptor once udev has been initialized and registered. Drivers expect the descriptors stored in the kernel to be immutable; we should not undermine this expectation. In fact, this change should have been made long ago.
So now hub_port_init() will take an additional argument, specifying a buffer in which to store the device descriptor it reads. (If udev has not yet been initialized, the buffer pointer will be NULL and then hub_port_init() will store the device descriptor in udev as before.) This eliminates the data race responsible for the out-of-bounds read.
The changes to hub_port_init() appear more extensive than they really are, because of indentation changes resulting from an attempt to avoid writing to other parts of the usb_device structure after it has been initialized. Similar changes should be made to the code that reads the BOS descriptor, but that can be handled in a separate patch later on. This patch is sufficient to fix the bug found by syzbot.
--- drivers/usb/core/hub.c | 114 ++++++++++++++++++++++++++++++------------------- 1 file changed, 70 insertions(+), 44 deletions(-)
drivers/usb/core/hub.c +70 -44
@@ -4736,10 +4736,17 @@ static int get_bMaxPacketSize0(struct us* the port lock. For a newly detected device that is not accessible * through any global pointers, it's not necessary to lock the device, * but it is still necessary to lock the port. +* +* For a newly detected device, @dev_descr must be NULL. The device +* descriptor retrieved from the device will then be stored in +* @udev->descriptor. For an already existing device, @dev_descr +* must be non-NULL. The device descriptor will be stored there, +* not in @udev->descriptor, because descriptors for registered +* devices are meant to be immutable. */ static int hub_port_init (struct usb_hub *hub,struct usb_device *udev,int port1, -int retry_counter) +int retry_counter,struct usb_device_descriptor *dev_descr) {struct usb_device *hdev = hub->hdev;struct usb_hcd *hcd =bus_to_hcd (hdev->bus);
@@ -4751,6 +4758,7 @@ hub_port_init(struct usb_hub *hub, strucint devnum = udev->devnum;const char *driver_name;bool do_new_scheme; +const bool initial = !dev_descr;int maxp0;struct usb_device_descriptor *buf, *descr;
@@ -4789,32 +4797,34 @@ hub_port_init(struct usb_hub *hub, struc } oldspeed = udev->speed; -/* USB 2.0 section 5.5.3 talks about ep0 maxpacket ... -* it's fixed size except for full speed devices. -* For Wireless USB devices, ep0 max packet is always 512 (tho -* reported as 0xff in the device descriptor). WUSB1.0[4.8.1]. -*/ -switch (udev->speed) { -case USB_SPEED_SUPER_PLUS : -case USB_SPEED_SUPER : -case USB_SPEED_WIRELESS :/* fixed at 512 */ - udev->ep0.desc.wMaxPacketSize =cpu_to_le16 (512 ); -break ; -case USB_SPEED_HIGH :/* fixed at 64 */ - udev->ep0.desc.wMaxPacketSize =cpu_to_le16 (64 ); -break ; -case USB_SPEED_FULL :/* 8, 16, 32, or 64 */ -/* to determine the ep0 maxpacket size, try to read -* the device descriptor to get bMaxPacketSize0 and -* then correct our initial guess. +if (initial) { +/* USB 2.0 section 5.5.3 talks about ep0 maxpacket ... +* it's fixed size except for full speed devices. +* For Wireless USB devices, ep0 max packet is always 512 (tho +* reported as 0xff in the device descriptor). WUSB1.0[4.8.1]. */ - udev->ep0.desc.wMaxPacketSize =cpu_to_le16 (64 ); -break ; -case USB_SPEED_LOW :/* fixed at 8 */ - udev->ep0.desc.wMaxPacketSize =cpu_to_le16 (8 ); -break ; -default : - goto fail; +switch (udev->speed) { +case USB_SPEED_SUPER_PLUS : +case USB_SPEED_SUPER : +case USB_SPEED_WIRELESS :/* fixed at 512 */ + udev->ep0.desc.wMaxPacketSize =cpu_to_le16 (512 ); +break ; +case USB_SPEED_HIGH :/* fixed at 64 */ + udev->ep0.desc.wMaxPacketSize =cpu_to_le16 (64 ); +break ; +case USB_SPEED_FULL :/* 8, 16, 32, or 64 */ +/* to determine the ep0 maxpacket size, try to read +* the device descriptor to get bMaxPacketSize0 and +* then correct our initial guess. +*/ + udev->ep0.desc.wMaxPacketSize =cpu_to_le16 (64 ); +break ; +case USB_SPEED_LOW :/* fixed at 8 */ + udev->ep0.desc.wMaxPacketSize =cpu_to_le16 (8 ); +break ; +default : + goto fail; + } }if (udev->speed ==USB_SPEED_WIRELESS )
@@ -4837,22 +4847,24 @@ hub_port_init(struct usb_hub *hub, strucif (udev->speed <USB_SPEED_SUPER )dev_info (&udev->dev,"%s %s USB device number %d using %s\n" , - (udev->config) ?"reset" :"new" , speed, + (initial ?"new" :"reset" ), speed, devnum, driver_name); -/* Set up TT records, if needed */ -if (hdev->tt) { - udev->tt = hdev->tt; - udev->ttport = hdev->ttport; - }else if (udev->speed !=USB_SPEED_HIGH - && hdev->speed ==USB_SPEED_HIGH ) { -if (!hub->tt.hub) { -dev_err (&udev->dev,"parent hub has no TT\n" ); - retval = -EINVAL ; - goto fail; +if (initial) { +/* Set up TT records, if needed */ +if (hdev->tt) { + udev->tt = hdev->tt; + udev->ttport = hdev->ttport; + }else if (udev->speed !=USB_SPEED_HIGH + && hdev->speed ==USB_SPEED_HIGH ) { +if (!hub->tt.hub) { +dev_err (&udev->dev,"parent hub has no TT\n" ); + retval = -EINVAL ; + goto fail; + } + udev->tt = &hub->tt; + udev->ttport = port1; } - udev->tt = &hub->tt; - udev->ttport = port1; }/* Why interleave GET_DESCRIPTOR and SET_ADDRESS this way?
@@ -4881,6 +4893,12 @@ hub_port_init(struct usb_hub *hub, struc maxp0 =get_bMaxPacketSize0 (udev, buf,GET_DESCRIPTOR_BUFSIZE , retries ==0 ); +if (maxp0 >0 && !initial && + maxp0 != udev->descriptor.bMaxPacketSize0) { +dev_err (&udev->dev,"device reset changed ep0 maxpacket size!\n" ); + retval = -ENODEV ; + goto fail; + } retval =hub_port_reset (hub, port1, udev, delay, false);if (retval <0 )/* error or disconnect */
@@ -4954,6 +4972,12 @@ hub_port_init(struct usb_hub *hub, struc }else {u32 delay; +if (!initial && maxp0 != udev->descriptor.bMaxPacketSize0) { +dev_err (&udev->dev,"device reset changed ep0 maxpacket size!\n" ); + retval = -ENODEV ; + goto fail; + } + delay = udev->parent->hub_delay; udev->hub_delay =min_t (u32, delay,USB_TP_TRANSMISSION_DELAY_MAX );
@@ -4997,7 +5021,10 @@ hub_port_init(struct usb_hub *hub, struc retval); goto fail; } - udev->descriptor = *descr; +if (initial) + udev->descriptor = *descr; +else + *dev_descr = *descr;kfree (descr);/*
@@ -5302,7 +5329,7 @@ static void hub_port_connect(struct usb_ }/* reset (non-USB 3.0 devices) and get descriptor */ - status =hub_port_init (hub, udev, port1, i); + status =hub_port_init (hub, udev, port1, i,NULL );if (status <0 ) goto loop;
@@ -5928,7 +5955,7 @@ static int usb_reset_and_verify_device(sstruct usb_device *parent_hdev = udev->parent;struct usb_hub *parent_hub;struct usb_hcd *hcd =bus_to_hcd (udev->bus); -struct usb_device_descriptor descriptor = udev->descriptor; +struct usb_device_descriptor descriptor;struct usb_host_bos *bos;int i, j, ret =0 ;int port1 = udev->portnum;
@@ -5960,7 +5987,7 @@ static int usb_reset_and_verify_device(s/* ep0 maxpacket size may change; let the HCD know about it. * Other endpoints will be handled by re-enumeration. */ usb_ep0_reinit (udev); - ret =hub_port_init (parent_hub, udev, port1, i); + ret =hub_port_init (parent_hub, udev, port1, i, &descriptor);if (ret >=0 || ret == -ENOTCONN || ret == -ENODEV )break ; }
@@ -5972,7 +5999,6 @@ static int usb_reset_and_verify_device(s/* Device might have changed firmware (DFU or similar) */ if (descriptors_changed (udev, &descriptor, bos)) {dev_info (&udev->dev,"device firmware changed\n" ); - udev->descriptor = descriptor;/* for disconnect() calls */ goto re_enumerate; }
Greg Kroah-Hartman
maintainerPATCH 586/600 USB: core: Fix oversight in SuperSpeed initialization
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 59cf445754566984fd55af19ba7146c76e6627bc upstream.
Commit 85d07c556216 ("USB: core: Unite old scheme and new scheme descriptor reads") altered the way USB devices are enumerated following detection, and in the process it messed up the initialization of SuperSpeed (or faster) devices:
[ 31.650759] usb 2-1: new SuperSpeed Plus Gen 2x1 USB device number 2 using xhci_hcd [ 31.663107] usb 2-1: device descriptor read/8, error -71 [ 31.952697] usb 2-1: new SuperSpeed Plus Gen 2x1 USB device number 3 using xhci_hcd [ 31.965122] usb 2-1: device descriptor read/8, error -71 [ 32.080991] usb usb2-port1: attempt power cycle
...
The problem was caused by the commit forgetting that in SuperSpeed or faster devices, the device descriptor uses a logarithmic encoding of the bMaxPacketSize0 value. (For some reason I thought the 255 case in the switch statement was meant for these devices, but it isn't -- it was meant for Wireless USB and is no longer needed.)
We can fix the oversight by testing for buf->bMaxPacketSize0 = 9 (meaning 512, the actual maxpacket size for ep0 on all SuperSpeed devices) and straightening out the logic that checks and adjusts our initial guesses of the maxpacket value.
--- drivers/usb/core/hub.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-)
drivers/usb/core/hub.c +24 -12
@@ -4700,7 +4700,7 @@ static int get_bMaxPacketSize0(struct us buf, size, initial_descriptor_timeout);switch (buf->bMaxPacketSize0) { -case 8 :case 16 :case 32 :case 64 :case 255 : +case 8 :case 16 :case 32 :case 64 :case 9 :if (buf->bDescriptorType ==USB_DT_DEVICE ) { rc = buf->bMaxPacketSize0;break ;
@@ -4994,23 +4994,35 @@ hub_port_init(struct usb_hub *hub, strucif (retval) goto fail; -if (maxp0 ==0xff || udev->speed >=USB_SPEED_SUPER ) - i =512 ; -else - i = maxp0; -if (usb_endpoint_maxp (&udev->ep0.desc) != i) { -if (udev->speed ==USB_SPEED_LOW || - !(i ==8 || i ==16 || i ==32 || i ==64 )) { -dev_err (&udev->dev,"Invalid ep0 maxpacket: %d\n" , i); - retval = -EMSGSIZE ; - goto fail; - } +/* +* Check the ep0 maxpacket guess and correct it if necessary. +* maxp0 is the value stored in the device descriptor; +* i is the value it encodes (logarithmic for SuperSpeed or greater). +*/ + i = maxp0; +if (udev->speed >=USB_SPEED_SUPER ) { +if (maxp0 <=16 ) + i =1 << maxp0; +else + i =0 ;/* Invalid */ + } +if (usb_endpoint_maxp (&udev->ep0.desc) == i) { + ;/* Initial ep0 maxpacket guess is right */ + }else if ((udev->speed ==USB_SPEED_FULL || + udev->speed ==USB_SPEED_HIGH ) && + (i ==8 || i ==16 || i ==32 || i ==64 )) { +/* Initial guess is wrong; use the descriptor's value */ if (udev->speed ==USB_SPEED_FULL )dev_dbg (&udev->dev,"ep0 maxpacket = %d\n" , i);else dev_warn (&udev->dev,"Using ep0 maxpacket: %d\n" , i); udev->ep0.desc.wMaxPacketSize =cpu_to_le16 (i);usb_ep0_reinit (udev); + }else { +/* Initial guess is wrong and descriptor's value is invalid */ +dev_err (&udev->dev,"Invalid ep0 maxpacket: %d\n" , maxp0); + retval = -EMSGSIZE ; + goto fail; } descr =usb_get_device_descriptor (udev);
Greg Kroah-Hartman
maintainerPATCH 587/600 x86/sgx: Break up long non-preemptible delays in sgx_vepc_release()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Wang <[email protected]>
commit 3d7d72a34e05b23e21bafc8bfb861e73c86b31f3 upstream.
On large enclaves we hit the softlockup warning with following call trace:
xa_erase() sgx_vepc_release() __fput() task_work_run() do_exit()
The latency issue is similar to the one fixed in:
8795359e35bc ("x86/sgx: Silence softlockup detection when releasing large enclaves")
The test system has 64GB of enclave memory, and all is assigned to a single VM. Release of 'vepc' takes a longer time and causes long latencies, which triggers the softlockup warning.
Add cond_resched() to give other tasks a chance to run and reduce latencies, which also avoids the softlockup detector.
[ mingo: Rewrote the changelog. ]
--- arch/x86/kernel/cpu/sgx/virt.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/kernel/cpu/sgx/virt.c +3 -0
@@ -204,6 +204,7 @@ static int sgx_vepc_release(struct inodecontinue ;xa_erase (&vepc->page_array, index); +cond_resched (); }/*
@@ -222,6 +223,7 @@ static int sgx_vepc_release(struct inodelist_add_tail (&epc_page->list, &secs_pages);xa_erase (&vepc->page_array, index); +cond_resched (); }/*
@@ -243,6 +245,7 @@ static int sgx_vepc_release(struct inodeif (sgx_vepc_free_page (epc_page))list_add_tail (&epc_page->list, &secs_pages); +cond_resched (); }if (!list_empty (&secs_pages))
Greg Kroah-Hartman
maintainerPATCH 588/600 perf/x86/uncore: Correct the number of CHAs on EMR
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kan Liang <[email protected]>
commit 6f7f984fa85b305799076a1bcec941b9377587de upstream.
Starting from SPR, the basic uncore PMON information is retrieved from the discovery table (resides in an MMIO space populated by BIOS). It is called the discovery method. The existing value of the type->num_boxes is from the discovery table.
On some SPR variants, there is a firmware bug that makes the value from the discovery table incorrect. We use the value from the SPR_MSR_UNC_CBO_CONFIG MSR to replace the one from the discovery table:
38776cc45eb7 ("perf/x86/uncore: Correct the number of CHAs on SPR")
Unfortunately, the SPR_MSR_UNC_CBO_CONFIG isn't available for the EMR XCC (Always returns 0), but the above firmware bug doesn't impact the EMR XCC.
Don't let the value from the MSR replace the existing value from the discovery table.
--- arch/x86/events/intel/uncore_snbep.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
arch/x86/events/intel/uncore_snbep.c +11 -1
@@ -6078,8 +6078,18 @@ void spr_uncore_cpu_init(void) type =uncore_find_type_by_id (uncore_msr_uncores,UNCORE_SPR_CHA );if (type) { +/* +* The value from the discovery table (stored in the type->num_boxes +* of UNCORE_SPR_CHA) is incorrect on some SPR variants because of a +* firmware bug. Using the value from SPR_MSR_UNC_CBO_CONFIG to replace it. +*/ rdmsrl (SPR_MSR_UNC_CBO_CONFIG , num_cbo); - type->num_boxes = num_cbo; +/* +* The MSR doesn't work on the EMR XCC, but the firmware bug doesn't impact +* the EMR XCC. Don't let the value from the MSR replace the existing value. +*/ +if (num_cbo) + type->num_boxes = num_cbo; } spr_uncore_iio_free_running.num_boxes =uncore_type_max_boxes (uncore_msr_uncores,UNCORE_SPR_IIO ); }
Greg Kroah-Hartman
maintainerPATCH 589/600 serial: sc16is7xx: remove obsolete out_thread label
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugo Villeneuve <[email protected]>
[ Upstream commit dabc54a45711fe77674a6c0348231e00e66bd567 ]
Commit c8f71b49ee4d ("serial: sc16is7xx: setup GPIO controller later in probe") moved GPIO setup code later in probe function. Doing so also required to move ports cleanup code (out_ports label) after the GPIO cleanup code.
After these moves, the out_thread label becomes misplaced and makes part of the cleanup code illogical.
This patch remove the now obsolete out_thread label and make GPIO setup code jump to out_ports label if it fails.
Stable-dep-of: 049994292834 ("serial: sc16is7xx: fix regression with GPIO configuration")
--- drivers/tty/serial/sc16is7xx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/tty/serial/sc16is7xx.c +1 -3
@@ -1532,7 +1532,7 @@ static int sc16is7xx_probe(struct device *dev, s->gpio.can_sleep =1 ; ret =gpiochip_add_data (&s->gpio, s);if (ret) - goto out_thread; + goto out_ports; }#endif
@@ -1558,8 +1558,6 @@ static int sc16is7xx_probe(struct device *dev,#ifdef CONFIG_GPIOLIB if (devtype->nr_gpio)gpiochip_remove (&s->gpio); - -out_thread:#endif out_ports:
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 590/600 serial: sc16is7xx: fix regression with GPIO configuration
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugo Villeneuve <[email protected]>
[ Upstream commit 0499942928341d572a42199580433c2b0725211e ]
Commit 679875d1d880 ("sc16is7xx: Separate GPIOs from modem control lines") and commit 21144bab4f11 ("sc16is7xx: Handle modem status lines") changed the function of the GPIOs pins to act as modem control lines without any possibility of selecting GPIO function.
As a consequence, applications that depends on GPIO lines configured by default as GPIO pins no longer work as expected.
Also, the change to select modem control lines function was done only for channel A of dual UART variants (752/762). This was not documented in the log message.
Allow to specify GPIO or modem control line function in the device tree, and for each of the ports (A or B).
Do so by using the new device-tree property named "nxp,modem-control-line-ports" (property added in separate patch).
When registering GPIO chip controller, mask-out GPIO pins declared as modem control lines according to this new DT property.
--- drivers/tty/serial/sc16is7xx.c | 143 +++++++++++++++++++++++++-------- 1 file changed, 108 insertions(+), 35 deletions(-)
drivers/tty/serial/sc16is7xx.c +108 -35
@@ -236,7 +236,8 @@/* IOControl register bits (Only 750/760) */ #define SC16IS7XX_IOCONTROL_LATCH_BIT (1 << 0)/* Enable input latching */ -#define SC16IS7XX_IOCONTROL_MODEM_BIT (1 << 1)/* Enable GPIO[7:4] as modem pins */ +#define SC16IS7XX_IOCONTROL_MODEM_A_BIT (1 << 1)/* Enable GPIO[7:4] as modem A pins */ +#define SC16IS7XX_IOCONTROL_MODEM_B_BIT (1 << 2)/* Enable GPIO[3:0] as modem B pins */ #define SC16IS7XX_IOCONTROL_SRESET_BIT (1 << 3)/* Software Reset */ /* EFCR register bits */
@@ -301,12 +302,12 @@/* Misc definitions */ #define SC16IS7XX_FIFO_SIZE (64)#define SC16IS7XX_REG_SHIFT 2 +#define SC16IS7XX_GPIOS_PER_BANK 4struct sc16is7xx_devtype {char name[10 ];int nr_gpio;int nr_uart; -int has_mctrl; };#define SC16IS7XX_RECONF_MD (1 << 0)
@@ -336,7 +337,9 @@ struct sc16is7xx_port {struct clk *clk;#ifdef CONFIG_GPIOLIB struct gpio_chip gpio; +unsigned long gpio_valid_mask;#endif +u8 mctrl_mask;unsigned char buf[SC16IS7XX_FIFO_SIZE ];struct kthread_worker kworker;struct task_struct *kworker_task;
@@ -447,35 +450,30 @@ static const struct sc16is7xx_devtype sc16is74x_devtype = { .name = "SC16IS74X", .nr_gpio = 0, .nr_uart = 1, - .has_mctrl = 0, };static const struct sc16is7xx_devtype sc16is750_devtype = { .name ="SC16IS750" , - .nr_gpio =4 , + .nr_gpio =8 , .nr_uart =1 , - .has_mctrl =1 , };static const struct sc16is7xx_devtype sc16is752_devtype = { .name ="SC16IS752" , - .nr_gpio =0 , + .nr_gpio =8 , .nr_uart =2 , - .has_mctrl =1 , };static const struct sc16is7xx_devtype sc16is760_devtype = { .name ="SC16IS760" , - .nr_gpio =4 , + .nr_gpio =8 , .nr_uart =1 , - .has_mctrl =1 , };static const struct sc16is7xx_devtype sc16is762_devtype = { .name ="SC16IS762" , - .nr_gpio =0 , + .nr_gpio =8 , .nr_uart =2 , - .has_mctrl =1 , };static bool sc16is7xx_regmap_volatile (struct device *dev,unsigned int reg)
@@ -1360,8 +1358,98 @@ static int sc16is7xx_gpio_direction_output(struct gpio_chip *chip,return 0 ; } + +static int sc16is7xx_gpio_init_valid_mask (struct gpio_chip *chip, +unsigned long *valid_mask, +unsigned int ngpios) +{ +struct sc16is7xx_port *s =gpiochip_get_data (chip); + + *valid_mask = s->gpio_valid_mask; + +return 0 ; +} + +static int sc16is7xx_setup_gpio_chip (struct sc16is7xx_port *s) +{ +struct device *dev = s->p[0 ].port.dev; + +if (!s->devtype->nr_gpio) +return 0 ; + +switch (s->mctrl_mask) { +case 0 : + s->gpio_valid_mask =GENMASK (7 ,0 ); +break ; +case SC16IS7XX_IOCONTROL_MODEM_A_BIT : + s->gpio_valid_mask =GENMASK (3 ,0 ); +break ; +case SC16IS7XX_IOCONTROL_MODEM_B_BIT : + s->gpio_valid_mask =GENMASK (7 ,4 ); +break ; +default : +break ; + } + +if (s->gpio_valid_mask ==0 ) +return 0 ; + + s->gpio.owner =THIS_MODULE ; + s->gpio.parent = dev; + s->gpio.label =dev_name (dev); + s->gpio.init_valid_mask = sc16is7xx_gpio_init_valid_mask; + s->gpio.direction_input = sc16is7xx_gpio_direction_input; + s->gpio.get = sc16is7xx_gpio_get; + s->gpio.direction_output = sc16is7xx_gpio_direction_output; + s->gpio.set = sc16is7xx_gpio_set; + s->gpio.base =-1 ; + s->gpio.ngpio = s->devtype->nr_gpio; + s->gpio.can_sleep =1 ; + +return gpiochip_add_data (&s->gpio, s); +}#endif +/* +* Configure ports designated to operate as modem control lines. +*/ +static int sc16is7xx_setup_mctrl_ports (struct sc16is7xx_port *s) +{ +int i; +int ret; +int count; +u32 mctrl_port[2 ]; +struct device *dev = s->p[0 ].port.dev; + + count =device_property_count_u32 (dev,"nxp,modem-control-line-ports" ); +if (count <0 || count >ARRAY_SIZE (mctrl_port)) +return 0 ; + + ret =device_property_read_u32_array (dev,"nxp,modem-control-line-ports" , + mctrl_port, count); +if (ret) +return ret; + + s->mctrl_mask =0 ; + +for (i =0 ; i < count; i++) { +/* Use GPIO lines as modem control lines */ +if (mctrl_port[i] ==0 ) + s->mctrl_mask |=SC16IS7XX_IOCONTROL_MODEM_A_BIT ; +else if (mctrl_port[i] ==1 ) + s->mctrl_mask |=SC16IS7XX_IOCONTROL_MODEM_B_BIT ; + } + +if (s->mctrl_mask) +regmap_update_bits ( + s->regmap, +SC16IS7XX_IOCONTROL_REG <<SC16IS7XX_REG_SHIFT , +SC16IS7XX_IOCONTROL_MODEM_A_BIT | +SC16IS7XX_IOCONTROL_MODEM_B_BIT , s->mctrl_mask); + +return 0 ; +} +static const struct serial_rs485 sc16is7xx_rs485_supported = { .flags =SER_RS485_ENABLED |SER_RS485_RTS_AFTER_SEND , .delay_rts_before_send =1 ,
@@ -1474,12 +1562,6 @@ static int sc16is7xx_probe(struct device *dev,SC16IS7XX_EFCR_RXDISABLE_BIT | SC16IS7XX_EFCR_TXDISABLE_BIT); -/* Use GPIO lines as modem status registers */ -if (devtype->has_mctrl) -sc16is7xx_port_write (&s->p[i].port, -SC16IS7XX_IOCONTROL_REG , -SC16IS7XX_IOCONTROL_MODEM_BIT ); -/* Initialize kthread work structs */ kthread_init_work (&s->p[i].tx_work, sc16is7xx_tx_proc);kthread_init_work (&s->p[i].reg_work, sc16is7xx_reg_proc);
@@ -1517,23 +1599,14 @@ static int sc16is7xx_probe(struct device *dev, s->p[u].irda_mode = true; } + ret =sc16is7xx_setup_mctrl_ports (s); +if (ret) + goto out_ports; +#ifdef CONFIG_GPIOLIB -if (devtype->nr_gpio) { -/* Setup GPIO cotroller */ - s->gpio.owner =THIS_MODULE ; - s->gpio.parent = dev; - s->gpio.label =dev_name (dev); - s->gpio.direction_input = sc16is7xx_gpio_direction_input; - s->gpio.get = sc16is7xx_gpio_get; - s->gpio.direction_output = sc16is7xx_gpio_direction_output; - s->gpio.set = sc16is7xx_gpio_set; - s->gpio.base =-1 ; - s->gpio.ngpio = devtype->nr_gpio; - s->gpio.can_sleep =1 ; - ret =gpiochip_add_data (&s->gpio, s); -if (ret) - goto out_ports; - } + ret =sc16is7xx_setup_gpio_chip (s); +if (ret) + goto out_ports;#endif /*
@@ -1556,7 +1629,7 @@ static int sc16is7xx_probe(struct device *dev,return 0 ;#ifdef CONFIG_GPIOLIB -if (devtype->nr_gpio) +if (s->gpio_valid_mask)gpiochip_remove (&s->gpio);#endif
@@ -1580,7 +1653,7 @@ static void sc16is7xx_remove(struct device *dev)int i;#ifdef CONFIG_GPIOLIB -if (s->devtype->nr_gpio) +if (s->gpio_valid_mask)gpiochip_remove (&s->gpio);#endif
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 591/600 net: remove duplicate INDIRECT_CALLABLE_DECLARE of udp[6]_ehashfn
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenz Bauer <[email protected]>
commit 74bdfab4fd7c641e55f7fe9d1be9687eeb01df67 upstream.
There are already INDIRECT_CALLABLE_DECLARE in the hashtable headers, no need to declare them again.
--- net/ipv4/inet_hashtables.c | 2 -- net/ipv6/inet6_hashtables.c | 2 -- 2 files changed, 4 deletions(-)
net/ipv4/inet_hashtables.c +0 -2
@@ -333,8 +333,6 @@ static inline int compute_score(struct sreturn score; } -INDIRECT_CALLABLE_DECLARE(inet_ehashfn_t udp_ehashfn); - struct sock *inet_lookup_reuseport(struct net *net, struct sock *sk, struct sk_buff *skb, int doff, __be32 saddr, __be16 sport,
net/ipv6/inet6_hashtables.c +0 -2
@@ -112,8 +112,6 @@ static inline int compute_score(struct sreturn score; } -INDIRECT_CALLABLE_DECLARE(inet6_ehashfn_t udp6_ehashfn); - struct sock *inet6_lookup_reuseport(struct net *net, struct sock *sk, struct sk_buff *skb, int doff, const struct in6_addr *saddr,
Greg Kroah-Hartman
maintainerPATCH 592/600 tracing: Zero the pipe cpumask on alloc to avoid spurious -EBUSY
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Foster <[email protected]>
commit 3d07fa1dd19035eb0b13ae6697efd5caa9033e74 upstream.
The pipe cpumask used to serialize opens between the main and percpu trace pipes is not zeroed or initialized. This can result in spurious -EBUSY returns if underlying memory is not fully zeroed. This has been observed by immediate failure to read the main trace_pipe file on an otherwise newly booted and idle system:
# cat /sys/kernel/debug/tracing/trace_pipe cat: /sys/kernel/debug/tracing/trace_pipe: Device or resource busy
Zero the allocation of pipe_cpumask to avoid the problem.
--- kernel/trace/trace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace.c +2 -2
@@ -9395,7 +9395,7 @@ static struct trace_array *trace_array_cif (!alloc_cpumask_var (&tr->tracing_cpumask,GFP_KERNEL )) goto out_free_tr; -if (!alloc_cpumask_var (&tr->pipe_cpumask,GFP_KERNEL )) +if (!zalloc_cpumask_var (&tr->pipe_cpumask,GFP_KERNEL )) goto out_free_tr; tr->trace_flags = global_trace.trace_flags & ~ZEROED_TRACE_FLAGS ;
@@ -10267,7 +10267,7 @@ __init static int tracer_alloc_buffers(vif (trace_create_savedcmd () <0 ) goto out_free_temp_buffer; -if (!alloc_cpumask_var (&global_trace.pipe_cpumask,GFP_KERNEL )) +if (!zalloc_cpumask_var (&global_trace.pipe_cpumask,GFP_KERNEL )) goto out_free_savedcmd;/* TODO: make the number of buffers hot pluggable with CPUS */
Greg Kroah-Hartman
maintainerPATCH 593/600 Revert "drm/amd/display: Do not set drr on pipe commit"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michel Dänzer <[email protected]>
commit 360930985ec9f394c82ba0b235403b4a366d1560 upstream.
This reverts commit e101bf95ea87ccc03ac2f48dfc0757c6364ff3c7.
Caused a regression:
Samsung Odyssey Neo G9, running at 5120x1440@240/VRR, connected to Navi 21 via DisplayPort, blanks and the GPU hangs while starting the Steam game Assetto Corsa Competizione (via Proton 7.0).
Example dmesg excerpt:
amdgpu 0000:0c:00.0: [drm] ERROR [CRTC:82:crtc-0] flip_done timed out NMI watchdog: Watchdog detected hard LOCKUP on cpu 6
[...]
RIP: 0010:amdgpu_device_rreg.part.0+0x2f/0xf0 [amdgpu] Code: 41 54 44 8d 24 b5 00 00 00 00 55 89 f5 53 48 89 fb 4c 3b a7 60 0b 00 00 73 6a 83 e2 02 74 29 4c 03 a3 68 0b 00 00 45 8b 24 24 <48> 8b 43 08 0f b7 70 3e 66 90 44 89 e0 5b 5d 41 5c 31 d2 31 c9 31 RSP: 0000:ffffb39a119dfb88 EFLAGS: 00000086 RAX: ffffffffc0eb96a0 RBX: ffff9e7963dc0000 RCX: 0000000000007fff RDX: 0000000000000000 RSI: 0000000000004ff6 RDI: ffff9e7963dc0000 RBP: 0000000000004ff6 R08: ffffb39a119dfc40 R09: 0000000000000010 R10: ffffb39a119dfc40 R11: ffffb39a119dfc44 R12: 00000000000e05ae R13: 0000000000000000 R14: ffff9e7963dc0010 R15: 0000000000000000 FS: 000000001012f6c0(0000) GS:ffff9e805eb80000(0000) knlGS:000000007fd40000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000461ca000 CR3: 00000002a8a20000 CR4: 0000000000350ee0 Call Trace: <TASK> dm_read_reg_func+0x37/0xc0 [amdgpu] generic_reg_get2+0x22/0x60 [amdgpu] optc1_get_crtc_scanoutpos+0x6a/0xc0 [amdgpu] dc_stream_get_scanoutpos+0x74/0x90 [amdgpu] dm_crtc_get_scanoutpos+0x82/0xf0 [amdgpu] amdgpu_display_get_crtc_scanoutpos+0x91/0x190 [amdgpu] ? dm_read_reg_func+0x37/0xc0 [amdgpu] amdgpu_get_vblank_counter_kms+0xb4/0x1a0 [amdgpu] dm_pflip_high_irq+0x213/0x2f0 [amdgpu] amdgpu_dm_irq_handler+0x8a/0x200 [amdgpu] amdgpu_irq_dispatch+0xd4/0x220 [amdgpu] amdgpu_ih_process+0x7f/0x110 [amdgpu] amdgpu_irq_handler+0x1f/0x70 [amdgpu] __handle_irq_event_percpu+0x46/0x1b0 handle_irq_event+0x34/0x80 handle_edge_irq+0x9f/0x240 __common_interrupt+0x66/0x110 common_interrupt+0x5c/0xd0 asm_common_interrupt+0x22/0x40
--- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 6 ------ drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c | 7 ------- 2 files changed, 13 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +0 -6
@@ -2032,12 +2032,6 @@ void dcn20_optimize_bandwidth(if (hubbub->funcs->program_compbuf_size) hubbub->funcs->program_compbuf_size (hubbub, context->bw_ctx.bw.dcn.compbuf_size_kb, true); -if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) { -dc_dmub_srv_p_state_delegate (dc, - true, context); - context->bw_ctx.bw.dcn.clk.p_state_change_support = true; - } - dc->clk_mgr->funcs->update_clocks( dc->clk_mgr, context,
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +0 -7
@@ -987,18 +987,11 @@ void dcn30_set_disp_pattern_generator(covoid dcn30_prepare_bandwidth (struct dc *dc,struct dc_state *context) { -if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) { - dc->optimized_required = true; - context->bw_ctx.bw.dcn.clk.p_state_change_support = false; - } -if (dc->clk_mgr->dc_mode_softmax_enabled)if (dc->clk_mgr->clks.dramclk_khz <= dc->clk_mgr->bw_params->dc_mode_softmax_memclk *1000 && context->bw_ctx.bw.dcn.clk.dramclk_khz > dc->clk_mgr->bw_params->dc_mode_softmax_memclk *1000 ) dc->clk_mgr->funcs->set_max_memclk (dc->clk_mgr, dc->clk_mgr->bw_params->clk_table.entries[dc->clk_mgr->bw_params->clk_table.num_entries -1 ].memclk_mhz);dcn20_prepare_bandwidth (dc, context); - -dc_dmub_srv_p_state_delegate (dc, false, context); }
Greg Kroah-Hartman
maintainerPATCH 594/600 md: Free resources in __md_stop
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiao Ni <[email protected]>
commit 3e453522593d74a87cf68a38e14aa36ebca1dbcd upstream.
If md_run() fails after ->active_io is initialized, then percpu_ref_exit is called in error path. However, later md_free_disk will call percpu_ref_exit again which leads to a panic because of null pointer dereference. It can also trigger this bug when resources are initialized but are freed in error path, then will be freed again in md_free_disk.
BUG: kernel NULL pointer dereference, address: 0000000000000038 Oops: 0000 [#1] PREEMPT SMP Workqueue: md_misc mddev_delayed_delete RIP: 0010:free_percpu+0x110/0x630 Call Trace: <TASK> __percpu_ref_exit+0x44/0x70 percpu_ref_exit+0x16/0x90 md_free_disk+0x2f/0x80 disk_release+0x101/0x180 device_release+0x84/0x110 kobject_put+0x12a/0x380 kobject_put+0x160/0x380 mddev_delayed_delete+0x19/0x30 process_one_work+0x269/0x680 worker_thread+0x266/0x640 kthread+0x151/0x1b0 ret_from_fork+0x1f/0x30
For creating raid device, md raid calls do_md_run->md_run, dm raid calls md_run. We alloc those memory in md_run. For stopping raid device, md raid calls do_md_stop->__md_stop, dm raid calls md_stop->__md_stop. So we can free those memory resources in __md_stop.
--- drivers/md/md.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
drivers/md/md.c +5 -8
@@ -6277,6 +6277,11 @@ static void __md_stop(struct mddev *mdde mddev->to_remove = &md_redundancy_group;module_put (pers->owner);clear_bit (MD_RECOVERY_FROZEN , &mddev->recovery); + +percpu_ref_exit (&mddev->writes_pending); +percpu_ref_exit (&mddev->active_io); +bioset_exit (&mddev->bio_set); +bioset_exit (&mddev->sync_set); }void md_stop (struct mddev *mddev)
@@ -6288,9 +6293,6 @@ void md_stop(struct mddev *mddev)*/ __md_stop_writes (mddev);__md_stop (mddev); -percpu_ref_exit (&mddev->active_io); -bioset_exit (&mddev->bio_set); -bioset_exit (&mddev->sync_set); }EXPORT_SYMBOL_GPL (md_stop);
@@ -7857,11 +7859,6 @@ static void md_free_disk(struct gendisk {struct mddev *mddev = disk->private_data; -percpu_ref_exit (&mddev->writes_pending); -percpu_ref_exit (&mddev->active_io); -bioset_exit (&mddev->bio_set); -bioset_exit (&mddev->sync_set); -mddev_free (mddev); }
Greg Kroah-Hartman
maintainerPATCH 595/600 NFSv4.2: Fix a potential double free with READ_PLUS
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anna Schumaker <[email protected]>
commit 43439d858bbae244a510de47f9a55f667ca4ed52 upstream.
kfree()-ing the scratch page isn't enough, we also need to set the pointer back to NULL to avoid a double-free in the case of a resend.
--- fs/nfs/nfs4proc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +10 -2
@@ -5444,10 +5444,18 @@ static bool nfs4_read_plus_not_supportedreturn false; } -static int nfs4_read_done (struct rpc_task *task,struct nfs_pgio_header *hdr) +static inline void nfs4_read_plus_scratch_free (struct nfs_pgio_header *hdr) { -if (hdr->res.scratch) +if (hdr->res.scratch) {kfree (hdr->res.scratch); + hdr->res.scratch =NULL ; + } +} + +static int nfs4_read_done (struct rpc_task *task,struct nfs_pgio_header *hdr) +{ +nfs4_read_plus_scratch_free (hdr); +if (!nfs4_sequence_done (task, &hdr->res.seq_res))return -EAGAIN ;if (nfs4_read_stateid_changed (task, &hdr->args))
Greg Kroah-Hartman
maintainerPATCH 596/600 NFSv4.2: Rework scratch handling for READ_PLUS (again)
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anna Schumaker <[email protected]>
commit 303a78052091c81e9003915c521fdca1c7e117af upstream.
I found that the read code might send multiple requests using the same nfs_pgio_header, but nfs4_proc_read_setup() is only called once. This is how we ended up occasionally double-freeing the scratch buffer, but also means we set a NULL pointer but non-zero length to the xdr scratch buffer. This results in an oops the first time decoding needs to copy something to scratch, which frequently happens when decoding READ_PLUS hole segments.
I fix this by moving scratch handling into the pageio read code. I provide a function to allocate scratch space for decoding read replies, and free the scratch buffer when the nfs_pgio_header is freed.
--- fs/nfs/internal.h | 1 + fs/nfs/nfs42.h | 1 + fs/nfs/nfs42xdr.c | 2 +- fs/nfs/nfs4proc.c | 13 +------------ fs/nfs/read.c | 10 ++++++++++ 5 files changed, 14 insertions(+), 13 deletions(-)
fs/nfs/internal.h +1 -0
@@ -484,6 +484,7 @@ struct nfs_pgio_completion_ops;extern void nfs_pageio_init_read (struct nfs_pageio_descriptor *pgio,struct inode *inode,bool force_mds,const struct nfs_pgio_completion_ops *compl_ops); +extern bool nfs_read_alloc_scratch (struct nfs_pgio_header *hdr,size_t size);extern void nfs_read_prepare (struct rpc_task *task,void *calldata);extern void nfs_pageio_reset_read_mds (struct nfs_pageio_descriptor *pgio);
fs/nfs/nfs42.h +1 -0
@@ -13,6 +13,7 @@* more? Need to consider not to pre-alloc too much for a compound. */ #define PNFS_LAYOUTSTATS_MAXDEV (4) +#define READ_PLUS_SCRATCH_SIZE (16)/* nfs4.2proc.c */ #ifdef CONFIG_NFS_V4_2
fs/nfs/nfs42xdr.c +1 -1
@@ -1351,7 +1351,7 @@ static int nfs4_xdr_dec_read_plus(structstruct compound_hdr hdr;int status; -xdr_set_scratch_buffer (xdr, res->scratch,sizeof (res->scratch)); +xdr_set_scratch_buffer (xdr, res->scratch,READ_PLUS_SCRATCH_SIZE ); status =decode_compound_hdr (xdr, &hdr);if (status)
fs/nfs/nfs4proc.c +1 -12
@@ -5444,18 +5444,8 @@ static bool nfs4_read_plus_not_supportedreturn false; } -static inline void nfs4_read_plus_scratch_free (struct nfs_pgio_header *hdr) -{ -if (hdr->res.scratch) { -kfree (hdr->res.scratch); - hdr->res.scratch =NULL ; - } -} -static int nfs4_read_done (struct rpc_task *task,struct nfs_pgio_header *hdr) { -nfs4_read_plus_scratch_free (hdr); -if (!nfs4_sequence_done (task, &hdr->res.seq_res))return -EAGAIN ;if (nfs4_read_stateid_changed (task, &hdr->args))
@@ -5475,8 +5465,7 @@ static bool nfs42_read_plus_support(stru/* Note: We don't use READ_PLUS with pNFS yet */ if (nfs_server_capable (hdr->inode,NFS_CAP_READ_PLUS ) && !hdr->ds_clp) { msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ_PLUS ]; - hdr->res.scratch =kmalloc (32 ,GFP_KERNEL ); -return hdr->res.scratch !=NULL ; +return nfs_read_alloc_scratch (hdr,READ_PLUS_SCRATCH_SIZE ); }return false; }
fs/nfs/read.c +10 -0
@@ -47,6 +47,8 @@ static struct nfs_pgio_header *nfs_readhstatic void nfs_readhdr_free (struct nfs_pgio_header *rhdr) { +if (rhdr->res.scratch !=NULL ) +kfree (rhdr->res.scratch);kmem_cache_free (nfs_rdata_cachep, rhdr); }
@@ -109,6 +111,14 @@ void nfs_pageio_reset_read_mds(struct nf }EXPORT_SYMBOL_GPL (nfs_pageio_reset_read_mds); +bool nfs_read_alloc_scratch (struct nfs_pgio_header *hdr,size_t size) +{ +WARN_ON (hdr->res.scratch !=NULL ); + hdr->res.scratch =kmalloc (size,GFP_KERNEL ); +return hdr->res.scratch !=NULL ; +} +EXPORT_SYMBOL_GPL (nfs_read_alloc_scratch); +static void nfs_readpage_release (struct nfs_page *req,int error) {struct inode *inode =d_inode (nfs_req_openctx (req)->dentry);
Greg Kroah-Hartman
maintainerPATCH 597/600 md: fix regression for null-ptr-deference in __md_stop()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
commit 433279beba1d4872da10b7b60a539e0cb828b32b upstream.
Commit 3e453522593d ("md: Free resources in __md_stop") tried to fix null-ptr-deference for 'active_io' by moving percpu_ref_exit() to __md_stop(), however, the commit also moving 'writes_pending' to __md_stop(), and this will cause mdadm tests broken:
BUG: kernel NULL pointer dereference, address: 0000000000000038 Oops: 0000 [#1] PREEMPT SMP CPU: 15 PID: 17830 Comm: mdadm Not tainted 6.3.0-rc3-next-20230324-00009-g520d37 RIP: 0010:free_percpu+0x465/0x670 Call Trace: <TASK> __percpu_ref_exit+0x48/0x70 percpu_ref_exit+0x1a/0x90 __md_stop+0xe9/0x170 do_md_stop+0x1e1/0x7b0 md_ioctl+0x90c/0x1aa0 blkdev_ioctl+0x19b/0x400 vfs_ioctl+0x20/0x50 __x64_sys_ioctl+0xba/0xe0 do_syscall_64+0x6c/0xe0 entry_SYSCALL_64_after_hwframe+0x63/0xcd
And the problem can be reporduced 100% by following test:
mdadm -CR /dev/md0 -l1 -n1 /dev/sda --force
echo inactive > /sys/block/md0/md/array_state
echo read-auto > /sys/block/md0/md/array_state
echo inactive > /sys/block/md0/md/array_state
Root cause:
// start raidraid1_run
mddev_init_writes_pending
percpu_ref_init
// inactive raidarray_state_store
do_md_stop
__md_stop
percpu_ref_exit
// start raid againarray_state_store
do_md_run
raid1_run
mddev_init_writes_pending
if (mddev->writes_pending.percpu_count_ptr)
// won't reinit// inactive raid again
...percpu_ref_exit
-> null-ptr-deference
Before the commit, 'writes_pending' is exited when mddev is freed, and it's safe to restart raid because mddev_init_writes_pending() already make sure that 'writes_pending' will only be initialized once.
Fix the prblem by moving 'writes_pending' back, it's a litter hard to find the relationship between alloc memory and free memory, however, code changes is much less and we lived with this for a long time already.
--- drivers/md/md.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/md.c +2 -1
@@ -6278,7 +6278,6 @@ static void __md_stop(struct mddev *mddemodule_put (pers->owner);clear_bit (MD_RECOVERY_FROZEN , &mddev->recovery); -percpu_ref_exit (&mddev->writes_pending);percpu_ref_exit (&mddev->active_io);bioset_exit (&mddev->bio_set);bioset_exit (&mddev->sync_set);
@@ -6293,6 +6292,7 @@ void md_stop(struct mddev *mddev)*/ __md_stop_writes (mddev);__md_stop (mddev); +percpu_ref_exit (&mddev->writes_pending); }EXPORT_SYMBOL_GPL (md_stop);
@@ -7859,6 +7859,7 @@ static void md_free_disk(struct gendisk {struct mddev *mddev = disk->private_data; +percpu_ref_exit (&mddev->writes_pending);mddev_free (mddev); }
Greg Kroah-Hartman
maintainerPATCH 598/600 clk: Mark a fwnode as initialized when using CLK_OF_DECLARE() macro
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Saravana Kannan <[email protected]>
commit c28cd1f3433c7e339315d1ddacaeacf0fdfbe252 upstream.
We already mark fwnodes as initialized when they are registered as clock providers. We do this so that fw_devlink can tell when a clock driver doesn't use the driver core framework to probe/initialize its device. This ensures fw_devlink doesn't block the consumers of such a clock provider indefinitely.
However, some users of CLK_OF_DECLARE() macros don't use the same node that matches the macro as the node for the clock provider, but they initialize the entire node. To cover these cases, also mark the nodes that match the macros as initialized when the init callback function is called.
An example of this is "stericsson,u8500-clks" that's handled using CLK_OF_DECLARE() and looks something like this:
clocks {
compatible = "stericsson,u8500-clks";
prcmu_clk: prcmu-clock {
#clock-cells = <1>;
};
prcc_pclk: prcc-periph-clock {
#clock-cells = <2>;
};
prcc_kclk: prcc-kernel-clock {
#clock-cells = <2>;
};
prcc_reset: prcc-reset-controller {
#reset-cells = <2>;
};
...
};This patch makes sure that "clocks" is marked as initialized so that fw_devlink knows that all nodes under it have been initialized. If the driver creates struct devices for some of the subnodes, fw_devlink is smart enough to know to wait for those devices to probe, so no special handling is required for those cases.
--- include/linux/clk-provider.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
include/linux/clk-provider.h +7 -1
@@ -1361,7 +1361,13 @@ struct clk_hw_onecell_data {struct clk_hw *hws[]; }; -#define CLK_OF_DECLARE (name, compat, fn) OF_DECLARE_1(clk, name, compat, fn) +#define CLK_OF_DECLARE (name, compat, fn) \ + static void __init name##_of_clk_init_declare(struct device_node *np) \ + { \ + fn(np); \ + fwnode_dev_initialized(of_fwnode_handle(np), true); \ + } \ + OF_DECLARE_1(clk, name, compat, name##_of_clk_init_declare)/* * Use this macro when you have a driver that requires two initialization
Greg Kroah-Hartman
maintainerPATCH 599/600 treewide: Fix probing of devices in DT overlays
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 1a50d9403fb90cbe4dea0ec9fd0351d2ecbd8924 upstream.
When loading a DT overlay that creates a device, the device is not probed, unless the DT overlay is unloaded and reloaded again.
After the recent refactoring to improve fw_devlink, it no longer depends on the "compatible" property to identify which device tree nodes will
become struct devices. fw_devlink now picks up dangling consumers
(consumers pointing to descendent device tree nodes of a device that aren't converted to child devices) when a device is successfully bound to a driver. See __fw_devlink_pickup_dangling_consumers().
However, during DT overlay, a device's device tree node can have sub-nodes added/removed without unbinding/rebinding the driver. This difference in behavior between the normal device instantiation and probing flow vs. the DT overlay flow has a bunch of implications that are pointed out elsewhere[1]. One of them is that the fw_devlink logic to pick up dangling consumers is never exercised.
This patch solves the fw_devlink issue by marking all DT nodes added by DT overlays with FWNODE_FLAG_NOT_DEVICE (fwnode that won't become device), and by clearing the flag when a struct device is actually created for the DT node. This way, fw_devlink knows not to have consumers waiting on these newly added DT nodes, and to propagate the dependency to an ancestor DT node that has the corresponding struct device.
Based on a patch by Saravana Kannan, which covered only platform and spi devices.
[1] https://lore.kernel.org/r/CAGETcx_bkuFaLCiPrAWCPQz+w79ccDp6=9e881qmK=vx3hBMyg@mail.gmail.com
--- drivers/bus/imx-weim.c | 6 ++++++ drivers/i2c/i2c-core-of.c | 5 +++++ drivers/of/dynamic.c | 1 + drivers/of/platform.c | 5 +++++ drivers/spi/spi.c | 5 +++++ 5 files changed, 22 insertions(+)
drivers/bus/imx-weim.c +6 -0
@@ -331,6 +331,12 @@ static int of_weim_notify(struct notifie "Failed to setup timing for '%pOF'\n", rd->dn);if (!of_node_check_flag (rd->dn,OF_POPULATED )) { +/* +* Clear the flag before adding the device so that +* fw_devlink doesn't skip adding consumers to this +* device. +*/ + rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ;if (!of_platform_device_create (rd->dn,NULL , &pdev->dev)) { dev_err(&pdev->dev, "Failed to create child device '%pOF'\n",
drivers/i2c/i2c-core-of.c +5 -0
@@ -244,6 +244,11 @@ static int of_i2c_notify(struct notifierreturn NOTIFY_OK ; } +/* +* Clear the flag before adding the device so that fw_devlink +* doesn't skip adding consumers to this device. +*/ + rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; client =of_i2c_register_device (adap, rd->dn);if (IS_ERR (client)) { dev_err(&adap->dev, "failed to create client for '%pOF'\n",
drivers/of/dynamic.c +1 -0
@@ -225,6 +225,7 @@ static void __of_attach_node(struct devi np->sibling = np->parent->child; np->parent->child = np;of_node_clear_flag (np,OF_DETACHED ); + np->fwnode.flags |=FWNODE_FLAG_NOT_DEVICE ; }/**
drivers/of/platform.c +5 -0
@@ -741,6 +741,11 @@ static int of_platform_notify(struct notif (of_node_check_flag (rd->dn,OF_POPULATED ))return NOTIFY_OK ; +/* +* Clear the flag before adding the device so that fw_devlink +* doesn't skip adding consumers to this device. +*/ + rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ;/* pdev_parent may be NULL when no bus platform device */ pdev_parent =of_find_device_by_node (rd->dn->parent); pdev = of_platform_device_create(rd->dn, NULL,
drivers/spi/spi.c +5 -0
@@ -4370,6 +4370,11 @@ static int of_spi_notify(struct notifierreturn NOTIFY_OK ; } +/* +* Clear the flag before adding the device so that fw_devlink +* doesn't skip adding consumers to this device. +*/ + rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; spi =of_register_spi_device (ctlr, rd->dn);put_device (&ctlr->dev);
Greg Kroah-Hartman
maintainerPATCH 600/600 clk: Avoid invalid function names in CLK_OF_DECLARE()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit 5cf9d015be160e2d90d29ae74ef1364390e8fce8 upstream.
After commit c28cd1f3433c ("clk: Mark a fwnode as initialized when using CLK_OF_DECLARE() macro"), drivers/clk/mvebu/kirkwood.c fails to build:
drivers/clk/mvebu/kirkwood.c:358:1: error: expected identifier or '(' CLK_OF_DECLARE(98dx1135_clk, "marvell,mv98dx1135-core-clock",
^
include/linux/clk-provider.h:1367:21: note: expanded from macro 'CLK_OF_DECLARE'
static void __init name##_of_clk_init_declare(struct device_node *np) \
^ <scratch space>:124:1: note: expanded from here 98dx1135_clk_of_clk_init_declare
^
drivers/clk/mvebu/kirkwood.c:358:1: error: invalid digit 'd' in decimal constant include/linux/clk-provider.h:1372:34: note: expanded from macro 'CLK_OF_DECLARE'
OF_DECLARE_1(clk, name, compat, name##_of_clk_init_declare)
^
<scratch space>:125:3: note: expanded from here 98dx1135_clk_of_clk_init_declare
^
drivers/clk/mvebu/kirkwood.c:358:1: error: invalid digit 'd' in decimal constant include/linux/clk-provider.h:1372:34: note: expanded from macro 'CLK_OF_DECLARE'
OF_DECLARE_1(clk, name, compat, name##_of_clk_init_declare)
^
<scratch space>:125:3: note: expanded from here 98dx1135_clk_of_clk_init_declare
^
drivers/clk/mvebu/kirkwood.c:358:1: error: invalid digit 'd' in decimal constant include/linux/clk-provider.h:1372:34: note: expanded from macro 'CLK_OF_DECLARE'
OF_DECLARE_1(clk, name, compat, name##_of_clk_init_declare)
^
<scratch space>:125:3: note: expanded from here 98dx1135_clk_of_clk_init_declare
^
C function names must start with either an alphabetic letter or an underscore. To avoid generating invalid function names from clock names, add two underscores to the beginning of the identifier.
--- include/linux/clk-provider.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/clk-provider.h +2 -2
@@ -1362,12 +1362,12 @@ struct clk_hw_onecell_data { };#define CLK_OF_DECLARE (name, compat, fn) \ - static void __init name##_of_clk_init_declare(struct device_node *np) \ + static void __init __##name##_of_clk_init_declare(struct device_node *np) \ { \ fn(np); \ fwnode_dev_initialized(of_fwnode_handle(np), true); \ } \ - OF_DECLARE_1(clk, name, compat, name##_of_clk_init_declare) + OF_DECLARE_1(clk, name, compat, __##name##_of_clk_init_declare)/* * Use this macro when you have a driver that requires two initialization
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.53 release. There are 600 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Sep 2023 13:44:56 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.53-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Hello!
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.53 release. There are 600 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Sep 2023 13:44:56 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.53-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
We're seeing this new warning:
-----8<-----
/builds/linux/fs/udf/inode.c:892:6: warning: variable 'newblock' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
892 | if (*err < 0)
| ^~~~~~~~
/builds/linux/fs/udf/inode.c:914:9: note: uninitialized use occurs here
914 | return newblock;
| ^~~~~~~~
/builds/linux/fs/udf/inode.c:892:2: note: remove the 'if' if its condition is always false
892 | if (*err < 0)
| ^~~~~~~~~~~~~
893 | goto out_free;
| ~~~~~~~~~~~~~
/builds/linux/fs/udf/inode.c:699:34: note: initialize the variable 'newblock' to silence this warning
699 | udf_pblk_t newblocknum, newblock;
| ^
| = 0 1 warning generated.
----->8-----
That's with Clang 17 (and nightly) on:
* arm
* powerpc
* s390
Greetings!
Daniel Díaz
[email protected]
Hello!
Quoted 36 lines · Daniel Díaz
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.53 release. There are 600 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Sep 2023 13:44:56 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.53-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
We're seeing this new warning:
-----8<-----
/builds/linux/fs/udf/inode.c:892:6: warning: variable 'newblock' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]892 | if (*err < 0) | ^~~~~~~~ /builds/linux/fs/udf/inode.c:914:9: note: uninitialized use occurs here 914 | return newblock; | ^~~~~~~~ /builds/linux/fs/udf/inode.c:892:2: note: remove the 'if' if its condition is always false 892 | if (*err < 0) | ^~~~~~~~~~~~~ 893 | goto out_free; | ~~~~~~~~~~~~~ /builds/linux/fs/udf/inode.c:699:34: note: initialize the variable 'newblock' to silence this warning 699 | udf_pblk_t newblocknum, newblock; | ^ | = 0
Quoted 7 lines
1 warning generated.
----->8-----That's with Clang 17 (and nightly) on:
* arm
* powerpc
* s390
For what it's worth, bisection points to 903b487b5ba6 ("udf: Handle error when adding extent to a file").
In order to reproduce:
#pip3 install -U tuxmake
tuxmake --runtime podman \
--target-arch arm \
--toolchain clang-17 \
--kconfig multi_v5_defconfig \
LLVM=1 LLVM_IAS=1or:
#pip3 install -U tuxmake
tuxmake --runtime podman \
--target-arch powerpc \
--toolchain clang-17 \
--kconfig defconfig \
LLVM=1 LLVM_IAS=0 LD=powerpc64le-linux-gnu-ldor:
#pip3 install -U tuxmake
tuxmake --runtime podman \
--target-arch s390 \
--toolchain clang-17 \
--kconfig defconfig \
LLVM_IAS=1Greetings!
Daniel Díaz
[email protected]
Quoted 43 lines · Daniel Díaz
Hello!
Quoted 39 lines · Daniel Díaz
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.53 release. There are 600 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Sep 2023 13:44:56 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.53-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
We're seeing this new warning:
-----8<-----
/builds/linux/fs/udf/inode.c:892:6: warning: variable 'newblock' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]892 | if (*err < 0) | ^~~~~~~~ /builds/linux/fs/udf/inode.c:914:9: note: uninitialized use occurs here 914 | return newblock; | ^~~~~~~~ /builds/linux/fs/udf/inode.c:892:2: note: remove the 'if' if its condition is always false 892 | if (*err < 0) | ^~~~~~~~~~~~~ 893 | goto out_free; | ~~~~~~~~~~~~~ /builds/linux/fs/udf/inode.c:699:34: note: initialize the variable 'newblock' to silence this warning 699 | udf_pblk_t newblocknum, newblock; | ^ | = 01 warning generated.
----->8-----
Quoted 7 lines
Quoted 4 lines
That's with Clang 17 (and nightly) on:
* arm
* powerpc
* s390For what it's worth, bisection points to
903b487b5ba6("udf: Handle error when adding extent to a file").
I see the following commit is fixing the reported problem.
commit 6d5ab7c2f7cf90877dab8f2bb06eb5ca8edc73ef
Author: Tom Rix <[email protected]> Date: Fri Dec 30 12:53:41 2022 -0500
udf: initialize newblock to 0
The clang build reports this error fs/udf/inode.c:805:6: error: variable 'newblock' is used
uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (*err < 0)
^~~~~~~~
newblock is never set before error handling jump. Initialize newblock to 0 and remove redundant settings.
Message-Id: <[email protected]>
--
Linaro LKFT
https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 69 lines · Naresh Kamboju
Quoted 43 lines · Daniel Díaz
Hello!
Quoted 39 lines · Daniel Díaz
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.53 release. There are 600 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Sep 2023 13:44:56 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.53-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
We're seeing this new warning:
-----8<-----
/builds/linux/fs/udf/inode.c:892:6: warning: variable 'newblock' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]892 | if (*err < 0) | ^~~~~~~~ /builds/linux/fs/udf/inode.c:914:9: note: uninitialized use occurs here 914 | return newblock; | ^~~~~~~~ /builds/linux/fs/udf/inode.c:892:2: note: remove the 'if' if its condition is always false 892 | if (*err < 0) | ^~~~~~~~~~~~~ 893 | goto out_free; | ~~~~~~~~~~~~~ /builds/linux/fs/udf/inode.c:699:34: note: initialize the variable 'newblock' to silence this warning 699 | udf_pblk_t newblocknum, newblock; | ^ | = 01 warning generated.
----->8-----Quoted 7 lines
Quoted 4 lines
That's with Clang 17 (and nightly) on:
* arm
* powerpc
* s390For what it's worth, bisection points to
903b487b5ba6("udf: Handle error when adding extent to a file").I see the following commit is fixing the reported problem.
commit
6d5ab7c2f7cf90877dab8f2bb06eb5ca8edc73efAuthor: Tom Rix <[email protected]> Date: Fri Dec 30 12:53:41 2022 -0500udf: initialize newblock to 0
The clang build reports this error
fs/udf/inode.c:805:6: error: variable 'newblock' is used
uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (*err < 0)
^~~~~~~~
newblock is never set before error handling jump. Initialize newblock to 0 and remove redundant settings.
Quoted 1 line
Fixes d8b39db5fab8 ("udf: Handle error when adding extent to a file")
Ah, the Fixes: tag lied! There is no such git id in Linus's tree anywhere, so our scripts couldn't match this up at all.
I'll go queue this fix up, thanks for digging it out.
greg k-h
Greg Kroah-Hartman
maintainerQuoted 69 lines · Naresh Kamboju
Quoted 43 lines · Daniel Díaz
Hello!
Quoted 39 lines · Daniel Díaz
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.53 release. There are 600 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Sep 2023 13:44:56 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.53-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
We're seeing this new warning:
-----8<-----
/builds/linux/fs/udf/inode.c:892:6: warning: variable 'newblock' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]892 | if (*err < 0) | ^~~~~~~~ /builds/linux/fs/udf/inode.c:914:9: note: uninitialized use occurs here 914 | return newblock; | ^~~~~~~~ /builds/linux/fs/udf/inode.c:892:2: note: remove the 'if' if its condition is always false 892 | if (*err < 0) | ^~~~~~~~~~~~~ 893 | goto out_free; | ~~~~~~~~~~~~~ /builds/linux/fs/udf/inode.c:699:34: note: initialize the variable 'newblock' to silence this warning 699 | udf_pblk_t newblocknum, newblock; | ^ | = 01 warning generated.
----->8-----Quoted 7 lines
Quoted 4 lines
That's with Clang 17 (and nightly) on:
* arm
* powerpc
* s390For what it's worth, bisection points to
903b487b5ba6("udf: Handle error when adding extent to a file").I see the following commit is fixing the reported problem.
commit
6d5ab7c2f7cf90877dab8f2bb06eb5ca8edc73efAuthor: Tom Rix <[email protected]> Date: Fri Dec 30 12:53:41 2022 -0500udf: initialize newblock to 0
The clang build reports this error
fs/udf/inode.c:805:6: error: variable 'newblock' is used
uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (*err < 0)
^~~~~~~~
newblock is never set before error handling jump. Initialize newblock to 0 and remove redundant settings.
Quoted 5 lines
Fixes d8b39db5fab8 ("udf: Handle error when adding extent to a file")Reported-by Nathan Chancellor <[email protected]>Signed-off-by Tom Rix <[email protected]>Signed-off-by Jan Kara <[email protected]>Message-Id: <[email protected]>
Wait, where is this commit? I don't see it in Linus's tree either, nor in linux-next. Where did you find it?
confused,
greg k-h
Quoted 71 lines · Greg Kroah-Hartman
Quoted 69 lines · Naresh Kamboju
Quoted 43 lines · Daniel Díaz
Hello!
Quoted 39 lines · Daniel Díaz
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.53 release. There are 600 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Sep 2023 13:44:56 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.53-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
We're seeing this new warning:
-----8<-----
/builds/linux/fs/udf/inode.c:892:6: warning: variable 'newblock' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]892 | if (*err < 0) | ^~~~~~~~ /builds/linux/fs/udf/inode.c:914:9: note: uninitialized use occurs here 914 | return newblock; | ^~~~~~~~ /builds/linux/fs/udf/inode.c:892:2: note: remove the 'if' if its condition is always false 892 | if (*err < 0) | ^~~~~~~~~~~~~ 893 | goto out_free; | ~~~~~~~~~~~~~ /builds/linux/fs/udf/inode.c:699:34: note: initialize the variable 'newblock' to silence this warning 699 | udf_pblk_t newblocknum, newblock; | ^ | = 01 warning generated.
----->8-----Quoted 7 lines
Quoted 4 lines
That's with Clang 17 (and nightly) on:
* arm
* powerpc
* s390For what it's worth, bisection points to
903b487b5ba6("udf: Handle error when adding extent to a file").I see the following commit is fixing the reported problem.
commit
6d5ab7c2f7cf90877dab8f2bb06eb5ca8edc73efAuthor: Tom Rix <[email protected]> Date: Fri Dec 30 12:53:41 2022 -0500udf: initialize newblock to 0
The clang build reports this error
fs/udf/inode.c:805:6: error: variable 'newblock' is used
uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (*err < 0)
^~~~~~~~
newblock is never set before error handling jump. Initialize newblock to 0 and remove redundant settings.
Quoted 8 lines
Quoted 5 lines
Fixes d8b39db5fab8 ("udf: Handle error when adding extent to a file")Reported-by Nathan Chancellor <[email protected]>Signed-off-by Tom Rix <[email protected]>Signed-off-by Jan Kara <[email protected]>Message-Id: <[email protected]>
Wait, where is this commit? I don't see it in Linus's tree either, nor in linux-next. Where did you find it?
Can you find this commit id ?
Commit id: 23970a1c9475b305770fd37bebfec7a10f263787
subject: ("udf: initialize newblock to 0")
- Naresh
Quoted 4 lines
confused,
greg k-h
Greg Kroah-Hartman
maintainerQuoted 79 lines · Naresh Kamboju
Quoted 77 lines · Greg Kroah-Hartman
Quoted 74 lines · Naresh Kamboju
Quoted 43 lines · Daniel Díaz
Hello!
Quoted 39 lines · Daniel Díaz
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.53 release. There are 600 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Sep 2023 13:44:56 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.53-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
We're seeing this new warning:
-----8<-----
/builds/linux/fs/udf/inode.c:892:6: warning: variable 'newblock' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]892 | if (*err < 0) | ^~~~~~~~ /builds/linux/fs/udf/inode.c:914:9: note: uninitialized use occurs here 914 | return newblock; | ^~~~~~~~ /builds/linux/fs/udf/inode.c:892:2: note: remove the 'if' if its condition is always false 892 | if (*err < 0) | ^~~~~~~~~~~~~ 893 | goto out_free; | ~~~~~~~~~~~~~ /builds/linux/fs/udf/inode.c:699:34: note: initialize the variable 'newblock' to silence this warning 699 | udf_pblk_t newblocknum, newblock; | ^ | = 01 warning generated.
----->8-----Quoted 7 lines
Quoted 4 lines
That's with Clang 17 (and nightly) on:
* arm
* powerpc
* s390For what it's worth, bisection points to
903b487b5ba6("udf: Handle error when adding extent to a file").I see the following commit is fixing the reported problem.
commit
6d5ab7c2f7cf90877dab8f2bb06eb5ca8edc73efAuthor: Tom Rix <[email protected]> Date: Fri Dec 30 12:53:41 2022 -0500udf: initialize newblock to 0
The clang build reports this error
fs/udf/inode.c:805:6: error: variable 'newblock' is used
uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (*err < 0)
^~~~~~~~
newblock is never set before error handling jump. Initialize newblock to 0 and remove redundant settings.Fixes d8b39db5fab8 ("udf: Handle error when adding extent to a file")Reported-by Nathan Chancellor <[email protected]>Signed-off-by Tom Rix <[email protected]>Signed-off-by Jan Kara <[email protected]>Message-Id: <[email protected]>
Quoted 7 lines
Quoted 2 lines
Wait, where is this commit? I don't see it in Linus's tree either, nor in linux-next. Where did you find it?
Can you find this commit id ?
Commit id:
23970a1c9475b305770fd37bebfec7a10f263787
subject: ("udf: initialize newblock to 0")
Yes, that is in 6.2. Where did the id you used above come from?
confused,
greg k-h
Hi Greg,
Quoted 29 lines
Quoted 29 lines
Quoted 28 lines
Quoted 20 lines
Quoted 2 lines
For what it's worth, bisection points to
903b487b5ba6("udf: Handle error when adding extent to a file").I see the following commit is fixing the reported problem.
commit
6d5ab7c2f7cf90877dab8f2bb06eb5ca8edc73efAuthor: Tom Rix <[email protected]> Date: Fri Dec 30 12:53:41 2022 -0500udf: initialize newblock to 0
The clang build reports this error
fs/udf/inode.c:805:6: error: variable 'newblock' is used
uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (*err < 0)
^~~~~~~~
newblock is never set before error handling jump. Initialize newblock to 0 and remove redundant settings.Quoted 5 lines
Fixes d8b39db5fab8 ("udf: Handle error when adding extent to a file")Reported-by Nathan Chancellor <[email protected]>Signed-off-by Tom Rix <[email protected]>Signed-off-by Jan Kara <[email protected]>Message-Id: <[email protected]>
Wait, where is this commit? I don't see it in Linus's tree either, nor in linux-next. Where did you find it?
Quoted 6 lines
Quoted 4 lines
Can you find this commit id ?
Commit id:
23970a1c9475b305770fd37bebfec7a10f263787
subject: ("udf: initialize newblock to 0")Yes, that is in 6.2. Where did the id you used above come from?
While looking around for the fix commit i found this on Linux next,
$ git log --oneline next-20221226..next-20230106 -- fs/udf/inode.c e86812bfac97e udf: Detect system inodes linked into directory hierarchy 453bc25de0a55 udf: Preserve link count of system files 6d5ab7c2f7cf9 udf: initialize newblock to 0
Quoted 2 lines
confused,
Sorry for the confusion.
Quoted 1 line
greg k-h
- Naresh
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.53 release. There are 600 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Successfully compiled and installed bindeb-pkgs on my computer (Acer Aspire E15, Intel Core i3 Haswell). No noticeable regressions.
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Hi Greg,
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.53 release. There are 600 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Build test (gcc version 13.2.1 20230827):
mips: 52 configs -> no failure
arm: 100 configs -> no failure
arm64: 3 configs -> no failurex86_64: 4 configs -> no failure
alpha allmodconfig -> no failure
csky allmodconfig -> no failure
powerpc allmodconfig -> no failure
riscv allmodconfig -> no failure
s390 allmodconfig -> no failure
xtensa allmodconfig -> no failure
Boot test:x86_64: Booted on my test laptop. No regression.x86_64: Booted on qemu. No regression. [1]
arm64: Booted on rpi4b (4GB model). No regression. [2]
mips: Booted on ci20 board. No regression. [3]
[1]. https://openqa.qa.codethink.co.uk/tests/4999
[2]. https://openqa.qa.codethink.co.uk/tests/5001
[3]. https://openqa.qa.codethink.co.uk/tests/5000
Signature · 2 lines
Regards Sudip
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.53 release. There are 600 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Sep 2023 13:44:56 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.53-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
NOTE:
Reported build warnings with clang-17 on arm, powerpc and s390.
Link:
- https://lore.kernel.org/stable/[email protected]/
## Build
* kernel: 6.1.53-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-6.1.y
* git commit: 6e71673725ca14f97b45c5aeeceb462e3cafc16a
* git describe: v6.1.52-601-g6e71673725ca
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.1.y/build/v6.1.52-601-g6e71673725ca
## Test Regressions (compared to v6.1.52)
## Metric Regressions (compared to v6.1.52)
## Test Fixes (compared to v6.1.52)
## Metric Fixes (compared to v6.1.52)
## Test result summary
total: 134187, pass: 114492, fail: 2409, skip: 17116, xfail: 170
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 146 total, 144 passed, 2 failed
* arm64: 53 total, 50 passed, 3 failed
* i386: 40 total, 38 passed, 2 failed
* mips: 30 total, 28 passed, 2 failed
* parisc: 4 total, 4 passed, 0 failed
* powerpc: 37 total, 35 passed, 2 failed
* riscv: 15 total, 12 passed, 3 failed
* s390: 16 total, 14 passed, 2 failed
* sh: 14 total, 12 passed, 2 failed
* sparc: 8 total, 8 passed, 0 failed
* x86_64: 44 total, 40 passed, 4 failed
## Test suites summary
* boot
* kselftest-android
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers-dma-buf
* kselftest-efivarfs
* kselftest-exec
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-filesystems-epoll
* kselftest-firmware
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-net-forwarding
* kselftest-net-mptcp
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-user_events
* kselftest-vDSO
* kselftest-vm
* kselftest-watchdog
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libgpiod
* log-parser-boot
* log-parser-test
* ltp-cap_bounds
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-fsx
* ltp-hugetlb
* ltp-io
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-securebits
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* network-basic-tests
* perf
* rcutorture
* v4l2-compliance
--
Linaro LKFT
https://lkft.linaro.org
Hi Greg
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.53 release. There are 600 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Sep 2023 13:44:56 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.53-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
6.1.53-rc1 tested.
Build successfully completed.
Boot successfully completed.
No dmesg regressions.
Video output normal.
Sound output normal.
Lenovo ThinkPad X1 Carbon Gen10(Intel i7-1260P(x86_64) arch linux)
Thanks
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.53 release. There are 600 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Other than the already reported ufs inode build failure,
Thanks,
Conor.
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.53 release. There are 600 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Sep 2023 13:44:56 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.53-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v6.1:
11 builds: 11 pass, 0 fail
28 boots: 28 pass, 0 fail
116 tests: 116 pass, 0 failLinux version: 6.1.53-rc1-g6e71673725ca
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.53 release. There are 600 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Sep 2023 13:44:56 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.53-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.53 release. There are 600 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Sep 2023 13:44:56 +0000. Anything received after that time might be too late.
Build results:
total: 157 pass: 157 fail: 0 Qemu test results: total: 529 pass: 529 fail: 0
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.53 release. There are 600 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Sep 2023 13:44:56 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.53-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).