6.12.26-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 116/280 ata: libata-scsi: Improve CDL control
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
commit 17e897a456752ec9c2d7afb3d9baf268b442451b upstream.
With ATA devices supporting the CDL feature, using CDL requires that the feature be enabled with a SET FEATURES command. This command is issued as the translated command for the MODE SELECT command issued by scsi_cdl_enable() when the user enables CDL through the device cdl_enable sysfs attribute.
Currently, ata_mselect_control_ata_feature() always translates a MODE SELECT command for the ATA features subpage of the control mode page to a SET FEATURES command to enable or disable CDL based on the cdl_ctrl field. However, there is no need to issue the SET FEATURES command if:
1) The MODE SELECT command requests disabling CDL and CDL is already disabled.
2) The MODE SELECT command requests enabling CDL and CDL is already enabled.
Fix ata_mselect_control_ata_feature() to issue the SET FEATURES command only when necessary. Since enabling CDL also implies a reset of the CDL statistics log page, avoiding useless CDL enable operations also avoids clearing the CDL statistics log.
Also add debug messages to clearly signal when CDL is being enabled or disabled using a SET FEATURES command.
--- drivers/ata/libata-scsi.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/ata/libata-scsi.c +12 -2
@@ -3757,17 +3757,27 @@ static unsigned int ata_mselect_control_/* Check cdl_ctrl */ switch (buf[0 ] &0x03 ) {case 0 : -/* Disable CDL */ +/* Disable CDL if it is enabled */ +if (!(dev->flags &ATA_DFLAG_CDL_ENABLED )) +return 0 ; +ata_dev_dbg (dev,"Disabling CDL\n" ); cdl_action =0 ; dev->flags &= ~ATA_DFLAG_CDL_ENABLED ;break ;case 0x02 : -/* Enable CDL T2A/T2B: NCQ priority must be disabled */ +/* +* Enable CDL if not already enabled. Since this is mutually +* exclusive with NCQ priority, allow this only if NCQ priority +* is disabled. +*/ +if (dev->flags &ATA_DFLAG_CDL_ENABLED ) +return 0 ;if (dev->flags &ATA_DFLAG_NCQ_PRIO_ENABLED ) {ata_dev_err (dev,"NCQ priority must be disabled to enable CDL\n" );return -EINVAL ; } +ata_dev_dbg (dev,"Enabling CDL\n" ); cdl_action =1 ; dev->flags |=ATA_DFLAG_CDL_ENABLED ;break ;
Greg Kroah-Hartman
maintainerPATCH 117/280 ata: libata-scsi: Fix ata_mselect_control_ata_feature() return type
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
commit db91586b1e8f36122a9e5b8fbced11741488dd22 upstream.
The function ata_mselect_control_ata_feature() has a return type defined as unsigned int but this function may return negative error codes, which are correctly propagated up the call chain as integers.
Fix ata_mselect_control_ata_feature() to have the correct int return type.
While at it, also fix a typo in this function description comment.
--- drivers/ata/libata-scsi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/ata/libata-scsi.c +3 -4
@@ -3734,12 +3734,11 @@ static int ata_mselect_control_spg0(stru }/* -* Translate MODE SELECT control mode page, sub-pages f2h (ATA feature mode +* Translate MODE SELECT control mode page, sub-page f2h (ATA feature mode * page) into a SET FEATURES command. */ -static unsigned int ata_mselect_control_ata_feature (struct ata_queued_cmd *qc, -const u8 *buf,int len, -u16 *fp) +static int ata_mselect_control_ata_feature (struct ata_queued_cmd *qc, +const u8 *buf,int len,u16 *fp) {struct ata_device *dev = qc->dev;struct ata_taskfile *tf = &qc->tf;
Greg Kroah-Hartman
maintainerPATCH 118/280 ata: libata-scsi: Fix ata_msense_control_ata_feature()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
commit 88474ad734fb2000805c63e01cc53ea930adf2c7 upstream.
For the ATA features subpage of the control mode page, the T10 SAT-6 specifications state that:
For a MODE SENSE command, the SATL shall return the CDL_CTRL field value that was last set by an application client.
However, the function ata_msense_control_ata_feature() always sets the CDL_CTRL field to the 0x02 value to indicate support for the CDL T2A and T2B pages. This is thus incorrect and the value 0x02 must be reported only after the user enables the CDL feature, which is indicated with the ATA_DFLAG_CDL_ENABLED device flag. When this flag is not set, the CDL_CTRL field of the ATA feature subpage of the control mode page must report a value of 0x00.
Fix ata_msense_control_ata_feature() to report the correct values for the CDL_CTRL field, according to the enable/disable state of the device CDL feature.
--- drivers/ata/libata-scsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ata/libata-scsi.c +2 -2
@@ -2325,8 +2325,8 @@ static unsigned int ata_msense_control_a*/ put_unaligned_be16 (ATA_FEATURE_SUB_MPAGE_LEN -4 , &buf[2 ]); -if (dev->flags &ATA_DFLAG_CDL ) - buf[4 ] =0x02 ;/* Support T2A and T2B pages */ +if (dev->flags &ATA_DFLAG_CDL_ENABLED ) + buf[4 ] =0x02 ;/* T2A and T2B pages enabled */ else buf[4 ] =0 ;
Greg Kroah-Hartman
maintainerPATCH 119/280 USB: storage: quirk for ADATA Portable HDD CH94
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit 9ab75eee1a056f896b87d139044dd103adc532b9 upstream.
Version 1.60 specifically needs this quirk.
Version 2.00 is known good.
--- drivers/usb/storage/unusual_uas.h | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/storage/unusual_uas.h +7 -0
@@ -83,6 +83,13 @@ UNUSUAL_DEV(0x0bc2, 0x331a, 0x0000, 0x99 USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_REPORT_LUNS), +/* Reported-by: Oliver Neukum <[email protected]> */ +UNUSUAL_DEV (0x125f ,0xa94a ,0x0160 ,0x0160 , +"ADATA" , +"Portable HDD CH94" , +USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , +US_FL_NO_ATA_1X ), +/* Reported-by: Benjamin Tissoires <[email protected]> */ UNUSUAL_DEV(0x13fd, 0x3940, 0x0000, 0x9999, "Initio Corporation",
Greg Kroah-Hartman
maintainerPATCH 120/280 scsi: Improve CDL control
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
commit 14a3cc755825ef7b34c986aa2786ea815023e9c5 upstream.
With ATA devices supporting the CDL feature, using CDL requires that the feature be enabled with a SET FEATURES command. This command is issued as the translated command for the MODE SELECT command issued by scsi_cdl_enable() when the user enables CDL through the device cdl_enable sysfs attribute.
However, the implementation of scsi_cdl_enable() always issues a MODE SELECT command for ATA devices when the enable argument is true, even if CDL is already enabled on the device. While this does not cause any issue with using CDL descriptors with read/write commands (the CDL feature will be enabled on the drive), issuing the MODE SELECT command even when the device CDL feature is already enabled will cause a reset of the ATA device CDL statistics log page (as defined in ACS, any CDL enable action must reset the device statistics).
Avoid this needless actions (and the implied statistics log page reset) by modifying scsi_cdl_enable() to issue the MODE SELECT command to enable CDL if and only if CDL is not reported as already enabled on the device.
And while at it, simplify the initialization of the is_ata boolean variable and move the declaration of the scsi mode data and sense header variables to within the scope of ATA device handling.
--- drivers/scsi/scsi.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-)
drivers/scsi/scsi.c +24 -12
@@ -695,26 +695,23 @@ void scsi_cdl_check(struct scsi_device **/ int scsi_cdl_enable (struct scsi_device *sdev,bool enable) { -struct scsi_mode_data data; -struct scsi_sense_hdr sshdr; -struct scsi_vpd *vpd; -bool is_ata = false;char buf[64 ]; +bool is_ata;int ret;if (!sdev->cdl_supported)return -EOPNOTSUPP ;rcu_read_lock (); - vpd =rcu_dereference (sdev->vpd_pg89); -if (vpd) - is_ata = true; + is_ata =rcu_dereference (sdev->vpd_pg89);rcu_read_unlock ();/* * For ATA devices, CDL needs to be enabled with a SET FEATURES command. */ if (is_ata) { +struct scsi_mode_data data; +struct scsi_sense_hdr sshdr;char *buf_data;int len;
@@ -723,16 +720,30 @@ int scsi_cdl_enable(struct scsi_device *if (ret)return -EINVAL ; -/* Enable CDL using the ATA feature page */ +/* Enable or disable CDL using the ATA feature page */ len =min_t (size_t,sizeof (buf), data.length - data.header_length - data.block_descriptor_length); buf_data = buf + data.header_length + data.block_descriptor_length; -if (enable) - buf_data[4 ] =0x02 ; -else - buf_data[4 ] =0 ; + +/* +* If we want to enable CDL and CDL is already enabled on the +* device, do nothing. This avoids needlessly resetting the CDL +* statistics on the device as that is implied by the CDL enable +* action. Similar to this, there is no need to do anything if +* we want to disable CDL and CDL is already disabled. +*/ +if (enable) { +if ((buf_data[4 ] &0x03 ) ==0x02 ) + goto out; + buf_data[4 ] &= ~0x03 ; + buf_data[4 ] |=0x02 ; + }else { +if ((buf_data[4 ] &0x03 ) ==0x00 ) + goto out; + buf_data[4 ] &= ~0x03 ; + } ret =scsi_mode_select (sdev,1 ,0 , buf_data, len,5 *HZ ,3 , &data, &sshdr);
@@ -744,6 +755,7 @@ int scsi_cdl_enable(struct scsi_device * } } +out: sdev->cdl_enable = enable;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 121/280 mei: me: add panther lake H DID
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Usyskin <[email protected]>
commit 86ce5c0a1dec02e21b4c864b2bc0cc5880a2c13c upstream.
Add Panther Lake H device id.
--- drivers/misc/mei/hw-me-regs.h | 1 + drivers/misc/mei/pci-me.c | 1 + 2 files changed, 2 insertions(+)
drivers/misc/mei/hw-me-regs.h +1 -0
@@ -117,6 +117,7 @@#define MEI_DEV_ID_LNL_M 0xA870/* Lunar Lake Point M */ +#define MEI_DEV_ID_PTL_H 0xE370/* Panther Lake H */ #define MEI_DEV_ID_PTL_P 0xE470/* Panther Lake P */ /*
drivers/misc/mei/pci-me.c +1 -0
@@ -124,6 +124,7 @@ static const struct pci_device_id mei_me {MEI_PCI_DEVICE(MEI_DEV_ID_LNL_M, MEI_ME_PCH15_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_PTL_H, MEI_ME_PCH15_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_PTL_P, MEI_ME_PCH15_CFG)},/* required last entry */
Greg Kroah-Hartman
maintainerPATCH 122/280 mei: vsc: Fix fortify-panic caused by invalid counted_by() use
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 00f1cc14da0f06d2897b8c528df7c7dcf1b8da50 upstream.
gcc 15 honors the __counted_by(len) attribute on vsc_tp_packet.buf[] and the vsc-tp.c code is using this in a wrong way. len does not contain the available size in the buffer, it contains the actual packet length *without* the crc. So as soon as vsc_tp_xfer() tries to add the crc to buf[] the fortify-panic handler gets triggered:
[ 80.842193] memcpy: detected buffer overflow: 4 byte write of buffer size 0 [ 80.842243] WARNING: CPU: 4 PID: 272 at lib/string_helpers.c:1032 __fortify_report+0x45/0x50 ... [ 80.843175] __fortify_panic+0x9/0xb [ 80.843186] vsc_tp_xfer.cold+0x67/0x67 [mei_vsc_hw] [ 80.843210] ? seqcount_lockdep_reader_access.constprop.0+0x82/0x90 [ 80.843229] ? lockdep_hardirqs_on+0x7c/0x110 [ 80.843250] mei_vsc_hw_start+0x98/0x120 [mei_vsc] [ 80.843270] mei_reset+0x11d/0x420 [mei]
The easiest fix would be to just drop the counted-by but with the exception of the ack buffer in vsc_tp_xfer_helper() which only contains enough room for the packet-header, all other uses of vsc_tp_packet always use a buffer of VSC_TP_MAX_XFER_SIZE bytes for the packet.
Instead of just dropping the counted-by, split the vsc_tp_packet struct definition into a header and a full-packet definition and use a fixed size buf[] in the packet definition, this way fortify-source buffer overrun checking still works when enabled.
--- drivers/misc/mei/vsc-tp.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/misc/mei/vsc-tp.c +15 -11
@@ -36,20 +36,24 @@#define VSC_TP_XFER_TIMEOUT_BYTES 700#define VSC_TP_PACKET_PADDING_SIZE 1#define VSC_TP_PACKET_SIZE (pkt) \ - (sizeof(struct vsc_tp_packet) + le16_to_cpu((pkt)->len) + VSC_TP_CRC_SIZE) + (sizeof(struct vsc_tp_packet_hdr) + le16_to_cpu((pkt)->hdr.len) + VSC_TP_CRC_SIZE)#define VSC_TP_MAX_PACKET_SIZE \ - (sizeof(struct vsc_tp_packet) + VSC_TP_MAX_MSG_SIZE + VSC_TP_CRC_SIZE) + (sizeof(struct vsc_tp_packet_hdr) + VSC_TP_MAX_MSG_SIZE + VSC_TP_CRC_SIZE)#define VSC_TP_MAX_XFER_SIZE \ (VSC_TP_MAX_PACKET_SIZE + VSC_TP_XFER_TIMEOUT_BYTES)#define VSC_TP_NEXT_XFER_LEN (len, offset) \ - (len + sizeof(struct vsc_tp_packet) + VSC_TP_CRC_SIZE - offset + VSC_TP_PACKET_PADDING_SIZE) + (len + sizeof(struct vsc_tp_packet_hdr) + VSC_TP_CRC_SIZE - offset + VSC_TP_PACKET_PADDING_SIZE) -struct vsc_tp_packet { +struct vsc_tp_packet_hdr {__u8 sync;__u8 cmd;__le16 len;__le32 seq; - __u8 buf[] __counted_by(len); +}; + +struct vsc_tp_packet { +struct vsc_tp_packet_hdr hdr; +__u8 buf[VSC_TP_MAX_XFER_SIZE -sizeof (struct vsc_tp_packet_hdr )]; };struct vsc_tp {
@@ -158,12 +162,12 @@ static int vsc_tp_dev_xfer(struct vsc_tpstatic int vsc_tp_xfer_helper (struct vsc_tp *tp,struct vsc_tp_packet *pkt,void *ibuf,u16 ilen) { -int ret, offset =0 , cpy_len, src_len, dst_len =sizeof (struct vsc_tp_packet ); +int ret, offset =0 , cpy_len, src_len, dst_len =sizeof (struct vsc_tp_packet_hdr );int next_xfer_len =VSC_TP_PACKET_SIZE (pkt) +VSC_TP_XFER_TIMEOUT_BYTES ;u8 *src, *crc_src, *rx_buf = tp->rx_buf;int count_down =VSC_TP_MAX_XFER_COUNT ;u32 recv_crc =0 , crc = ~0 ; -struct vsc_tp_packet ack; +struct vsc_tp_packet_hdr ack;u8 *dst = (u8 *)&ack;bool synced = false;
@@ -280,10 +284,10 @@ int vsc_tp_xfer(struct vsc_tp *tp, u8 cmguard (mutex)(&tp->mutex); - pkt->sync =VSC_TP_PACKET_SYNC ; - pkt->cmd = cmd; - pkt->len =cpu_to_le16 (olen); - pkt->seq =cpu_to_le32 (++tp->seq); + pkt->hdr.sync =VSC_TP_PACKET_SYNC ; + pkt->hdr.cmd = cmd; + pkt->hdr.len =cpu_to_le16 (olen); + pkt->hdr.seq =cpu_to_le32 (++tp->seq);memcpy (pkt->buf, obuf, olen); crc = ~crc32 (~0 , (u8 *)pkt,sizeof (pkt) + olen);
Greg Kroah-Hartman
maintainerPATCH 123/280 KVM: x86: Explicitly treat routing entry type changes as changes
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit bcda70c56f3e718465cab2aad260cf34183ce1ce upstream.
Explicitly treat type differences as GSI routing changes, as comparing MSI data between two entries could get a false negative, e.g. if userspace changed the type but left the type-specific data as-is.
Message-ID: <[email protected]>
--- arch/x86/kvm/x86.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kvm/x86.c +2 -1
@@ -13601,7 +13601,8 @@ int kvm_arch_update_irqfd_routing(structbool kvm_arch_irqfd_route_changed (struct kvm_kernel_irq_routing_entry *old,struct kvm_kernel_irq_routing_entry *new) { -if (new->type !=KVM_IRQ_ROUTING_MSI ) +if (old->type !=KVM_IRQ_ROUTING_MSI || + new->type !=KVM_IRQ_ROUTING_MSI )return true;return !!memcmp (&old->msi, &new->msi,sizeof (new->msi));
Greg Kroah-Hartman
maintainerPATCH 124/280 KVM: x86: Reset IRTE to host control if *new* route isnt postable
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 9bcac97dc42d2f4da8229d18feb0fe2b1ce523a2 upstream.
Restore an IRTE back to host control (remapped or posted MSI mode) if the *new* GSI route prevents posting the IRQ directly to a vCPU, regardless of the GSI routing type. Updating the IRTE if and only if the new GSI is an MSI results in KVM leaving an IRTE posting to a vCPU.
The dangling IRTE can result in interrupts being incorrectly delivered to the guest, and in the worst case scenario can result in use-after-free, e.g. if the VM is torn down, but the underlying host IRQ isn't freed.
Message-ID: <[email protected]>
--- arch/x86/kvm/svm/avic.c | 58 +++++++++++++++++++++-------------------- arch/x86/kvm/vmx/posted_intr.c | 28 +++++++------------ 2 files changed, 41 insertions(+), 45 deletions(-)
arch/x86/kvm/svm/avic.c +31 -27
@@ -896,6 +896,7 @@ int avic_pi_update_irte(struct kvm *kvm, {struct kvm_kernel_irq_routing_entry *e;struct kvm_irq_routing_table *irq_rt; +bool enable_remapped_mode = true;int idx, ret =0 ; if (!kvm_arch_has_assigned_device(kvm) ||
@@ -933,6 +934,8 @@ int avic_pi_update_irte(struct kvm *kvm, kvm_vcpu_apicv_active(&svm->vcpu)) {struct amd_iommu_pi_data pi; + enable_remapped_mode = false; +/* Try to enable guest_mode in IRTE */ pi.base =__sme_set (page_to_phys (svm->avic_backing_page) &AVIC_HPA_MASK );
@@ -951,33 +954,6 @@ int avic_pi_update_irte(struct kvm *kvm,*/ if (!ret && pi.is_guest_mode)svm_ir_list_add (svm, &pi); - }else { -/* Use legacy mode in IRTE */ -struct amd_iommu_pi_data pi; - -/** -* Here, pi is used to: -* - Tell IOMMU to use legacy mode for this interrupt. -* - Retrieve ga_tag of prior interrupt remapping data. -*/ - pi.prev_ga_tag =0 ; - pi.is_guest_mode = false; - ret =irq_set_vcpu_affinity (host_irq, &pi); - -/** -* Check if the posted interrupt was previously -* setup with the guest_mode by checking if the ga_tag -* was cached. If so, we need to clean up the per-vcpu -* ir_list. -*/ -if (!ret && pi.prev_ga_tag) { -int id =AVIC_GATAG_TO_VCPUID (pi.prev_ga_tag); -struct kvm_vcpu *vcpu; - - vcpu =kvm_get_vcpu_by_id (kvm, id); -if (vcpu) -svm_ir_list_del (to_svm (vcpu), &pi); - } }if (!ret && svm) {
@@ -993,6 +969,34 @@ int avic_pi_update_irte(struct kvm *kvm, } ret =0 ; +if (enable_remapped_mode) { +/* Use legacy mode in IRTE */ +struct amd_iommu_pi_data pi; + +/** +* Here, pi is used to: +* - Tell IOMMU to use legacy mode for this interrupt. +* - Retrieve ga_tag of prior interrupt remapping data. +*/ + pi.prev_ga_tag =0 ; + pi.is_guest_mode = false; + ret =irq_set_vcpu_affinity (host_irq, &pi); + +/** +* Check if the posted interrupt was previously +* setup with the guest_mode by checking if the ga_tag +* was cached. If so, we need to clean up the per-vcpu +* ir_list. +*/ +if (!ret && pi.prev_ga_tag) { +int id =AVIC_GATAG_TO_VCPUID (pi.prev_ga_tag); +struct kvm_vcpu *vcpu; + + vcpu =kvm_get_vcpu_by_id (kvm, id); +if (vcpu) +svm_ir_list_del (to_svm (vcpu), &pi); + } + } out:srcu_read_unlock (&kvm->irq_srcu, idx);return ret;
arch/x86/kvm/vmx/posted_intr.c +10 -18
@@ -274,6 +274,7 @@ int vmx_pi_update_irte(struct kvm *kvm, {struct kvm_kernel_irq_routing_entry *e;struct kvm_irq_routing_table *irq_rt; +bool enable_remapped_mode = true;struct kvm_lapic_irq irq;struct kvm_vcpu *vcpu;struct vcpu_data vcpu_info;
@@ -312,21 +313,8 @@ int vmx_pi_update_irte(struct kvm *kvm,kvm_set_msi_irq (kvm, e, &irq);if (!kvm_intr_is_single_vcpu (kvm, &irq, &vcpu) || - !kvm_irq_is_postable (&irq)) { -/* -* Make sure the IRTE is in remapped mode if -* we don't handle it in posted mode. -*/ - ret =irq_set_vcpu_affinity (host_irq,NULL ); -if (ret <0 ) { -printk (KERN_INFO -"failed to back to remapped mode, irq: %u\n" , - host_irq); - goto out; - } - + !kvm_irq_is_postable (&irq))continue ; - } vcpu_info.pi_desc_addr =__pa (vcpu_to_pi_desc (vcpu)); vcpu_info.vector = irq.vector;
@@ -334,11 +322,12 @@ int vmx_pi_update_irte(struct kvm *kvm,trace_kvm_pi_irte_update (host_irq, vcpu->vcpu_id, e->gsi, vcpu_info.vector, vcpu_info.pi_desc_addr, set); -if (set) - ret =irq_set_vcpu_affinity (host_irq, &vcpu_info); -else - ret =irq_set_vcpu_affinity (host_irq,NULL ); +if (!set) +continue ; + enable_remapped_mode = false; + + ret =irq_set_vcpu_affinity (host_irq, &vcpu_info);if (ret <0 ) {printk (KERN_INFO "%s: failed to update PI IRTE\n" , __func__);
@@ -346,6 +335,9 @@ int vmx_pi_update_irte(struct kvm *kvm, } } +if (enable_remapped_mode) + ret =irq_set_vcpu_affinity (host_irq,NULL ); + ret =0 ; out:srcu_read_unlock (&kvm->irq_srcu, idx);
Greg Kroah-Hartman
maintainerPATCH 125/280 KVM: x86: Take irqfds.lock when adding/deleting IRQ bypass producer
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit f1fb088d9cecde5c3066d8ff8846789667519b7d upstream.
Take irqfds.lock when adding/deleting an IRQ bypass producer to ensure irqfd->producer isn't modified while kvm_irq_routing_update() is running. The only lock held when a producer is added/removed is irqbypass's mutex.
Message-ID: <[email protected]>
--- arch/x86/kvm/x86.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
arch/x86/kvm/x86.c +15 -2
@@ -13555,15 +13555,22 @@ int kvm_arch_irq_bypass_add_producer(str {struct kvm_kernel_irqfd *irqfd = container_of(cons, struct kvm_kernel_irqfd, consumer); +struct kvm *kvm = irqfd->kvm;int ret; - irqfd->producer = prod;kvm_arch_start_assignment (irqfd->kvm); + +spin_lock_irq (&kvm->irqfds.lock); + irqfd->producer = prod; + ret =kvm_x86_call (pi_update_irte)(irqfd->kvm, prod->irq, irqfd->gsi,1 );if (ret)kvm_arch_end_assignment (irqfd->kvm); +spin_unlock_irq (&kvm->irqfds.lock); + +return ret; }
@@ -13573,9 +13580,9 @@ void kvm_arch_irq_bypass_del_producer(stint ret;struct kvm_kernel_irqfd *irqfd = container_of(cons, struct kvm_kernel_irqfd, consumer); +struct kvm *kvm = irqfd->kvm;WARN_ON (irqfd->producer != prod); - irqfd->producer =NULL ;/* * When producer of consumer is unregistered, we change back to
@@ -13583,12 +13590,18 @@ void kvm_arch_irq_bypass_del_producer(st* when the irq is masked/disabled or the consumer side (KVM * int this case doesn't want to receive the interrupts. */ +spin_lock_irq (&kvm->irqfds.lock); + irqfd->producer =NULL ; + ret =kvm_x86_call (pi_update_irte)(irqfd->kvm, prod->irq, irqfd->gsi,0 );if (ret)printk (KERN_INFO "irq bypass consumer (token %p) unregistration" " fails: %d\n" , irqfd->consumer.token, ret); +spin_unlock_irq (&kvm->irqfds.lock); + +kvm_arch_end_assignment (irqfd->kvm); }
Greg Kroah-Hartman
maintainerPATCH 126/280 char: misc: register chrdev region with all possible minors
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
commit c876be906ce7e518d9ef9926478669c151999e69 upstream.
register_chrdev will only register the first 256 minors of a major chrdev. That means that dynamically allocated misc devices with minor above 255 will fail to open with -ENXIO.
This was found by kernel test robot when testing a different change that makes all dynamically allocated minors be above 255. This has, however, been separately tested by creating 256 serio_raw devices with the help of userio driver.
Ever since allowing misc devices with minors above 128, this has been possible.
Fix it by registering all minor numbers from 0 to MINORMASK + 1 for MISC_MAJOR.
--- drivers/char/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/misc.c +1 -1
@@ -315,7 +315,7 @@ static int __init misc_init(void) goto fail_remove; err = -EIO ; -if (register_chrdev (MISC_MAJOR ,"misc" , &misc_fops)) +if (__register_chrdev (MISC_MAJOR ,0 ,MINORMASK +1 ,"misc" , &misc_fops)) goto fail_printk;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 127/280 misc: microchip: pci1xxxx: Fix Kernel panic during IRQ handler registration
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rengarajan S <[email protected]>
commit 18eb77c75ed01439f96ae5c0f33461eb5134b907 upstream.
Resolve kernel panic while accessing IRQ handler associated with the generated IRQ. This is done by acquiring the spinlock and storing the current interrupt state before handling the interrupt request using generic_handle_irq.
A previous fix patch was submitted where 'generic_handle_irq' was replaced with 'handle_nested_irq'. However, this change also causes the kernel panic where after determining which GPIO triggered the interrupt and attempting to call handle_nested_irq with the mapped IRQ number, leads to a failure in locating the registered handler.
--- drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c +5 -1
@@ -37,6 +37,7 @@struct pci1xxxx_gpio {struct auxiliary_device *aux_dev;void __iomem *reg_base; +raw_spinlock_t wa_lock;struct gpio_chip gpio;spinlock_t lock;int irq_base;
@@ -254,6 +255,7 @@ static irqreturn_t pci1xxxx_gpio_irq_hanstruct pci1xxxx_gpio *priv = dev_id;struct gpio_chip *gc = &priv->gpio;unsigned long int_status =0 ; +unsigned long wa_flags;unsigned long flags;u8 pincount;int bit;
@@ -277,7 +279,9 @@ static irqreturn_t pci1xxxx_gpio_irq_hanwritel (BIT (bit), priv->reg_base +INTR_STATUS_OFFSET (gpiobank));spin_unlock_irqrestore (&priv->lock, flags); irq =irq_find_mapping (gc->irq.domain, (bit + (gpiobank *32 ))); -handle_nested_irq (irq); +raw_spin_lock_irqsave (&priv->wa_lock, wa_flags); +generic_handle_irq (irq); +raw_spin_unlock_irqrestore (&priv->wa_lock, wa_flags); } }spin_lock_irqsave (&priv->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 128/280 misc: microchip: pci1xxxx: Fix incorrect IRQ status handling during ack
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rengarajan S <[email protected]>
commit e9d7748a7468581859d2b85b378135f9688a0aff upstream.
Under irq_ack, pci1xxxx_assign_bit reads the current interrupt status, modifies and writes the entire value back. Since, the IRQ status bit gets cleared on writing back, the better approach is to directly write the bitmask to the register in order to preserve the value.
--- drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c +1 -1
@@ -165,7 +165,7 @@ static void pci1xxxx_gpio_irq_ack(structunsigned long flags;spin_lock_irqsave (&priv->lock, flags); -pci1xxx_assign_bit (priv->reg_base,INTR_STAT_OFFSET (gpio), (gpio %32 ), true); +writel (BIT (gpio %32 ), priv->reg_base +INTR_STAT_OFFSET (gpio));spin_unlock_irqrestore (&priv->lock, flags); }
Greg Kroah-Hartman
maintainerPATCH 129/280 firmware: stratix10-svc: Add of_platform_default_populate()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mahesh Rao <[email protected]>
commit 4d239f447f96bd2cb646f89431e9db186c1ccfd4 upstream.
Add of_platform_default_populate() to stratix10-svc driver as the firmware/svc node was moved out of soc. This fixes the failed probing of child drivers of svc node.
--- drivers/firmware/stratix10-svc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/firmware/stratix10-svc.c +11 -3
@@ -1227,22 +1227,28 @@ static int stratix10_svc_drv_probe(strucif (!svc->intel_svc_fcs) {dev_err (dev,"failed to allocate %s device\n" ,INTEL_FCS ); ret = -ENOMEM ; - goto err_unregister_dev; + goto err_unregister_rsu_dev; } ret =platform_device_add (svc->intel_svc_fcs);if (ret) {platform_device_put (svc->intel_svc_fcs); - goto err_unregister_dev; + goto err_unregister_rsu_dev; } + ret =of_platform_default_populate (dev_of_node (dev),NULL , dev); +if (ret) + goto err_unregister_fcs_dev; +dev_set_drvdata (dev, svc);pr_info ("Intel Service Layer Driver Initialized\n" );return 0 ; -err_unregister_dev: +err_unregister_fcs_dev: +platform_device_unregister (svc->intel_svc_fcs); +err_unregister_rsu_dev:platform_device_unregister (svc->stratix10_svc_rsu); err_free_kfifo:kfifo_free (&controller->svc_fifo);
@@ -1256,6 +1262,8 @@ static void stratix10_svc_drv_remove(strstruct stratix10_svc *svc =dev_get_drvdata (&pdev->dev);struct stratix10_svc_controller *ctrl =platform_get_drvdata (pdev); +of_platform_depopulate (ctrl->dev); +platform_device_unregister (svc->intel_svc_fcs);platform_device_unregister (svc->stratix10_svc_rsu);
Greg Kroah-Hartman
maintainerPATCH 130/280 tty: Require CAP_SYS_ADMIN for all usages of TIOCL_SELMOUSEREPORT
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Günther Noack <[email protected]>
commit ee6a44da3c87cf64d67dd02be8c0127a5bf56175 upstream.
This requirement was overeagerly loosened in commit 2f83e38a095f ("tty: Permit some TIOCL_SETSEL modes without CAP_SYS_ADMIN"), but as it turns out,
(1) the logic I implemented there was inconsistent (apologies!),
(2) TIOCL_SELMOUSEREPORT might actually be a small security risk after all, and
(3) TIOCL_SELMOUSEREPORT is only meant to be used by the mouse daemon (GPM or Consolation), which runs as CAP_SYS_ADMIN already.
In more detail:
1. The previous patch has inconsistent logic:
In commit 2f83e38a095f ("tty: Permit some TIOCL_SETSEL modes without CAP_SYS_ADMIN"), we checked for sel_mode == TIOCL_SELMOUSEREPORT, but overlooked that the lower four bits of this "mode" parameter were actually used as an additional way to pass an argument. So the patch did actually still require CAP_SYS_ADMIN, if any of the mouse button bits are set, but did not require it if none of the mouse buttons bits are set.
This logic is inconsistent and was not intentional. We should have the same policies for using TIOCL_SELMOUSEREPORT independent of the value of the "hidden" mouse button argument.
I sent a separate documentation patch to the man page list with more details on TIOCL_SELMOUSEREPORT:
https://lore.kernel.org/all/[email protected]/
2. TIOCL_SELMOUSEREPORT is indeed a potential security risk which can let an attacker simulate "keyboard" input to command line applications on the same terminal, like TIOCSTI and some other TIOCLINUX "selection mode" IOCTLs.
By enabling mouse reporting on a terminal and then injecting mouse reports through TIOCL_SELMOUSEREPORT, an attacker can simulate mouse movements on the same terminal, similar to the TIOCSTI keystroke injection attacks that were previously possible with TIOCSTI and other TIOCL_SETSEL selection modes.
Many programs (including libreadline/bash) are then prone to misinterpret these mouse reports as normal keyboard input because they do not expect input in the X11 mouse protocol form. The attacker does not have complete control over the escape sequence, but they can at least control the values of two consecutive bytes in the binary mouse reporting escape sequence.
I went into more detail on that in the discussion at
https://lore.kernel.org/all/[email protected]/
It is not equally trivial to simulate arbitrary keystrokes as it was with TIOCSTI (commit 83efeeeb3d04 ("tty: Allow TIOCSTI to be disabled")), but the general mechanism is there, and together with the small number of existing legit use cases (see below), it would be better to revert back to requiring CAP_SYS_ADMIN for TIOCL_SELMOUSEREPORT, as it was already the case before commit 2f83e38a095f ("tty: Permit some TIOCL_SETSEL modes without CAP_SYS_ADMIN").
3. TIOCL_SELMOUSEREPORT is only used by the mouse daemons (GPM or Consolation), and they are the only legit use case:
To quote console_codes(4):
The mouse tracking facility is intended to return xterm(1)-compatible mouse status reports. Because the console driver has no way to know the device or type of the mouse, these reports are returned in the console input stream only when the virtual terminal driver receives a mouse update ioctl. These ioctls must be generated by a mouse-aware user-mode application such as the gpm(8) daemon.
Jared Finder has also confirmed in
https://lore.kernel.org/all/[email protected]/
that Emacs does not call TIOCL_SELMOUSEREPORT directly, and it would be difficult to find good reasons for doing that, given that it would interfere with the reports that GPM is sending.
More information on the interaction between GPM, terminals and the kernel with additional pointers is also available in this patch:
https://lore.kernel.org/all/a773e48920aa104a65073671effbdee665c105fc.1603963593.git.tammo.block@gmail.com/
For background on who else uses TIOCL_SELMOUSEREPORT: Debian Code search finds one page of results, the only two known callers are the two mouse daemons GPM and Consolation. (GPM does not show up in the search results because it uses literal numbers to refer to TIOCLINUX-related enums. I looked through GPM by hand instead. TIOCL_SELMOUSEREPORT is also not used from libgpm.)
https://codesearch.debian.net/search?q=TIOCL_SELMOUSEREPORT
--- drivers/tty/vt/selection.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/tty/vt/selection.c +2 -3
@@ -193,13 +193,12 @@ int set_selection_user(const struct tiocl_selection __user *sel,return -EFAULT ;/* -* TIOCL_SELCLEAR, TIOCL_SELPOINTER and TIOCL_SELMOUSEREPORT are OK to -* use without CAP_SYS_ADMIN as they do not modify the selection. +* TIOCL_SELCLEAR and TIOCL_SELPOINTER are OK to use without +* CAP_SYS_ADMIN as they do not modify the selection. */ switch (v.sel_mode) {case TIOCL_SELCLEAR :case TIOCL_SELPOINTER : -case TIOCL_SELMOUSEREPORT :break ;default :if (!capable (CAP_SYS_ADMIN ))
Signature · 1 line
2.49.0
Greg Kroah-Hartman
maintainerPATCH 131/280 serial: msm: Configure correct working mode before starting earlycon
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gerhold <[email protected]>
commit 7094832b5ac861b0bd7ed8866c93cb15ef619996 upstream.
The MSM UART DM controller supports different working modes, e.g. DMA or the "single-character mode", where all reads/writes operate on a single character rather than 4 chars (32-bit) at once. When using earlycon, __msm_console_write() always writes 4 characters at a time, but we don't know which mode the bootloader was using and we don't set the mode either.
This causes garbled output if the bootloader was using the single-character mode, because only every 4th character appears in the serial console, e.g.
"[ 00oni pi 000xf0[ 00i s 5rm9(l)l s 1 1 SPMTA 7:C 5[ 00A ade k d[
00ano:ameoi .Q1B[ 00ac _idaM00080oo'"
If the bootloader was using the DMA ("DM") mode, output would likely fail entirely. Later, when the full serial driver probes, the port is re-initialized and output works as expected.
Fix this also for earlycon by clearing the DMEN register and reset+re-enable the transmitter to apply the change. This ensures the transmitter is in the expected state before writing any output.
--- drivers/tty/serial/msm_serial.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/tty/serial/msm_serial.c +6 -0
@@ -1746,6 +1746,12 @@ msm_serial_early_console_setup_dm(structif (!device->port.membase)return -ENODEV ; +/* Disable DM / single-character modes */ +msm_write (&device->port,0 ,UARTDM_DMEN ); +msm_write (&device->port,MSM_UART_CR_CMD_RESET_RX ,MSM_UART_CR ); +msm_write (&device->port,MSM_UART_CR_CMD_RESET_TX ,MSM_UART_CR ); +msm_write (&device->port,MSM_UART_CR_TX_ENABLE ,MSM_UART_CR ); + device->con->write = msm_serial_early_write_dm;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 132/280 serial: sifive: lock port in startup()/shutdown() callbacks
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryo Takakura <[email protected]>
commit e1ca3ff28ab1e2c1e70713ef3fa7943c725742c3 upstream.
startup()/shutdown() callbacks access SIFIVE_SERIAL_IE_OFFS. The register is also accessed from write() callback.
If console were printing and startup()/shutdown() callback gets called, its access to the register could be overwritten.
Add port->lock to startup()/shutdown() callbacks to make sure their access to SIFIVE_SERIAL_IE_OFFS is synchronized against write() callback.
Rule: add
--- drivers/tty/serial/sifive.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/tty/serial/sifive.c +6 -0
@@ -563,8 +563,11 @@ static void sifive_serial_break_ctl(strustatic int sifive_serial_startup (struct uart_port *port) {struct sifive_serial_port *ssp =port_to_sifive_serial_port (port); +unsigned long flags; +uart_port_lock_irqsave (&ssp->port, &flags);__ssp_enable_rxwm (ssp); +uart_port_unlock_irqrestore (&ssp->port, flags);return 0 ; }
@@ -572,9 +575,12 @@ static int sifive_serial_startup(structstatic void sifive_serial_shutdown (struct uart_port *port) {struct sifive_serial_port *ssp =port_to_sifive_serial_port (port); +unsigned long flags; +uart_port_lock_irqsave (&ssp->port, &flags);__ssp_disable_rxwm (ssp);__ssp_disable_txwm (ssp); +uart_port_unlock_irqrestore (&ssp->port, flags); }/**
Greg Kroah-Hartman
maintainerPATCH 133/280 USB: serial: ftdi_sio: add support for Abacus Electrics Optical Probe
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ehrenreich <[email protected]>
commit b399078f882b6e5d32da18b6c696cc84b12f90d5 upstream.
Abacus Electrics makes optical probes for interacting with smart meters over an optical interface.
At least one version uses an FT232B chip (as detected by ftdi_sio) with a custom USB PID, which needs to be added to the list to make the device work in a plug-and-play fashion.
--- drivers/usb/serial/ftdi_sio.c | 2 ++ drivers/usb/serial/ftdi_sio_ids.h | 5 +++++ 2 files changed, 7 insertions(+)
drivers/usb/serial/ftdi_sio.c +2 -0
@@ -1093,6 +1093,8 @@ static const struct usb_device_id id_tab { USB_DEVICE_INTERFACE_NUMBER(ALTERA_VID, ALTERA_UB3_602E_PID, 1) }, { USB_DEVICE_INTERFACE_NUMBER(ALTERA_VID, ALTERA_UB3_602E_PID, 2) }, { USB_DEVICE_INTERFACE_NUMBER(ALTERA_VID, ALTERA_UB3_602E_PID, 3) }, +/* Abacus Electrics */ + { USB_DEVICE(FTDI_VID, ABACUS_OPTICAL_PROBE_PID) }, { } /* Terminating entry */ };
drivers/usb/serial/ftdi_sio_ids.h +5 -0
@@ -443,6 +443,11 @@#define LINX_FUTURE_2_PID 0xF44C/* Linx future device */ /* +* Abacus Electrics +*/ +#define ABACUS_OPTICAL_PROBE_PID 0xf458/* ABACUS ELECTRICS Optical Probe */ + +/* * Oceanic product ids */ #define FTDI_OCEANIC_PID 0xF460/* Oceanic dive instrument */
Greg Kroah-Hartman
maintainerPATCH 134/280 USB: serial: option: add Sierra Wireless EM9291
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adam Xue <[email protected]>
commit 968e1cbb1f6293c3add9607f80b5ce3d29f57583 upstream.
Add Sierra Wireless EM9291.
Interface 0: MBIM control
1: MBIM data
3: AT port
4: Diagnostic port
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1199 ProdID=90e3 Rev=00.06 S: Manufacturer=Sierra Wireless, Incorporated S: Product=Sierra Wireless EM9291 S: SerialNumber=xxxxxxxxxxxxxxxx C: #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim E: Ad=81(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim E: Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=(none) E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=(none) E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/serial/option.c +3 -0
@@ -611,6 +611,7 @@ static void option_instat_callback(struc/* Sierra Wireless products */ #define SIERRA_VENDOR_ID 0x1199#define SIERRA_PRODUCT_EM9191 0x90d3 +#define SIERRA_PRODUCT_EM9291 0x90e3/* UNISOC (Spreadtrum) products */ #define UNISOC_VENDOR_ID 0x1782
@@ -2432,6 +2433,8 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0xff, 0x30) }, { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0xff, 0x40) }, { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9291, 0xff, 0xff, 0x30) }, + { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9291, 0xff, 0xff, 0x40) }, { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, TOZED_PRODUCT_LT70C, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, LUAT_PRODUCT_AIR720U, 0xff, 0, 0) }, { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0530, 0xff), /* TCL IK512 MBIM */
Greg Kroah-Hartman
maintainerPATCH 135/280 USB: serial: simple: add OWON HDS200 series oscilloscope support
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Craig Hesling <[email protected]>
commit 4cc01410e1c1dd075df10f750775c81d1cb6672b upstream.
Add serial support for OWON HDS200 series oscilloscopes and likely many other pieces of OWON test equipment.
OWON HDS200 series devices host two USB endpoints, designed to facilitate bidirectional SCPI. SCPI is a predominately ASCII text protocol for test/measurement equipment. Having a serial/tty interface for these devices lowers the barrier to entry for anyone trying to write programs to communicate with them.
The following shows the USB descriptor for the OWON HDS272S running firmware V5.7.1:
Bus 001 Device 068: ID 5345:1234 Owon PDS6062T Oscilloscope Negotiated speed: Full Speed (12Mbps)
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 [unknown] bDeviceSubClass 0 [unknown] bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x5345 Owon idProduct 0x1234 PDS6062T Oscilloscope bcdDevice 1.00 iManufacturer 1 oscilloscope iProduct 2 oscilloscope iSerial 3 oscilloscope bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0029
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 5 Physical Interface Device
bInterfaceSubClass 0 [unknown]
bInterfaceProtocol 0
iInterface 0
** UNRECOGNIZED: 09 21 11 01 00 01 22 5f 00 Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 32
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 32
Device Status: 0x0000
(Bus Powered)
OWON appears to be using the same USB Vendor and Product ID for many of their oscilloscopes. Looking at the discussion about the USB vendor/product ID, in the link bellow, suggests that this VID/PID is shared with VDS, SDS, PDS, and now the HDS series oscilloscopes. Available documentation for these devices seems to indicate that all use a similar SCPI protocol, some with RS232 options. It is likely that this same simple serial setup would work correctly for them all.
--- drivers/usb/serial/usb-serial-simple.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/serial/usb-serial-simple.c +7 -0
@@ -100,6 +100,11 @@ DEVICE(nokia, NOKIA_IDS); { USB_DEVICE(0x09d7, 0x0100) } /* NovAtel FlexPack GPS */DEVICE_N (novatel_gps,NOVATEL_IDS ,3 ); +/* OWON electronic test and measurement equipment driver */ +#define OWON_IDS () \ + { USB_DEVICE(0x5345, 0x1234) }/* HDS200 oscilloscopes and others */ +DEVICE (owon,OWON_IDS ); +/* Siemens USB/MPI adapter */ #define SIEMENS_IDS () \ { USB_DEVICE(0x908, 0x0004) }
@@ -134,6 +139,7 @@ static struct usb_serial_driver * const &motorola_tetra_device, &nokia_device, &novatel_gps_device, + &owon_device, &siemens_mpi_device, &suunto_device, &vivopay_device,
@@ -153,6 +159,7 @@ static const struct usb_device_id id_tabMOTOROLA_TETRA_IDS (),NOKIA_IDS (),NOVATEL_IDS (), +OWON_IDS (),SIEMENS_IDS (),SUUNTO_IDS (), VIVOPAY_IDS(),
Greg Kroah-Hartman
maintainerPATCH 136/280 xhci: Limit time spent with xHC interrupts disabled during bus resume
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit bea5892d0ed274e03655223d1977cf59f9aff2f2 upstream.
Current xhci bus resume implementation prevents xHC host from generating interrupts during high-speed USB 2 and super-speed USB 3 bus resume.
Only reason to disable interrupts during bus resume would be to prevent the interrupt handler from interfering with the resume process of USB 2 ports.
Host initiated resume of USB 2 ports is done in two stages.
The xhci driver first transitions the port from 'U3' to 'Resume' state, then wait in Resume for 20ms, and finally moves port to U0 state. xhci driver can't prevent interrupts by keeping the xhci spinlock due to this 20ms sleep.
Limit interrupt disabling to the USB 2 port resume case only. resuming USB 2 ports in bus resume is only done in special cases where USB 2 ports had to be forced to suspend during bus suspend.
The current way of preventing interrupts by clearing the 'Interrupt Enable' (INTE) bit in USBCMD register won't prevent the Interrupter registers 'Interrupt Pending' (IP), 'Event Handler Busy' (EHB) and USBSTS register Event Interrupt (EINT) bits from being set.
New interrupts can't be issued before those bits are properly clered.
Disable interrupts by clearing the interrupter register 'Interrupt Enable' (IE) bit instead. This way IP, EHB and INTE won't be set before IE is enabled again and a new interrupt is triggered.
--- drivers/usb/host/xhci-hub.c | 30 ++++++++++++++++-------------- drivers/usb/host/xhci.c | 4 ++-- drivers/usb/host/xhci.h | 2 ++ 3 files changed, 20 insertions(+), 16 deletions(-)
drivers/usb/host/xhci-hub.c +16 -14
@@ -1878,9 +1878,10 @@ int xhci_bus_resume(struct usb_hcd *hcd)int max_ports, port_index;int sret;u32 next_state; -u32 temp, portsc; +u32 portsc;struct xhci_hub *rhub;struct xhci_port **ports; +bool disabled_irq = false; rhub =xhci_get_rhub (hcd); ports = rhub->ports;
@@ -1896,17 +1897,20 @@ int xhci_bus_resume(struct usb_hcd *hcd)return -ESHUTDOWN ; } -/* delay the irqs */ - temp =readl (&xhci->op_regs->command); - temp &= ~CMD_EIE ; -writel (temp, &xhci->op_regs->command); -/* bus specific resume for ports we suspended at bus_suspend */ -if (hcd->speed >=HCD_USB3 ) +if (hcd->speed >=HCD_USB3 ) { next_state =XDEV_U0 ; -else + }else { next_state =XDEV_RESUME ; - +if (bus_state->bus_suspended) { +/* +* prevent port event interrupts from interfering +* with usb2 port resume process +*/ +xhci_disable_interrupter (xhci->interrupters[0 ]); + disabled_irq = true; + } + } port_index = max_ports;while (port_index--) { portsc =readl (ports[port_index]->addr);
@@ -1974,11 +1978,9 @@ int xhci_bus_resume(struct usb_hcd *hcd) (void )readl (&xhci->op_regs->command); bus_state->next_statechange = jiffies +msecs_to_jiffies (5 ); -/* re-enable irqs */ - temp =readl (&xhci->op_regs->command); - temp |=CMD_EIE ; -writel (temp, &xhci->op_regs->command); - temp =readl (&xhci->op_regs->command); +/* re-enable interrupter */ +if (disabled_irq) +xhci_enable_interrupter (xhci->interrupters[0 ]);spin_unlock_irqrestore (&xhci->lock, flags);return 0 ;
drivers/usb/host/xhci.c +2 -2
@@ -321,7 +321,7 @@ static void xhci_zero_64b_regs(struct xhxhci_info (xhci,"Fault detected\n" ); } -static int xhci_enable_interrupter (struct xhci_interrupter *ir) +int xhci_enable_interrupter (struct xhci_interrupter *ir) {u32 iman;
@@ -334,7 +334,7 @@ static int xhci_enable_interrupter(strucreturn 0 ; } -static int xhci_disable_interrupter (struct xhci_interrupter *ir) +int xhci_disable_interrupter (struct xhci_interrupter *ir) {u32 iman;
drivers/usb/host/xhci.h +2 -0
@@ -1881,6 +1881,8 @@ int xhci_alloc_tt_info(struct xhci_hcd * struct usb_tt *tt, gfp_t mem_flags);int xhci_set_interrupter_moderation (struct xhci_interrupter *ir,u32 imod_interval); +int xhci_enable_interrupter (struct xhci_interrupter *ir); +int xhci_disable_interrupter (struct xhci_interrupter *ir);/* xHCI ring, segment, TRB, and TD functions */ dma_addr_t xhci_trb_virt_to_dma (struct xhci_segment *seg,union xhci_trb *trb);
Greg Kroah-Hartman
maintainerPATCH 137/280 usb: xhci: Fix invalid pointer dereference in Etron workaround
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pecio <[email protected]>
commit 1ea050da5562af9b930d17cbbe9632d30f5df43a upstream.
This check is performed before prepare_transfer() and prepare_ring(), so enqueue can already point at the final link TRB of a segment. And indeed it will, some 0.4% of times this code is called.
Then enqueue + 1 is an invalid pointer. It will crash the kernel right away or load some junk which may look like a link TRB and cause the real link TRB to be replaced with a NOOP. This wouldn't end well.
Use a functionally equivalent test which doesn't dereference the pointer and always gives correct result.
Something has crashed my machine twice in recent days while playing with an Etron HC, and a control transfer stress test ran for confirmation has just crashed it again. The same test passes with this patch applied.
--- drivers/usb/host/xhci-ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-ring.c +1 -1
@@ -3778,7 +3778,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd ** enqueue a No Op TRB, this can prevent the Setup and Data Stage * TRB to be breaked by the Link TRB. */ -if (trb_is_link (ep_ring->enqueue +1 )) { +if (last_trb_on_seg (ep_ring->enq_seg, ep_ring->enqueue +1 )) { field =TRB_TYPE (TRB_TR_NOOP ) | ep_ring->cycle_state;queue_trb (xhci, ep_ring, false,0 ,0 ,TRB_INTR_TARGET (0 ), field);
Greg Kroah-Hartman
maintainerPATCH 138/280 usb: cdns3: Fix deadlock when using NCM gadget
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ralph Siemsen <[email protected]>
commit a1059896f2bfdcebcdc7153c3be2307ea319501f upstream.
The cdns3 driver has the same NCM deadlock as fixed in cdnsp by commit 58f2fcb3a845 ("usb: cdnsp: Fix deadlock issue during using NCM gadget").
Under PREEMPT_RT the deadlock can be readily triggered by heavy network traffic, for example using "iperf --bidir" over NCM ethernet link.
The deadlock occurs because the threaded interrupt handler gets preempted by a softirq, but both are protected by the same spinlock. Prevent deadlock by disabling softirq during threaded irq handler.
--- drivers/usb/cdns3/cdns3-gadget.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/cdns3/cdns3-gadget.c +2 -0
@@ -1963,6 +1963,7 @@ static irqreturn_t cdns3_device_thread_iunsigned int bit;unsigned long reg; +local_bh_disable ();spin_lock_irqsave (&priv_dev->lock, flags); reg =readl (&priv_dev->regs->usb_ists);
@@ -2004,6 +2005,7 @@ static irqreturn_t cdns3_device_thread_i irqend:writel (~0 , &priv_dev->regs->ep_ien);spin_unlock_irqrestore (&priv_dev->lock, flags); +local_bh_enable ();return ret; }
Greg Kroah-Hartman
maintainerPATCH 139/280 usb: chipidea: ci_hdrc_imx: fix usbmisc handling
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
commit 4e28f79e3dffa52d327b46d1a78dac16efb5810b upstream.
usbmisc is an optional device property so it is totally valid for the corresponding data->usbmisc_data to have a NULL value.
Check that before dereferencing the pointer.
Found by Linux Verification Center (linuxtesting.org) with Svace static analysis tool.
--- drivers/usb/chipidea/ci_hdrc_imx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/chipidea/ci_hdrc_imx.c +4 -2
@@ -534,7 +534,8 @@ disable_hsic_regulator:cpu_latency_qos_remove_request (&data->pm_qos_req); data->ci_pdev =NULL ; err_put: -put_device (data->usbmisc_data->dev); +if (data->usbmisc_data) +put_device (data->usbmisc_data->dev);return ret; }
@@ -559,7 +560,8 @@ static void ci_hdrc_imx_remove(struct plif (data->hsic_pad_regulator)regulator_disable (data->hsic_pad_regulator); } -put_device (data->usbmisc_data->dev); +if (data->usbmisc_data) +put_device (data->usbmisc_data->dev); }static void ci_hdrc_imx_shutdown (struct platform_device *pdev)
Greg Kroah-Hartman
maintainerPATCH 140/280 usb: chipidea: ci_hdrc_imx: fix call balance of regulator routines
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
commit 8cab0e9a3f3e8d700179e0d6141643d54a267fd5 upstream.
Upon encountering errors during the HSIC pinctrl handling section the regulator should be disabled.
Use devm_add_action_or_reset() to let the regulator-disabling routine be handled by device resource management stack.
Found by Linux Verification Center (linuxtesting.org).
--- drivers/usb/chipidea/ci_hdrc_imx.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
drivers/usb/chipidea/ci_hdrc_imx.c +17 -8
@@ -336,6 +336,13 @@ static int ci_hdrc_imx_notify_event(strureturn ret; } +static void ci_hdrc_imx_disable_regulator (void *arg) +{ +struct ci_hdrc_imx_data *data = arg; + +regulator_disable (data->hsic_pad_regulator); +} +static int ci_hdrc_imx_probe (struct platform_device *pdev) {struct ci_hdrc_imx_data *data;
@@ -394,6 +401,13 @@ static int ci_hdrc_imx_probe(struct plat "Failed to enable HSIC pad regulator\n"); goto err_put; } + ret =devm_add_action_or_reset (dev, + ci_hdrc_imx_disable_regulator, data); +if (ret) { +dev_err (dev, +"Failed to add regulator devm action\n" ); + goto err_put; + } } }
@@ -432,11 +446,11 @@ static int ci_hdrc_imx_probe(struct plat ret =imx_get_clks (dev);if (ret) - goto disable_hsic_regulator; + goto qos_remove_request; ret =imx_prepare_enable_clks (dev);if (ret) - goto disable_hsic_regulator; + goto qos_remove_request; ret =clk_prepare_enable (data->clk_wakeup);if (ret)
@@ -526,10 +540,7 @@ err_clk:clk_disable_unprepare (data->clk_wakeup); err_wakeup_clk:imx_disable_unprepare_clks (dev); -disable_hsic_regulator: -if (data->hsic_pad_regulator) -/* don't overwrite original ret (cf. EPROBE_DEFER) */ -regulator_disable (data->hsic_pad_regulator); +qos_remove_request:if (pdata.flags &CI_HDRC_PMQOS )cpu_latency_qos_remove_request (&data->pm_qos_req); data->ci_pdev =NULL ;
@@ -557,8 +568,6 @@ static void ci_hdrc_imx_remove(struct plclk_disable_unprepare (data->clk_wakeup);if (data->plat_data->flags &CI_HDRC_PMQOS )cpu_latency_qos_remove_request (&data->pm_qos_req); -if (data->hsic_pad_regulator) -regulator_disable (data->hsic_pad_regulator); }if (data->usbmisc_data)put_device (data->usbmisc_data->dev);
Greg Kroah-Hartman
maintainerPATCH 141/280 usb: chipidea: ci_hdrc_imx: implement usb_phy_init() error handling
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
commit 8c531e0a8c2d82509ad97c6d3a1e6217c7ed136d upstream.
usb_phy_init() may return an error code if e.g. its implementation fails to prepare/enable some clocks. And properly rollback on probe error path by calling the counterpart usb_phy_shutdown().
Found by Linux Verification Center (linuxtesting.org).
--- drivers/usb/chipidea/ci_hdrc_imx.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/usb/chipidea/ci_hdrc_imx.c +10 -3
@@ -484,7 +484,11 @@ static int ci_hdrc_imx_probe(struct plat of_usb_get_phy_mode(np) == USBPHY_INTERFACE_MODE_ULPI) { pdata.flags |=CI_HDRC_OVERRIDE_PHY_CONTROL ; data->override_phy_control = true; -usb_phy_init (pdata.usb_phy); + ret =usb_phy_init (pdata.usb_phy); +if (ret) { +dev_err (dev,"Failed to init phy\n" ); + goto err_clk; + } }if (pdata.flags &CI_HDRC_SUPPORTS_RUNTIME_PM )
@@ -493,7 +497,7 @@ static int ci_hdrc_imx_probe(struct plat ret =imx_usbmisc_init (data->usbmisc_data);if (ret) {dev_err (dev,"usbmisc init failed, ret=%d\n" , ret); - goto err_clk; + goto phy_shutdown; } data->ci_pdev = ci_hdrc_add_device(dev,
@@ -502,7 +506,7 @@ static int ci_hdrc_imx_probe(struct platif (IS_ERR (data->ci_pdev)) { ret =PTR_ERR (data->ci_pdev);dev_err_probe (dev, ret,"ci_hdrc_add_device failed\n" ); - goto err_clk; + goto phy_shutdown; }if (data->usbmisc_data) {
@@ -536,6 +540,9 @@ static int ci_hdrc_imx_probe(struct plat disable_device:ci_hdrc_remove_device (data->ci_pdev); +phy_shutdown: +if (data->override_phy_control) +usb_phy_shutdown (data->phy); err_clk:clk_disable_unprepare (data->clk_wakeup); err_wakeup_clk:
Greg Kroah-Hartman
maintainerPATCH 142/280 USB: OHCI: Add quirk for LS7A OHCI controller (rev 0x02)
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit bcb60d438547355b8f9ad48645909139b64d3482 upstream.
The OHCI controller (rev 0x02) under LS7A PCI host has a hardware flaw. MMIO register with offset 0x60/0x64 is treated as legacy PS2-compatible keyboard/mouse interface, which confuse the OHCI controller. Since OHCI only use a 4KB BAR resource indeed, the LS7A OHCI controller's 32KB BAR is wrapped around (the second 4KB BAR space is the same as the first 4KB internally). So we can add an 4KB offset (0x1000) to the OHCI registers (from the PCI BAR resource) as a quirk.
--- drivers/usb/host/ohci-pci.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/usb/host/ohci-pci.c +23 -0
@@ -165,6 +165,25 @@ static int ohci_quirk_amd700(struct usb_return 0 ; } +static int ohci_quirk_loongson (struct usb_hcd *hcd) +{ +struct pci_dev *pdev =to_pci_dev (hcd->self.controller); + +/* +* Loongson's LS7A OHCI controller (rev 0x02) has a +* flaw. MMIO register with offset 0x60/64 is treated +* as legacy PS2-compatible keyboard/mouse interface. +* Since OHCI only use 4KB BAR resource, LS7A OHCI's +* 32KB BAR is wrapped around (the 2nd 4KB BAR space +* is the same as the 1st 4KB internally). So add 4KB +* offset (0x1000) to the OHCI registers as a quirk. +*/ +if (pdev->revision ==0x2 ) + hcd->regs +=SZ_4K ;/* SZ_4K = 0x1000 */ + +return 0 ; +} +static int ohci_quirk_qemu (struct usb_hcd *hcd) {struct ohci_hcd *ohci =hcd_to_ohci (hcd);
@@ -225,6 +244,10 @@ static const struct pci_device_id ohci_p .driver_data = (unsigned long)ohci_quirk_amd700, }, { + PCI_DEVICE(PCI_VENDOR_ID_LOONGSON, 0x7a24), + .driver_data = (unsigned long)ohci_quirk_loongson, + }, + { .vendor = PCI_VENDOR_ID_APPLE, .device = 0x003f, .subvendor = PCI_SUBVENDOR_ID_REDHAT_QUMRANET,
Greg Kroah-Hartman
maintainerPATCH 143/280 usb: dwc3: gadget: check that event count does not exceed event buffer length
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frode Isaksen <[email protected]>
commit 63ccd26cd1f6600421795f6ca3e625076be06c9f upstream.
The event count is read from register DWC3_GEVNTCOUNT. There is a check for the count being zero, but not for exceeding the event buffer length.
Check that event count does not exceed event buffer length, avoiding an out-of-bounds access when memcpy'ing the event. Crash log:
Unable to handle kernel paging request at virtual address ffffffc0129be000 pc : __memcpy+0x114/0x180 lr : dwc3_check_event_buf+0xec/0x348 x3 : 0000000000000030 x2 : 000000000000dfc4 x1 : ffffffc0129be000 x0 : ffffff87aad60080 Call trace: __memcpy+0x114/0x180 dwc3_interrupt+0x24/0x34
--- drivers/usb/dwc3/gadget.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/dwc3/gadget.c +6 -0
@@ -4570,6 +4570,12 @@ static irqreturn_t dwc3_check_event_buf(if (!count)return IRQ_NONE ; +if (count > evt->length) { +dev_err_ratelimited (dwc->dev,"invalid count(%u) > evt->length(%u)\n" , + count, evt->length); +return IRQ_NONE ; + } + evt->count = count; evt->flags |=DWC3_EVENT_PENDING ;
Greg Kroah-Hartman
maintainerPATCH 144/280 usb: dwc3: xilinx: Prevent spike in reset signal
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Looijmans <[email protected]>
commit 38d6e60b6f3a99f8f13bee22eab616136c2c0675 upstream.
The "reset" GPIO controls the RESET signal to an external, usually ULPI PHY, chip. The original code path acquires the signal in LOW state, and then immediately asserts it HIGH again, if the reset signal defaulted to asserted, there'd be a short "spike" before the reset.
Here is what happens depending on the pre-existing state of the reset signal:
Reset (previously asserted): ~~~|_|~~~~|_______ Reset (previously deasserted): _____|~~~~|_______
^ ^ ^
A B C
At point A, the low going transition is because the reset line is requested using GPIOD_OUT_LOW. If the line is successfully requested, the first thing we do is set it high _without_ any delay. This is point B. So, a glitch occurs between A and B.
Requesting the line using GPIOD_OUT_HIGH eliminates the A and B transitions. Instead we get:
Reset (previously asserted) : ~~~~~~~~~~|______
Reset (previously deasserted): ____|~~~~~|______
^ ^
A CWhere A and C are the points described above in the code. Point B has been eliminated.
The issue was found during code inspection.
Also remove the cryptic "toggle ulpi .." comment.
--- drivers/usb/dwc3/dwc3-xilinx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/usb/dwc3/dwc3-xilinx.c +1 -3
@@ -207,15 +207,13 @@ static int dwc3_xlnx_init_zynqmp(struct skip_usb3_phy:/* ulpi reset via gpio-modepin or gpio-framework driver */ - reset_gpio =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_LOW ); + reset_gpio =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_HIGH );if (IS_ERR (reset_gpio)) {return dev_err_probe (dev,PTR_ERR (reset_gpio),"Failed to request reset GPIO\n" ); }if (reset_gpio) { -/* Toggle ulpi to reset the phy. */ -gpiod_set_value_cansleep (reset_gpio,1 );usleep_range (5000 ,10000 );gpiod_set_value_cansleep (reset_gpio,0 );usleep_range (5000 ,10000 );
Greg Kroah-Hartman
maintainerPATCH 145/280 usb: quirks: add DELAY_INIT quirk for Silicon Motion Flash Drive
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miao Li <[email protected]>
commit 2932b6b547ec36ad2ed60fbf2117c0e46bb7d40a upstream.
Silicon Motion Flash Drive connects to Huawei hisi platforms and performs a system reboot test for two thousand circles, it will randomly work incorrectly on boot, set DELAY_INIT quirk can workaround this issue.
--- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -383,6 +383,9 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x0904, 0x6103), .driver_info = USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL }, + /* Silicon Motion Flash Drive */ + { USB_DEVICE(0x090c, 0x1000), .driver_info = USB_QUIRK_DELAY_INIT }, + /* Sound Devices USBPre2 */ { USB_DEVICE(0x0926, 0x0202), .driver_info = USB_QUIRK_ENDPOINT_IGNORE },
Greg Kroah-Hartman
maintainerPATCH 146/280 usb: quirks: Add delay init quirk for SanDisk 3.2Gen1 Flash Drive
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miao Li <[email protected]>
commit 37ffdbd695c02189dbf23d6e7d2385e0299587ca upstream.
The SanDisk 3.2Gen1 Flash Drive, which VID:PID is in 0781:55a3, just like Silicon Motion Flash Drive:
https://lore.kernel.org/r/[email protected]
also needs the DELAY_INIT quirk, or it will randomly work incorrectly (e.g.: lsusb and can't list this device info) when connecting Huawei hisi platforms and doing thousand of reboot test circles.
--- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -369,6 +369,9 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x0781, 0x5583), .driver_info = USB_QUIRK_NO_LPM }, { USB_DEVICE(0x0781, 0x5591), .driver_info = USB_QUIRK_NO_LPM }, + /* SanDisk Corp. SanDisk 3.2Gen1 */ + { USB_DEVICE(0x0781, 0x55a3), .driver_info = USB_QUIRK_DELAY_INIT }, + /* Realforce 87U Keyboard */ { USB_DEVICE(0x0853, 0x011b), .driver_info = USB_QUIRK_NO_LPM },
Greg Kroah-Hartman
maintainerPATCH 147/280 USB: VLI disk crashes if LPM is used
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit e00b39a4f3552c730f1e24c8d62c4a8c6aad4e5d upstream.
This device needs the NO_LPM quirk.
--- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -542,6 +542,9 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x2040, 0x7200), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, + /* VLI disk */ + { USB_DEVICE(0x2109, 0x0711), .driver_info = USB_QUIRK_NO_LPM }, + /* Raydium Touchscreen */ { USB_DEVICE(0x2386, 0x3114), .driver_info = USB_QUIRK_NO_LPM },
Greg Kroah-Hartman
maintainerPATCH 148/280 USB: wdm: handle IO errors in wdm_wwan_port_start
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit 9697f5efcf5fdea65b8390b5eb81bebe746ceedc upstream.
In case submitting the URB fails we must undo
what we've done so far.
--- drivers/usb/class/cdc-wdm.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/usb/class/cdc-wdm.c +10 -1
@@ -829,6 +829,7 @@ static struct usb_class_driver wdm_classstatic int wdm_wwan_port_start (struct wwan_port *port) {struct wdm_device *desc =wwan_port_get_drvdata (port); +int rv;/* The interface is both exposed via the WWAN framework and as a * legacy usbmisc chardev. If chardev is already open, just fail
@@ -848,7 +849,15 @@ static int wdm_wwan_port_start(struct wwwwan_port_txon (port);/* Start getting events */ -return usb_submit_urb (desc->validity,GFP_KERNEL ); + rv =usb_submit_urb (desc->validity,GFP_KERNEL ); +if (rv <0 ) { +wwan_port_txoff (port); + desc->manage_power (desc->intf,0 ); +/* this must be last lest we race with chardev open */ +clear_bit (WDM_WWAN_IN_USE , &desc->flags); + } + +return rv; }static void wdm_wwan_port_stop (struct wwan_port *port)
Greg Kroah-Hartman
maintainerPATCH 149/280 USB: wdm: close race between wdm_open and wdm_wwan_port_stop
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit c1846ed4eb527bdfe6b3b7dd2c78e2af4bf98f4f upstream.
Clearing WDM_WWAN_IN_USE must be the last action or we can open a chardev whose URBs are still poisoned
--- drivers/usb/class/cdc-wdm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/class/cdc-wdm.c +4 -2
@@ -726,7 +726,7 @@ static int wdm_open(struct inode *inode, rv = -EBUSY ; goto out; } - +smp_rmb ();/* ordered against wdm_wwan_port_stop() */ rv =usb_autopm_get_interface (desc->intf);if (rv <0 ) {dev_err (&desc->intf->dev,"Error autopm - %d\n" , rv);
@@ -868,8 +868,10 @@ static void wdm_wwan_port_stop(struct wwpoison_urbs (desc); desc->manage_power (desc->intf,0 );clear_bit (WDM_READ , &desc->flags); -clear_bit (WDM_WWAN_IN_USE , &desc->flags);unpoison_urbs (desc); +smp_wmb ();/* ordered against wdm_open() */ +/* this must be last lest we open a poisoned device */ +clear_bit (WDM_WWAN_IN_USE , &desc->flags); }static void wdm_wwan_port_tx_complete (struct urb *urb)
Greg Kroah-Hartman
maintainerPATCH 150/280 USB: wdm: wdm_wwan_port_tx_complete mutex in atomic context
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit 1fdc4dca350c0b8ada0b8ebf212504e1ad55e511 upstream.
wdm_wwan_port_tx_complete is called from a completion handler with irqs disabled and possible in IRQ context usb_autopm_put_interface can take a mutex. Hence usb_autopm_put_interface_async must be used.
--- drivers/usb/class/cdc-wdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/class/cdc-wdm.c +1 -1
@@ -879,7 +879,7 @@ static void wdm_wwan_port_tx_complete(ststruct sk_buff *skb = urb->context;struct wdm_device *desc =skb_shinfo (skb)->destructor_arg; -usb_autopm_put_interface (desc->intf); +usb_autopm_put_interface_async (desc->intf);wwan_port_txon (desc->wwanp);kfree_skb (skb); }
Greg Kroah-Hartman
maintainerPATCH 151/280 USB: wdm: add annotation
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit 73e9cc1ffd3650b12c4eb059dfdafd56e725ceda upstream.
This is not understandable without a comment on endianness
--- drivers/usb/class/cdc-wdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/class/cdc-wdm.c +1 -1
@@ -909,7 +909,7 @@ static int wdm_wwan_port_tx(struct wwan_ req->bRequestType = (USB_DIR_OUT |USB_TYPE_CLASS |USB_RECIP_INTERFACE ); req->bRequest =USB_CDC_SEND_ENCAPSULATED_COMMAND ; req->wValue =0 ; - req->wIndex = desc->inum; + req->wIndex = desc->inum;/* already converted */ req->wLength =cpu_to_le16 (skb->len);skb_shinfo (skb)->destructor_arg = desc;
Greg Kroah-Hartman
maintainerPATCH 152/280 selftests/bpf: Fix stdout race condition in traffic monitor
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amery Hung <[email protected]>
[ Upstream commit b99f27e90268b1a814c13f8bd72ea1db448ea257 ]
Fix a race condition between the main test_progs thread and the traffic monitoring thread. The traffic monitor thread tries to print a line using multiple printf and use flockfile() to prevent the line from being torn apart. Meanwhile, the main thread doing io redirection can reassign or close stdout when going through tests. A deadlock as shown below can happen.
main traffic_monitor_thread
==== ======================
show_transport()
-> flockfile(stdout)stdio_hijack_init()
-> stdout = open_memstream(log_buf, log_cnt);
...
env.subtest_state->stdout_saved = stdout;
...
funlockfile(stdout)stdio_restore_cleanup()
-> fclose(env.subtest_state->stdout_saved);
After the traffic monitor thread lock stdout, A new memstream can be assigned to stdout by the main thread. Therefore, the traffic monitor thread later will not be able to unlock the original stdout. As the main thread tries to access the old stdout, it will hang indefinitely as it is still locked by the traffic monitor thread.
The deadlock can be reproduced by running test_progs repeatedly with traffic monitor enabled:
for ((i=1;i<=100;i++)); do
./test_progs -a flow_dissector_skb* -m '*'
done
Fix this by only calling printf once and remove flockfile()/funlockfile().
--- tools/testing/selftests/bpf/network_helpers.c | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-)
tools/testing/selftests/bpf/network_helpers.c +13 -20
@@ -771,12 +771,13 @@ static const char *pkt_type_str(u16 pkt_type)return "Unknown" ; } +#define MAX_FLAGS_STRLEN 21/* Show the information of the transport layer in the packet */ static void show_transport (const u_char *packet,u16 len,u32 ifindex,const char *src_addr,const char *dst_addr,u16 proto,bool ipv6,u8 pkt_type) { -char *ifname, _ifname[IF_NAMESIZE ]; +char *ifname, _ifname[IF_NAMESIZE ], flags[MAX_FLAGS_STRLEN ] ="" ;const char *transport_str;u16 src_port, dst_port;struct udphdr *udp;
@@ -817,29 +818,21 @@ static void show_transport(const u_char *packet, u16 len, u32 ifindex,/* TCP or UDP*/ -flockfile (stdout); +if (proto ==IPPROTO_TCP ) +snprintf (flags,MAX_FLAGS_STRLEN ,"%s%s%s%s" , + tcp->fin ?", FIN" :"" , + tcp->syn ?", SYN" :"" , + tcp->rst ?", RST" :"" , + tcp->ack ?", ACK" :"" ); +if (ipv6) -printf ("%-7s %-3s IPv6 %s.%d > %s.%d: %s, length %d" , +printf ("%-7s %-3s IPv6 %s.%d > %s.%d: %s, length %d%s\n" , ifname,pkt_type_str (pkt_type), src_addr, src_port, - dst_addr, dst_port, transport_str, len); + dst_addr, dst_port, transport_str, len, flags);else -printf ("%-7s %-3s IPv4 %s:%d > %s:%d: %s, length %d" , +printf ("%-7s %-3s IPv4 %s:%d > %s:%d: %s, length %d%s\n" , ifname,pkt_type_str (pkt_type), src_addr, src_port, - dst_addr, dst_port, transport_str, len); - -if (proto ==IPPROTO_TCP ) { -if (tcp->fin) -printf (", FIN" ); -if (tcp->syn) -printf (", SYN" ); -if (tcp->rst) -printf (", RST" ); -if (tcp->ack) -printf (", ACK" ); - } - -printf ("\n" ); -funlockfile (stdout); + dst_addr, dst_port, transport_str, len, flags); }static void show_ipv6_packet (const u_char *packet,u32 ifindex,u8 pkt_type)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 153/280 pinctrl: renesas: rza2: Fix potential NULL pointer dereference
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenyuan Yang <[email protected]>
[ Upstream commit f752ee5b5b86b5f88a5687c9eb0ef9b39859b908 ]
chip.label in rza2_gpio_register() could be NULL. Add the missing check.
--- drivers/pinctrl/renesas/pinctrl-rza2.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/pinctrl/renesas/pinctrl-rza2.c +3 -0
@@ -243,6 +243,9 @@ static int rza2_gpio_register(struct rza2_pinctrl_priv *priv)int ret; chip.label =devm_kasprintf (priv->dev,GFP_KERNEL ,"%pOFn" , np); +if (!chip.label) +return -ENOMEM ; + chip.parent = priv->dev; chip.ngpio = priv->npins;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 154/280 pinctrl: mcp23s08: Get rid of spurious level interrupts
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Mastykin <[email protected]>
[ Upstream commit 7b0671b97f0872d6950ccc925e210cb3f67721bf ]
irq_mask()/irq_unmask() are not called for nested interrupts. So level interrupts are never masked, chip's interrupt output is not cleared on INTCAP or GPIO read, the irq handler is uselessly called again. Nested irq handler is not called again, because interrupt reason is cleared by its first call./proc/interrupts shows that number of chip's irqs is greater than number of nested irqs.
This patch adds masking and unmasking level interrupts inside irq handler.
--- drivers/pinctrl/pinctrl-mcp23s08.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-mcp23s08.c +20 -3
@@ -382,6 +382,7 @@ static irqreturn_t mcp23s08_irq(int irq, void *data) {struct mcp23s08 *mcp = data;int intcap, intcon, intf, i, gpio, gpio_orig, intcap_mask, defval, gpinten; +bool need_unmask = false;unsigned long int enabled_interrupts;unsigned int child_irq; bool intf_set, intcap_changed, gpio_bit_changed,
@@ -396,9 +397,6 @@ static irqreturn_t mcp23s08_irq(int irq, void *data) goto unlock; } -if (mcp_read (mcp,MCP_INTCAP , &intcap)) - goto unlock; -if (mcp_read (mcp,MCP_INTCON , &intcon)) goto unlock;
@@ -408,6 +406,16 @@ static irqreturn_t mcp23s08_irq(int irq, void *data)if (mcp_read (mcp,MCP_DEFVAL , &defval)) goto unlock; +/* Mask level interrupts to avoid their immediate reactivation after clearing */ +if (intcon) { + need_unmask = true; +if (mcp_write (mcp,MCP_GPINTEN , gpinten & ~intcon)) + goto unlock; + } + +if (mcp_read (mcp,MCP_INTCAP , &intcap)) + goto unlock; +/* This clears the interrupt(configurable on S18) */ if (mcp_read (mcp,MCP_GPIO , &gpio)) goto unlock;
@@ -470,9 +478,18 @@ static irqreturn_t mcp23s08_irq(int irq, void *data) } } +if (need_unmask) { +mutex_lock (&mcp->lock); + goto unlock; + } +return IRQ_HANDLED ; unlock: +if (need_unmask) +if (mcp_write (mcp,MCP_GPINTEN , gpinten)) +dev_err (mcp->chip.parent,"can't unmask GPINTEN\n" ); +mutex_unlock (&mcp->lock);return IRQ_HANDLED ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 155/280 MIPS: cm: Detect CM quirks from device tree
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory CLEMENT <[email protected]>
[ Upstream commit e27fbe16af5cfc40639de4ced67d1a866a1953e9 ]
Some information that should be retrieved at runtime for the Coherence Manager can be either absent or wrong. This patch allows checking if some of this information is available from the device tree and updates the internal variable accordingly.
For now, only the compatible string associated with the broken HCI is being retrieved.
--- arch/mips/include/asm/mips-cm.h | 22 ++++++++++++++++++++++ arch/mips/kernel/mips-cm.c | 14 ++++++++++++++ 2 files changed, 36 insertions(+)
arch/mips/include/asm/mips-cm.h +22 -0
@@ -59,6 +59,16 @@ extern phys_addr_t mips_cm_l2sync_phys_base(void);*/ extern int mips_cm_is64; +/* +* mips_cm_is_l2_hci_broken - determine if HCI is broken +* +* Some CM reports show that Hardware Cache Initialization is +* complete, but in reality it's not the case. They also incorrectly +* indicate that Hardware Cache Initialization is supported. This +* flags allows warning about this broken feature. +*/ +extern bool mips_cm_is_l2_hci_broken; +/** * mips_cm_error_report - Report CM cache errors */
@@ -97,6 +107,18 @@ static inline bool mips_cm_present(void)#endif } +/** +* mips_cm_update_property - update property from the device tree +* +* Retrieve the properties from the device tree if a CM node exist and +* update the internal variable based on this. +*/ +#ifdef CONFIG_MIPS_CM +extern void mips_cm_update_property (void ); +#else +static void mips_cm_update_property (void ) {} +#endif +/** * mips_cm_has_l2sync - determine whether an L2-only sync region is present *
arch/mips/kernel/mips-cm.c +14 -0
@@ -5,6 +5,7 @@*/ #include <linux/errno.h> +#include <linux/of.h> #include <linux/percpu.h> #include <linux/spinlock.h>
@@ -14,6 +15,7 @@void __iomem *mips_gcr_base;void __iomem *mips_cm_l2sync_base;int mips_cm_is64; +bool mips_cm_is_l2_hci_broken;static char *cm2_tr[8 ] = {"mem" ,"gcr" ,"gic" ,"mmio" ,
@@ -237,6 +239,18 @@ static void mips_cm_probe_l2sync(void) mips_cm_l2sync_base =ioremap (addr,MIPS_CM_L2SYNC_SIZE ); } +void mips_cm_update_property (void ) +{ +struct device_node *cm_node; + + cm_node =of_find_compatible_node (of_root,NULL ,"mobileye,eyeq6-cm" ); +if (!cm_node) +return ; +pr_info ("HCI (Hardware Cache Init for the L2 cache) in GCR_L2_RAM_CONFIG from the CM3 is broken" ); + mips_cm_is_l2_hci_broken = true; +of_node_put (cm_node); +} +int mips_cm_probe (void ) {phys_addr_t addr;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 156/280 crypto: ccp - Add support for PCI device 0x1134
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Devaraj Rangasamy <[email protected]>
[ Upstream commit 6cb345939b8cc4be79909875276aa9dc87d16757 ]
PCI device 0x1134 shares same register features as PCI device 0x17E0. Hence reuse same data for the new PCI device ID 0x1134.
--- drivers/crypto/ccp/sp-pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/ccp/sp-pci.c +1 -0
@@ -532,6 +532,7 @@ static const struct pci_device_id sp_pci_table[] = { { PCI_VDEVICE(AMD, 0x14CA), (kernel_ulong_t)&dev_vdata[5] }, { PCI_VDEVICE(AMD, 0x15C7), (kernel_ulong_t)&dev_vdata[6] }, { PCI_VDEVICE(AMD, 0x1649), (kernel_ulong_t)&dev_vdata[6] }, + { PCI_VDEVICE(AMD, 0x1134), (kernel_ulong_t)&dev_vdata[7] }, { PCI_VDEVICE(AMD, 0x17E0), (kernel_ulong_t)&dev_vdata[7] }, { PCI_VDEVICE(AMD, 0x156E), (kernel_ulong_t)&dev_vdata[8] }, /* Last entry must be zero */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 157/280 crypto: lib/Kconfig - Fix lib built-in failure when arch is modular
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
[ Upstream commit 1047e21aecdf17c8a9ab9fd4bd24c6647453f93d ]
The HAVE_ARCH Kconfig options in lib/crypto try to solve the modular versus built-in problem, but it still fails when the the LIB option (e.g., CRYPTO_LIB_CURVE25519) is selected externally.
Fix this by introducing a level of indirection with ARCH_MAY_HAVE Kconfig options, these then go on to select the ARCH_HAVE options if the ARCH Kconfig options matches that of the LIB option.
--- arch/arm/crypto/Kconfig | 6 +++--- arch/powerpc/crypto/Kconfig | 4 ++-- arch/x86/crypto/Kconfig | 6 +++--- lib/crypto/Kconfig | 26 ++++++++++++++++++-------- 4 files changed, 26 insertions(+), 16 deletions(-)
arch/arm/crypto/Kconfig +3 -3
@@ -6,7 +6,7 @@ config CRYPTO_CURVE25519_NEON tristate "Public key crypto: Curve25519 (NEON)" depends on KERNEL_MODE_NEON select CRYPTO_LIB_CURVE25519_GENERIC - select CRYPTO_ARCH_HAVE_LIB_CURVE25519 + select CRYPTO_ARCH_MAY_HAVE_LIB_CURVE25519 help Curve25519 algorithm
@@ -47,7 +47,7 @@ config CRYPTO_NHPOLY1305_NEON config CRYPTO_POLY1305_ARM tristate "Hash functions: Poly1305 (NEON)" select CRYPTO_HASH - select CRYPTO_ARCH_HAVE_LIB_POLY1305 + select CRYPTO_ARCH_MAY_HAVE_LIB_POLY1305 help Poly1305 authenticator algorithm (RFC7539)
@@ -214,7 +214,7 @@ config CRYPTO_AES_ARM_CE config CRYPTO_CHACHA20_NEON tristate "Ciphers: ChaCha20, XChaCha20, XChaCha12 (NEON)" select CRYPTO_SKCIPHER - select CRYPTO_ARCH_HAVE_LIB_CHACHA + select CRYPTO_ARCH_MAY_HAVE_LIB_CHACHA help Length-preserving ciphers: ChaCha20, XChaCha20, and XChaCha12 stream cipher algorithms
arch/powerpc/crypto/Kconfig +2 -2
@@ -6,7 +6,7 @@ config CRYPTO_CURVE25519_PPC64 tristate "Public key crypto: Curve25519 (PowerPC64)" depends on PPC64 && CPU_LITTLE_ENDIAN select CRYPTO_LIB_CURVE25519_GENERIC - select CRYPTO_ARCH_HAVE_LIB_CURVE25519 + select CRYPTO_ARCH_MAY_HAVE_LIB_CURVE25519 help Curve25519 algorithm
@@ -128,7 +128,7 @@ config CRYPTO_CHACHA20_P10 depends on PPC64 && CPU_LITTLE_ENDIAN && VSX select CRYPTO_SKCIPHER select CRYPTO_LIB_CHACHA_GENERIC - select CRYPTO_ARCH_HAVE_LIB_CHACHA + select CRYPTO_ARCH_MAY_HAVE_LIB_CHACHA help Length-preserving ciphers: ChaCha20, XChaCha20, and XChaCha12 stream cipher algorithms
arch/x86/crypto/Kconfig +3 -3
@@ -6,7 +6,7 @@ config CRYPTO_CURVE25519_X86 tristate "Public key crypto: Curve25519 (ADX)" depends on X86 && 64BIT select CRYPTO_LIB_CURVE25519_GENERIC - select CRYPTO_ARCH_HAVE_LIB_CURVE25519 + select CRYPTO_ARCH_MAY_HAVE_LIB_CURVE25519 help Curve25519 algorithm
@@ -352,7 +352,7 @@ config CRYPTO_CHACHA20_X86_64 depends on X86 && 64BIT select CRYPTO_SKCIPHER select CRYPTO_LIB_CHACHA_GENERIC - select CRYPTO_ARCH_HAVE_LIB_CHACHA + select CRYPTO_ARCH_MAY_HAVE_LIB_CHACHA help Length-preserving ciphers: ChaCha20, XChaCha20, and XChaCha12 stream cipher algorithms
@@ -420,7 +420,7 @@ config CRYPTO_POLY1305_X86_64 tristate "Hash functions: Poly1305 (SSE2/AVX2)" depends on X86 && 64BIT select CRYPTO_LIB_POLY1305_GENERIC - select CRYPTO_ARCH_HAVE_LIB_POLY1305 + select CRYPTO_ARCH_MAY_HAVE_LIB_POLY1305 help Poly1305 authenticator algorithm (RFC7539)
lib/crypto/Kconfig +18 -8
@@ -42,12 +42,17 @@ config CRYPTO_LIB_BLAKE2S_GENERIC of CRYPTO_LIB_BLAKE2S. config CRYPTO_ARCH_HAVE_LIB_CHACHA - tristate + bool help Declares whether the architecture provides an arch-specific accelerated implementation of the ChaCha library interface, either builtin or as a module. +config CRYPTO_ARCH_MAY_HAVE_LIB_CHACHA + tristate + select CRYPTO_ARCH_HAVE_LIB_CHACHA if CRYPTO_LIB_CHACHA=m + select CRYPTO_ARCH_HAVE_LIB_CHACHA if CRYPTO_ARCH_MAY_HAVE_LIB_CHACHA=y + config CRYPTO_LIB_CHACHA_GENERIC tristate select CRYPTO_LIB_UTILS
@@ -60,7 +65,6 @@ config CRYPTO_LIB_CHACHA_GENERIC config CRYPTO_LIB_CHACHA tristate "ChaCha library interface" - depends on CRYPTO_ARCH_HAVE_LIB_CHACHA || !CRYPTO_ARCH_HAVE_LIB_CHACHA select CRYPTO_LIB_CHACHA_GENERIC if CRYPTO_ARCH_HAVE_LIB_CHACHA=n help Enable the ChaCha library interface. This interface may be fulfilled
@@ -68,12 +72,17 @@ config CRYPTO_LIB_CHACHA is available and enabled. config CRYPTO_ARCH_HAVE_LIB_CURVE25519 - tristate + bool help Declares whether the architecture provides an arch-specific accelerated implementation of the Curve25519 library interface, either builtin or as a module. +config CRYPTO_ARCH_MAY_HAVE_LIB_CURVE25519 + tristate + select CRYPTO_ARCH_HAVE_LIB_CURVE25519 if CRYPTO_LIB_CURVE25519=m + select CRYPTO_ARCH_HAVE_LIB_CURVE25519 if CRYPTO_ARCH_MAY_HAVE_LIB_CURVE25519=y + config CRYPTO_LIB_CURVE25519_GENERIC tristate help
@@ -85,7 +94,6 @@ config CRYPTO_LIB_CURVE25519_GENERIC config CRYPTO_LIB_CURVE25519 tristate "Curve25519 scalar multiplication library" - depends on CRYPTO_ARCH_HAVE_LIB_CURVE25519 || !CRYPTO_ARCH_HAVE_LIB_CURVE25519 select CRYPTO_LIB_CURVE25519_GENERIC if CRYPTO_ARCH_HAVE_LIB_CURVE25519=n select CRYPTO_LIB_UTILS help
@@ -104,12 +112,17 @@ config CRYPTO_LIB_POLY1305_RSIZE default 1 config CRYPTO_ARCH_HAVE_LIB_POLY1305 - tristate + bool help Declares whether the architecture provides an arch-specific accelerated implementation of the Poly1305 library interface, either builtin or as a module. +config CRYPTO_ARCH_MAY_HAVE_LIB_POLY1305 + tristate + select CRYPTO_ARCH_HAVE_LIB_POLY1305 if CRYPTO_LIB_POLY1305=m + select CRYPTO_ARCH_HAVE_LIB_POLY1305 if CRYPTO_ARCH_MAY_HAVE_LIB_POLY1305=y + config CRYPTO_LIB_POLY1305_GENERIC tristate help
@@ -121,7 +134,6 @@ config CRYPTO_LIB_POLY1305_GENERIC config CRYPTO_LIB_POLY1305 tristate "Poly1305 library interface" - depends on CRYPTO_ARCH_HAVE_LIB_POLY1305 || !CRYPTO_ARCH_HAVE_LIB_POLY1305 select CRYPTO_LIB_POLY1305_GENERIC if CRYPTO_ARCH_HAVE_LIB_POLY1305=n help Enable the Poly1305 library interface. This interface may be fulfilled
@@ -130,8 +142,6 @@ config CRYPTO_LIB_POLY1305 config CRYPTO_LIB_CHACHA20POLY1305 tristate "ChaCha20-Poly1305 AEAD support (8-byte nonce library version)" - depends on CRYPTO_ARCH_HAVE_LIB_CHACHA || !CRYPTO_ARCH_HAVE_LIB_CHACHA - depends on CRYPTO_ARCH_HAVE_LIB_POLY1305 || !CRYPTO_ARCH_HAVE_LIB_POLY1305 depends on CRYPTO select CRYPTO_LIB_CHACHA select CRYPTO_LIB_POLY1305
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 158/280 crypto: null - Use spin lock instead of mutex
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
[ Upstream commit dcc47a028c24e793ce6d6efebfef1a1e92f80297 ]
As the null algorithm may be freed in softirq context through af_alg, use spin locks instead of mutexes to protect the default null algorithm.
--- crypto/crypto_null.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-)
crypto/crypto_null.c +26 -13
@@ -17,10 +17,10 @@#include <crypto/internal/skcipher.h> #include <linux/init.h> #include <linux/module.h> -#include <linux/mm.h> +#include <linux/spinlock.h> #include <linux/string.h> -static DEFINE_MUTEX (crypto_default_null_skcipher_lock); +static DEFINE_SPINLOCK (crypto_default_null_skcipher_lock);static struct crypto_sync_skcipher *crypto_default_null_skcipher;static int crypto_default_null_skcipher_refcnt;
@@ -152,23 +152,32 @@ MODULE_ALIAS_CRYPTO("cipher_null");struct crypto_sync_skcipher *crypto_get_default_null_skcipher (void ) { +struct crypto_sync_skcipher *ntfm =NULL ;struct crypto_sync_skcipher *tfm; -mutex_lock (&crypto_default_null_skcipher_lock); +spin_lock_bh (&crypto_default_null_skcipher_lock); tfm = crypto_default_null_skcipher;if (!tfm) { - tfm =crypto_alloc_sync_skcipher ("ecb(cipher_null)" ,0 ,0 ); -if (IS_ERR (tfm)) - goto unlock; - - crypto_default_null_skcipher = tfm; +spin_unlock_bh (&crypto_default_null_skcipher_lock); + + ntfm =crypto_alloc_sync_skcipher ("ecb(cipher_null)" ,0 ,0 ); +if (IS_ERR (ntfm)) +return ntfm; + +spin_lock_bh (&crypto_default_null_skcipher_lock); + tfm = crypto_default_null_skcipher; +if (!tfm) { + tfm = ntfm; + ntfm =NULL ; + crypto_default_null_skcipher = tfm; + } } crypto_default_null_skcipher_refcnt++; +spin_unlock_bh (&crypto_default_null_skcipher_lock); -unlock: -mutex_unlock (&crypto_default_null_skcipher_lock); +crypto_free_sync_skcipher (ntfm);return tfm; }
@@ -176,12 +185,16 @@ EXPORT_SYMBOL_GPL(crypto_get_default_null_skcipher);void crypto_put_default_null_skcipher (void ) { -mutex_lock (&crypto_default_null_skcipher_lock); +struct crypto_sync_skcipher *tfm =NULL ; + +spin_lock_bh (&crypto_default_null_skcipher_lock);if (!--crypto_default_null_skcipher_refcnt) { -crypto_free_sync_skcipher (crypto_default_null_skcipher); + tfm = crypto_default_null_skcipher; crypto_default_null_skcipher =NULL ; } -mutex_unlock (&crypto_default_null_skcipher_lock); +spin_unlock_bh (&crypto_default_null_skcipher_lock); + +crypto_free_sync_skcipher (tfm); }EXPORT_SYMBOL_GPL (crypto_put_default_null_skcipher);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 159/280 bpf: Fix kmemleak warning for percpu hashmap
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonghong Song <[email protected]>
[ Upstream commit 11ba7ce076e5903e7bdc1fd1498979c331b3c286 ]
Vlad Poenaru reported the following kmemleak issue:
unreferenced object 0x606fd7c44ac8 (size 32):
backtrace (crc 0):
pcpu_alloc_noprof+0x730/0xeb0
bpf_map_alloc_percpu+0x69/0xc0
prealloc_init+0x9d/0x1b0
htab_map_alloc+0x363/0x510
map_create+0x215/0x3a0
__sys_bpf+0x16b/0x3e0
__x64_sys_bpf+0x18/0x20
do_syscall_64+0x7b/0x150
entry_SYSCALL_64_after_hwframe+0x4b/0x53Further investigation shows the reason is due to not 8-byte aligned store of percpu pointer in htab_elem_set_ptr():
*(void __percpu **)(l->key + key_size) = pptr;
Note that the whole htab_elem alignment is 8 (for x86_64). If the key_size is 4, that means pptr is stored in a location which is 4 byte aligned but not 8 byte aligned. In mm/kmemleak.c, scan_block() scans the memory based on 8 byte stride, so it won't detect above pptr, hence reporting the memory leak.
In htab_map_alloc(), we already have
htab->elem_size = sizeof(struct htab_elem) +
round_up(htab->map.key_size, 8);
if (percpu)
htab->elem_size += sizeof(void *);
else
htab->elem_size += round_up(htab->map.value_size, 8);So storing pptr with 8-byte alignment won't cause any problem and can fix kmemleak too.
The issue can be reproduced with bpf selftest as well:
1. Enable CONFIG_DEBUG_KMEMLEAK config
2. Add a getchar() before skel destroy in test_hash_map() in prog_tests/for_each.c. The purpose is to keep map available so kmemleak can be detected.
3. run './test_progs -t for_each/hash_map &' and a kmemleak should be reported.
--- kernel/bpf/hashtab.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/bpf/hashtab.c +3 -3
@@ -198,12 +198,12 @@ static bool htab_is_percpu(const struct bpf_htab *htab)static inline void htab_elem_set_ptr (struct htab_elem *l,u32 key_size,void __percpu *pptr) { - *(void __percpu **)(l->key + key_size) = pptr; + *(void __percpu **)(l->key +roundup (key_size,8 )) = pptr; }static inline void __percpu *htab_elem_get_ptr (struct htab_elem *l,u32 key_size) { -return *(void __percpu **)(l->key + key_size); +return *(void __percpu **)(l->key +roundup (key_size,8 )); }static void *fd_htab_map_get_ptr (const struct bpf_map *map,struct htab_elem *l)
@@ -2355,7 +2355,7 @@ static int htab_percpu_map_gen_lookup(struct bpf_map *map, struct bpf_insn *insn *insn++ =BPF_EMIT_CALL (__htab_map_lookup_elem); *insn++ =BPF_JMP_IMM (BPF_JEQ ,BPF_REG_0 ,0 ,3 ); *insn++ =BPF_ALU64_IMM (BPF_ADD ,BPF_REG_0 , - offsetof(struct htab_elem , key) + map->key_size); + offsetof(struct htab_elem , key) +roundup (map->key_size,8 )); *insn++ =BPF_LDX_MEM (BPF_DW ,BPF_REG_0 ,BPF_REG_0 ,0 ); *insn++ =BPF_MOV64_PERCPU_REG (BPF_REG_0 ,BPF_REG_0 );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 160/280 bpf: Fix deadlock between rcu_tasks_trace and event_mutex.
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <[email protected]>
[ Upstream commit 4580f4e0ebdf8dc8d506ae926b88510395a0c1d1 ]
Fix the following deadlock:
CPU A_free_event()
perf_kprobe_destroy()
mutex_lock(&event_mutex)
perf_trace_event_unreg()
synchronize_rcu_tasks_trace()
There are several paths where _free_event() grabs event_mutex and calls sync_rcu_tasks_trace. Above is one such case.
CPU Bbpf_prog_test_run_syscall()
rcu_read_lock_trace()
bpf_prog_run_pin_on_cpu()
bpf_prog_load()
bpf_tracing_func_proto()
trace_set_clr_event()
mutex_lock(&event_mutex)Delegate trace_set_clr_event() to workqueue to avoid such lock dependency.
--- kernel/trace/bpf_trace.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
kernel/trace/bpf_trace.c +4 -3
@@ -403,7 +403,7 @@ static const struct bpf_func_proto bpf_trace_printk_proto = { .arg2_type = ARG_CONST_SIZE, }; -static void __set_printk_clr_event (void ) +static void __set_printk_clr_event (struct work_struct *work) {/* * This program might be calling bpf_trace_printk,
@@ -416,10 +416,11 @@ static void __set_printk_clr_event(void)if (trace_set_clr_event ("bpf_trace" ,"bpf_trace_printk" ,1 ))pr_warn_ratelimited ("could not enable bpf_trace_printk events" ); } +static DECLARE_WORK(set_printk_work, __set_printk_clr_event);const struct bpf_func_proto *bpf_get_trace_printk_proto (void ) { -__set_printk_clr_event (); +schedule_work (&set_printk_work);return &bpf_trace_printk_proto; }
@@ -462,7 +463,7 @@ static const struct bpf_func_proto bpf_trace_vprintk_proto = {const struct bpf_func_proto *bpf_get_trace_vprintk_proto (void ) { -__set_printk_clr_event (); +schedule_work (&set_printk_work);return &bpf_trace_vprintk_proto; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 161/280 clk: check for disabled clock-provider in of_clk_get_hw_from_clkspec()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
[ Upstream commit b20150d499b3ee5c2d632fbc5ac94f98dd33accf ]
of_clk_get_hw_from_clkspec() checks all available clock-providers by comparing their of nodes to the one from the clkspec. If no matching clock provider is found, the function returns -EPROBE_DEFER to cause a re-check at a later date. If a matching clock provider is found, an authoritative answer can be retrieved from it whether the clock exists or not.
This does not take into account that the clock-provider may never appear, because it's node is disabled. This can happen when a clock is optional, provided by a separate block which never gets enabled.
One example of this happening is the rk3588's VOP, which has optional additional display clocks coming from PLLs inside the hdmiphy blocks. These can be used for better rates, but the system will also work without them.
The problem around that is described in the followups to[1]. As we already know the of node of the presumed clock provider, add a check via of_device_is_available() whether this is a "valid" device node. This prevents eternal defer loops.
--- drivers/clk/clk.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/clk/clk.c +4 -0
@@ -5264,6 +5264,10 @@ of_clk_get_hw_from_clkspec(struct of_phandle_args *clkspec)if (!clkspec)return ERR_PTR (-EINVAL ); +/* Check if node in clkspec is in disabled/fail state */ +if (!of_device_is_available (clkspec->np)) +return ERR_PTR (-ENOENT ); +mutex_lock (&of_clk_mutex);list_for_each_entry (provider, &of_clk_providers, link) {if (provider->node == clkspec->np) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 162/280 parisc: PDT: Fix missing prototype warning
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu-Chun Lin <[email protected]>
[ Upstream commit b899981750dcb958ceffa4462d903963ee494aa2 ]
As reported by the kernel test robot, the following error occurs:
arch/parisc/kernel/pdt.c:65:6: warning: no previous prototype for 'arch_report_meminfo' [-Wmissing-prototypes]
65 | void arch_report_meminfo(struct seq_file *m)
| ^~~~~~~~~~~~~~~~~~~
arch_report_meminfo() is declared in include/linux/proc_fs.h and only defined when CONFIG_PROC_FS is enabled. Wrap its definition in #ifdef CONFIG_PROC_FS to fix the -Wmissing-prototypes warning.
--- arch/parisc/kernel/pdt.c | 2 ++ 1 file changed, 2 insertions(+)
arch/parisc/kernel/pdt.c +2 -0
@@ -63,6 +63,7 @@ static unsigned long pdt_entry[MAX_PDT_ENTRIES] __page_aligned_bss;#define PDT_ADDR_PERM_ERR (pdt_type != PDT_PDC ? 2UL : 0UL)#define PDT_ADDR_SINGLE_ERR 1UL +#ifdef CONFIG_PROC_FS /* report PDT entries via /proc/meminfo */ void arch_report_meminfo (struct seq_file *m) {
@@ -74,6 +75,7 @@ void arch_report_meminfo(struct seq_file *m)seq_printf (m,"PDT_cur_entries: %7lu\n" , pdt_status.pdt_entries); } +#endif static int get_info_pat_new (void ) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 163/280 s390/sclp: Add check for get_zeroed_page()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haoxiang Li <[email protected]>
[ Upstream commit 3db42c75a921854a99db0a2775814fef97415bac ]
Add check for the return value of get_zeroed_page() in sclp_console_init() to prevent null pointer dereference. Furthermore, to solve the memory leak caused by the loop allocation, add a free helper to do the free job.
--- drivers/s390/char/sclp_con.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/s390/char/sclp_con.c +17 -0
@@ -263,6 +263,19 @@ static struct console sclp_console = .index = 0 /* ttyS0 */ }; +/* +* Release allocated pages. +*/ +static void __init __sclp_console_free_pages (void ) +{ +struct list_head *page, *p; + +list_for_each_safe (page, p, &sclp_con_pages) { +list_del (page); +free_page ((unsigned long )page); + } +} +/* * called by console_init() in drivers/char/tty_io.c at boot-time. */
@@ -282,6 +295,10 @@ sclp_console_init(void)/* Allocate pages for output buffering */ for (i =0 ; i < sclp_console_pages; i++) { page = (void *)get_zeroed_page (GFP_KERNEL |GFP_DMA ); +if (!page) { +__sclp_console_free_pages (); +return -ENOMEM ; + }list_add_tail (page, &sclp_con_pages); } sclp_conbuf =NULL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 164/280 s390/tty: Fix a potential memory leak bug
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haoxiang Li <[email protected]>
[ Upstream commit ad9bb8f049717d64c5e62b2a44954be9f681c65b ]
The check for get_zeroed_page() leads to a direct return and overlooked the memory leak caused by loop allocation. Add a free helper to free spaces allocated by get_zeroed_page().
--- drivers/s390/char/sclp_tty.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/s390/char/sclp_tty.c +12 -0
@@ -490,6 +490,17 @@ static const struct tty_operations sclp_ops = { .flush_buffer = sclp_tty_flush_buffer, }; +/* Release allocated pages. */ +static void __init __sclp_tty_free_pages (void ) +{ +struct list_head *page, *p; + +list_for_each_safe (page, p, &sclp_tty_pages) { +list_del (page); +free_page ((unsigned long )page); + } +} +static int __init sclp_tty_init (void ) {
@@ -516,6 +527,7 @@ sclp_tty_init(void)for (i =0 ; i <MAX_KMEM_PAGES ; i++) { page = (void *)get_zeroed_page (GFP_KERNEL |GFP_DMA );if (page ==NULL ) { +__sclp_tty_free_pages ();tty_driver_kref_put (driver);return -ENOMEM ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 165/280 bpf: bpftool: Setting error code in do_loader()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sewon Nam <[email protected]>
[ Upstream commit 02a4694107b4c830d4bd6d194e98b3ac0bc86f29 ]
We are missing setting error code in do_loader() when bpf_object__open_file() fails. This means the command's exit status code will be successful, even though the operation failed. So make sure to return the correct error code. To maintain consistency with other locations where bpf_object__open_file() is called, return -1.
[0] Closes: https://github.com/libbpf/bpftool/issues/156
--- tools/bpf/bpftool/prog.c | 1 + 1 file changed, 1 insertion(+)
tools/bpf/bpftool/prog.c +1 -0
@@ -1928,6 +1928,7 @@ static int do_loader(int argc, char **argv) obj =bpf_object__open_file (file, &open_opts);if (!obj) { + err =-1 ;p_err ("failed to open object file" ); goto err_close_obj; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 166/280 bpf: Only fails the busy counter check in bpf_cgrp_storage_get if it creates storage
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin KaFai Lau <[email protected]>
[ Upstream commit f4edc66e48a694b3e6d164cc71f059de542dfaec ]
The current cgrp storage has a percpu counter, bpf_cgrp_storage_busy, to detect potential deadlock at a spin_lock that the local storage acquires during new storage creation.
There are false positives. It turns out to be too noisy in production. For example, a bpf prog may be doing a bpf_cgrp_storage_get on map_a. An IRQ comes in and triggers another bpf_cgrp_storage_get on a different map_b. It will then trigger the false positive deadlock check in the percpu counter. On top of that, both are doing lookup only and no need to create new storage, so practically it does not need to acquire the spin_lock.
The bpf_task_storage_get already has a strategy to minimize this false positive by only failing if the bpf_task_storage_get needs to create a new storage and the percpu counter is busy. Creating a new storage is the only time it must acquire the spin_lock.
This patch borrows the same idea. Unlike task storage that has a separate variant for tracing (_recur) and non-tracing, this patch stays with one bpf_cgrp_storage_get helper to keep it simple for now in light of the upcoming res_spin_lock.
The variable could potentially use a better name noTbusy instead of nobusy. This patch follows the same naming in bpf_task_storage_get for now.
I have tested it by temporarily adding noinline to
the cgroup_storage_lookup(), traced it by fentry, and the fentry program succeeded in calling bpf_cgrp_storage_get().
--- kernel/bpf/bpf_cgrp_storage.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
kernel/bpf/bpf_cgrp_storage.c +6 -5
@@ -162,6 +162,7 @@ BPF_CALL_5(bpf_cgrp_storage_get, struct bpf_map *, map, struct cgroup *, cgroup, void *, value, u64, flags, gfp_t, gfp_flags) { struct bpf_local_storage_data *sdata; +bool nobusy;WARN_ON_ONCE (!bpf_rcu_lock_held ());if (flags & ~(BPF_LOCAL_STORAGE_GET_F_CREATE ))
@@ -170,21 +171,21 @@ BPF_CALL_5(bpf_cgrp_storage_get, struct bpf_map *, map, struct cgroup *, cgroup,if (!cgroup)return (unsigned long )NULL ; -if (!bpf_cgrp_storage_trylock ()) -return (unsigned long )NULL ; + nobusy =bpf_cgrp_storage_trylock (); - sdata =cgroup_storage_lookup (cgroup, map, true); + sdata =cgroup_storage_lookup (cgroup, map, nobusy);if (sdata) goto unlock;/* only allocate new storage, when the cgroup is refcounted */ if (!percpu_ref_is_dying (&cgroup->self.refcnt) && - (flags &BPF_LOCAL_STORAGE_GET_F_CREATE )) + (flags &BPF_LOCAL_STORAGE_GET_F_CREATE ) && nobusy) sdata =bpf_local_storage_update (cgroup, (struct bpf_local_storage_map *)map, value,BPF_NOEXIST , gfp_flags); unlock: -bpf_cgrp_storage_unlock (); +if (nobusy) +bpf_cgrp_storage_unlock ();return IS_ERR_OR_NULL (sdata) ? (unsigned long )NULL : (unsigned long )sdata->data; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 167/280 bpf: Reject attaching fexit/fmod_ret to __noreturn functions
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yafang Shao <[email protected]>
[ Upstream commit cfe816d469dce9c0864062cf65dd7b3c42adc6f8 ]
If we attach fexit/fmod_ret to __noreturn functions, it will cause an issue that the bpf trampoline image will be left over even if the bpf link has been destroyed. Take attaching do_exit() with fexit for example. The fexit works as follows,
bpf_trampoline
+ __bpf_tramp_enter
+ percpu_ref_get(&tr->pcref);
+ call do_exit()
+ __bpf_tramp_exit
+ percpu_ref_put(&tr->pcref);
Since do_exit() never returns, the refcnt of the trampoline image is never decremented, preventing it from being freed. That can be verified with as follows,
$ bpftool link show <<<< nothing output $ grep "bpf_trampoline_[0-9]" /proc/kallsyms ffffffffc04cb000 t bpf_trampoline_6442526459 [bpf] <<<< leftover
In this patch, all functions annotated with __noreturn are rejected, except for the following cases:
- Functions that result in a system reboot, such as panic, machine_real_restart and rust_begin_unwind
- Functions that are never executed by tasks, such as rest_init and cpu_startup_entry
- Functions implemented in assembly, such as rewind_stack_and_make_dead and xen_cpu_bringup_again, lack an associated BTF ID.
With this change, attaching fexit probes to functions like do_exit() will be rejected.
$ ./fexit libbpf: prog 'fexit': BPF program load failed: -EINVAL libbpf: prog 'fexit': -- BEGIN PROG LOAD LOG -- Attaching fexit/fmod_ret to __noreturn functions is rejected.
--- kernel/bpf/verifier.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
kernel/bpf/verifier.c +32 -0
@@ -22289,6 +22289,33 @@ BTF_ID(func, __rcu_read_unlock)#endif BTF_SET_END(btf_id_deny) +/* fexit and fmod_ret can't be used to attach to __noreturn functions. + * Currently, we must manually list all __noreturn functions here. Once a more + * robust solution is implemented, this workaround can be removed. + */ +BTF_SET_START(noreturn_deny) +#ifdef CONFIG_IA32_EMULATION +BTF_ID(func, __ia32_sys_exit) +BTF_ID(func, __ia32_sys_exit_group) +#endif +#ifdef CONFIG_KUNIT +BTF_ID(func, __kunit_abort) +BTF_ID(func, kunit_try_catch_throw) +#endif +#ifdef CONFIG_MODULES +BTF_ID(func, __module_put_and_kthread_exit) +#endif +#ifdef CONFIG_X86_64 +BTF_ID(func, __x64_sys_exit) +BTF_ID(func, __x64_sys_exit_group) +#endif +BTF_ID(func, do_exit) +BTF_ID(func, do_group_exit) +BTF_ID(func, kthread_complete_and_exit) +BTF_ID(func, kthread_exit) +BTF_ID(func, make_task_dead) +BTF_SET_END(noreturn_deny) + static bool can_be_sleepable(struct bpf_prog *prog) { if (prog->type == BPF_PROG_TYPE_TRACING) {
@@ -22377,6 +22404,11 @@ static int check_attach_btf_id(struct bpf_verifier_env *env) }else if (prog->type ==BPF_PROG_TYPE_TRACING &&btf_id_set_contains (&btf_id_deny, btf_id)) {return -EINVAL ; + }else if ((prog->expected_attach_type ==BPF_TRACE_FEXIT || + prog->expected_attach_type ==BPF_MODIFY_RETURN ) && +btf_id_set_contains (&noreturn_deny, btf_id)) { +verbose (env,"Attaching fexit/fmod_ret to __noreturn functions is rejected.\n" ); +return -EINVAL ; } key =bpf_trampoline_compute_key (tgt_prog, prog->aux->attach_btf, btf_id);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 168/280 mailbox: pcc: Fix the possible race in updation of chan_in_use flag
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huisong Li <[email protected]>
[ Upstream commit 9779d45c749340ab461d595c1a4a664cb28f3007 ]
The function mbox_chan_received_data() calls the Rx callback of the mailbox client driver. The callback might set chan_in_use flag from pcc_send_data(). This flag's status determines whether the PCC channel is in use.
However, there is a potential race condition where chan_in_use is updated incorrectly due to concurrency between the interrupt handler (pcc_mbox_irq()) and the command sender(pcc_send_data()).
The 'chan_in_use' flag of a channel is set to true after sending a command. And the flag of the new command may be cleared erroneous by the interrupt handler afer mbox_chan_received_data() returns,
As a result, the interrupt being level triggered can't be cleared in pcc_mbox_irq() and it will be disabled after the number of handled times exceeds the specified value. The error log is as follows:
| kunpeng_hccs HISI04B2:00: PCC command executed timeout! | kunpeng_hccs HISI04B2:00: get port link status info failed, ret = -110 | irq 13: nobody cared (try booting with the "irqpoll" option) | Call trace: | dump_backtrace+0x0/0x210 | show_stack+0x1c/0x2c | dump_stack+0xec/0x130 | __report_bad_irq+0x50/0x190 | note_interrupt+0x1e4/0x260 | handle_irq_event+0x144/0x17c | handle_fasteoi_irq+0xd0/0x240 | __handle_domain_irq+0x80/0xf0 | gic_handle_irq+0x74/0x2d0 | el1_irq+0xbc/0x140 | mnt_clone_write+0x0/0x70 | file_update_time+0xcc/0x160 | fault_dirty_shared_page+0xe8/0x150 | do_shared_fault+0x80/0x1d0 | do_fault+0x118/0x1a4 | handle_pte_fault+0x154/0x230 | __handle_mm_fault+0x1ac/0x390 | handle_mm_fault+0xf0/0x250 | do_page_fault+0x184/0x454 | do_translation_fault+0xac/0xd4 | do_mem_abort+0x44/0xb4 | el0_da+0x40/0x74 | el0_sync_handler+0x60/0xb4 | el0_sync+0x168/0x180 | handlers: | pcc_mbox_irq | Disabling IRQ #13
To solve this issue, pcc_mbox_irq() must clear 'chan_in_use' flag before the call to mbox_chan_received_data().
(sudeep.holla: Minor updates to the subject, commit message and comment)
--- drivers/mailbox/pcc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/mailbox/pcc.c +7 -1
@@ -333,10 +333,16 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)if (pcc_chan_reg_read_modify_write (&pchan->plat_irq_ack))return IRQ_NONE ; +/* +* Clear this flag after updating interrupt ack register and just +* before mbox_chan_received_data() which might call pcc_send_data() +* where the flag is set again to start new transfer. This is +* required to avoid any possible race in updatation of this flag. +*/ + pchan->chan_in_use = false;mbox_chan_received_data (chan,NULL );check_and_ack (pchan, chan); - pchan->chan_in_use = false;return IRQ_HANDLED ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 169/280 mailbox: pcc: Always clear the platform ack interrupt first
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <[email protected]>
[ Upstream commit cf1338c0e02880cd235a4590eeb15e2039c873bc ]
The PCC mailbox interrupt handler (pcc_mbox_irq()) currently checks for command completion flags and any error status before clearing the interrupt.
The below sequence highlights an issue in the handling of PCC mailbox interrupts, specifically when dealing with doorbell notifications and acknowledgment between the OSPM and the platform where type3 and type4 channels are sharing the interrupt.
-------------------------------------------------------------------------
| T | Platform Firmware | OSPM/Linux PCC driver | |---|---------------------------------|---------------------------------| | 1 | | Build message in shmem | | 2 | | Ring Type3 chan doorbell | | 3 | Receives the doorbell interrupt | | | 4 | Process the message from OSPM | | | 5 | Build response for the message | | | 6 | Ring Platform ACK interrupt on | | | | Type3 chan to OSPM | Received the interrupt | | 7 | Build Notification in Type4 Chan| | | 8 | | Start processing interrupt in | | | | pcc_mbox_irq() handler | | 9 | | Enter PCC handler for Type4 chan| |10 | | Check command complete cleared | |11 | | Read the notification | |12 | | Clear Platform ACK interrupt | | | No effect from the previous step yet as the Platform ACK | | | interrupt has not yet been triggered for this channel | |13 | Ring Platform ACK interrupt on | | | | Type4 chan to OSPM | | |14 | | Enter PCC handler for Type3 chan| |15 | | Command complete is set. | |16 | | Read the response. | |17 | | Clear Platform ACK interrupt | |18 | | Leave PCC handler for Type3 | |19 | | Leave pcc_mbox_irq() handler | |20 | | Re-enter pcc_mbox_irq() handler | |21 | | Enter PCC handler for Type4 chan| |22 | | Leave PCC handler for Type4 chan| |23 | | Enter PCC handler for Type3 chan| |24 | | Leave PCC handler for Type3 chan| |25 | | Leave pcc_mbox_irq() handler |
-------------------------------------------------------------------------
The key issue occurs when OSPM tries to acknowledge platform ack interrupt for a notification which is ready to be read and processed but the interrupt itself is not yet triggered by the platform.
This ineffective acknowledgment leads to an issue later in time where the interrupt remains pending as we exit the interrupt handler without clearing the platform ack interrupt as there is no pending response or notification. The interrupt acknowledgment order is incorrect.
To resolve this issue, the platform acknowledgment interrupt should always be cleared before processing the interrupt for any notifications or response.
--- drivers/mailbox/pcc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/mailbox/pcc.c +4 -3
@@ -313,6 +313,10 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)int ret; pchan = chan->con_priv; + +if (pcc_chan_reg_read_modify_write (&pchan->plat_irq_ack)) +return IRQ_NONE ; +if (pchan->type ==ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE && !pchan->chan_in_use)return IRQ_NONE ;
@@ -330,9 +334,6 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)return IRQ_NONE ; } -if (pcc_chan_reg_read_modify_write (&pchan->plat_irq_ack)) -return IRQ_NONE ; -/* * Clear this flag after updating interrupt ack register and just * before mbox_chan_received_data() which might call pcc_send_data()
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 170/280 usb: host: max3421-hcd: Add missing spi_device_id table
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Stein <[email protected]>
[ Upstream commit 41d5e3806cf589f658f92c75195095df0b66f66a ]
"maxim,max3421" DT compatible is missing its SPI device ID entry, not allowing module autoloading and leading to the following message:
"SPI driver max3421-hcd has no spi_device_id for maxim,max3421"
Fix this by adding the spi_device_id table.
--- drivers/usb/host/max3421-hcd.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/host/max3421-hcd.c +7 -0
@@ -1946,6 +1946,12 @@ max3421_remove(struct spi_device *spi)usb_put_hcd (hcd); } +static const struct spi_device_id max3421_spi_ids[] = { + {"max3421" }, + { }, +}; +MODULE_DEVICE_TABLE (spi, max3421_spi_ids); +static const struct of_device_id max3421_of_match_table[] = { { .compatible ="maxim,max3421" , }, {},
@@ -1955,6 +1961,7 @@ MODULE_DEVICE_TABLE(of, max3421_of_match_table);static struct spi_driver max3421_driver = { .probe = max3421_probe, .remove = max3421_remove, + .id_table = max3421_spi_ids, .driver = { .name ="max3421-hcd" , .of_match_table = max3421_of_match_table,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 171/280 fs/ntfs3: Keep write operations atomic
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lizhi Xu <[email protected]>
[ Upstream commit 285cec318bf5a7a6c8ba999b2b6ec96f9a20590f ]
syzbot reported a NULL pointer dereference in __generic_file_write_iter. [1]
Before the write operation is completed, the user executes ioctl[2] to clear the compress flag of the file, which causes the is_compressed() judgment to return 0, further causing the program to enter the wrong process and call the wrong ops ntfs_aops_cmpr, which triggers the null pointer dereference of write_begin.
Use inode lock to synchronize ioctl and write to avoid this case.
[1]
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
Mem abort info:
ESR = 0x0000000086000006
EC = 0x21: IABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x06: level 2 translation fault
user pgtable: 4k pages, 48-bit VAs, pgdp=000000011896d000
[0000000000000000] pgd=0800000118b44403, p4d=0800000118b44403, pud=0800000117517403, pmd=0000000000000000
Internal error: Oops: 0000000086000006 [#1] PREEMPT SMP Modules linked in: CPU: 0 UID: 0 PID: 6427 Comm: syz-executor347 Not tainted 6.13.0-rc3-syzkaller-g573067a5a685 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : 0x0 lr : generic_perform_write+0x29c/0x868 mm/filemap.c:4055
sp : ffff80009d4978a0
x29: ffff80009d4979c0 x28: dfff800000000000 x27: ffff80009d497bc8
x26: 0000000000000000 x25: ffff80009d497960 x24: ffff80008ba71c68
x23: 0000000000000000 x22: ffff0000c655dac0 x21: 0000000000001000
x20: 000000000000000c x19: 1ffff00013a92f2c x18: ffff0000e183aa1c
x17: 0004060000000014 x16: ffff800083275834 x15: 0000000000000001
x14: 0000000000000000 x13: 0000000000000001 x12: ffff0000c655dac0
x11: 0000000000ff0100 x10: 0000000000ff0100 x9 : 0000000000000000 x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000 x5 : ffff80009d497980 x4 : ffff80009d497960 x3 : 0000000000001000 x2 : 0000000000000000 x1 : ffff0000e183a928 x0 : ffff0000d60b0fc0
Call trace: 0x0 (P) __generic_file_write_iter+0xfc/0x204 mm/filemap.c:4156 ntfs_file_write_iter+0x54c/0x630 fs/ntfs3/file.c:1267 new_sync_write fs/read_write.c:586 [inline] vfs_write+0x920/0xcf4 fs/read_write.c:679 ksys_write+0x15c/0x26c fs/read_write.c:731 __do_sys_write fs/read_write.c:742 [inline] __se_sys_write fs/read_write.c:739 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:739 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762
[2]
ioctl$FS_IOC_SETFLAGS(r0, 0x40086602, &(0x7f00000000c0)=0x20)
--- fs/ntfs3/file.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
fs/ntfs3/file.c +10 -9
@@ -1238,21 +1238,22 @@ static ssize_t ntfs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)ssize_t ret;int err; - err =check_write_restriction (inode); -if (err) -return err; - -if (is_compressed (ni) && (iocb->ki_flags &IOCB_DIRECT )) { -ntfs_inode_warn (inode,"direct i/o + compressed not supported" ); -return -EOPNOTSUPP ; - } -if (!inode_trylock (inode)) {if (iocb->ki_flags &IOCB_NOWAIT )return -EAGAIN ;inode_lock (inode); } + ret =check_write_restriction (inode); +if (ret) + goto out; + +if (is_compressed (ni) && (iocb->ki_flags &IOCB_DIRECT )) { +ntfs_inode_warn (inode,"direct i/o + compressed not supported" ); + ret = -EOPNOTSUPP ; + goto out; + } + ret =generic_write_checks (iocb, from);if (ret <=0 ) goto out;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 172/280 fs/ntfs3: Fix WARNING in ntfs_extend_initialized_size
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
[ Upstream commit ff355926445897cc9fdea3b00611e514232c213c ]
Syzbot reported a WARNING in ntfs_extend_initialized_size. The data type of in->i_valid and to is u64 in ntfs_file_mmap(). If their values are greater than LLONG_MAX, overflow will occur because the data types of the parameters valid and new_valid corresponding to the function ntfs_extend_initialized_size() are loff_t.
Before calling ntfs_extend_initialized_size() in the ntfs_file_mmap(), the "ni->i_valid < to" has been determined, so the same WARN_ON determination is not required in ntfs_extend_initialized_size().
Just execute the ntfs_extend_initialized_size() in ntfs_extend() to make a WARN_ON check.
--- fs/ntfs3/file.c | 1 + 1 file changed, 1 insertion(+)
fs/ntfs3/file.c +1 -0
@@ -428,6 +428,7 @@ static int ntfs_extend(struct inode *inode, loff_t pos, size_t count, }if (extend_init && !is_compressed (ni)) { +WARN_ON (ni->i_valid >= pos); err =ntfs_extend_initialized_size (file, ni, ni->i_valid, pos);if (err) goto out;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 173/280 usb: dwc3: gadget: Refactor loop to avoid NULL endpoints
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit eafba0205426091354f050381c32ad1567c35844 ]
Prepare the gadget driver to handle the reserved endpoints that will be not allocated at the initialisation time.
While at it, add a warning where the NULL endpoint should never happen.
--- drivers/usb/dwc3/gadget.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/usb/dwc3/gadget.c +18 -4
@@ -548,6 +548,7 @@ static int dwc3_gadget_set_xfer_resource(struct dwc3_ep *dep)int dwc3_gadget_start_config (struct dwc3 *dwc,unsigned int resource_index) {struct dwc3_gadget_ep_cmd_params params; +struct dwc3_ep *dep;u32 cmd;int i;int ret;
@@ -564,8 +565,13 @@ int dwc3_gadget_start_config(struct dwc3 *dwc, unsigned int resource_index)return ret;/* Reset resource allocation flags */ -for (i = resource_index; i < dwc->num_eps && dwc->eps[i]; i++) - dwc->eps[i]->flags &= ~DWC3_EP_RESOURCE_ALLOCATED ; +for (i = resource_index; i < dwc->num_eps; i++) { + dep = dwc->eps[i]; +if (!dep) +continue ; + + dep->flags &= ~DWC3_EP_RESOURCE_ALLOCATED ; + }return 0 ; }
@@ -752,9 +758,11 @@ void dwc3_gadget_clear_tx_fifos(struct dwc3 *dwc) dwc->last_fifo_depth = fifo_depth;/* Clear existing TXFIFO for all IN eps except ep0 */ -for (num =3 ; num <min_t (int, dwc->num_eps,DWC3_ENDPOINTS_NUM ); - num +=2 ) { +for (num =3 ; num <min_t (int, dwc->num_eps,DWC3_ENDPOINTS_NUM ); num +=2 ) { dep = dwc->eps[num]; +if (!dep) +continue ; +/* Don't change TXFRAMNUM on usb31 version */ size =DWC3_IP_IS (DWC3 ) ?0 : dwc3_readl(dwc->regs, DWC3_GTXFIFOSIZ(num >> 1)) &
@@ -3670,6 +3678,8 @@ static bool dwc3_gadget_endpoint_trbs_complete(struct dwc3_ep *dep,for (i =0 ; i <DWC3_ENDPOINTS_NUM ; i++) { dep = dwc->eps[i]; +if (!dep) +continue ;if (!(dep->flags &DWC3_EP_ENABLED ))continue ;
@@ -3858,6 +3868,10 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,u8 epnum = event->endpoint_number; dep = dwc->eps[epnum]; +if (!dep) { +dev_warn (dwc->dev,"spurious event, endpoint %u is not allocated\n" , epnum); +return ; + }if (!(dep->flags &DWC3_EP_ENABLED )) {if ((epnum >1 ) && !(dep->flags &DWC3_EP_TRANSFER_STARTED ))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 174/280 usb: dwc3: gadget: Avoid using reserved endpoints on Intel Merrifield
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 461f24bff86808ee5fbfe74751a825f8a7ab24e0 ]
Intel Merrifield SoC uses these endpoints for tracing and they cannot be re-allocated if being used because the side band flow control signals are hard wired to certain endpoints:
• 1 High BW Bulk IN (IN#1) (RTIT)
• 1 1KB BW Bulk IN (IN#8) + 1 1KB BW Bulk OUT (Run Control) (OUT#8)
In device mode, since RTIT (EP#1) and EXI/RunControl (EP#8) uses External Buffer Control (EBC) mode, these endpoints are to be mapped to EBC mode (to be done by EXI target driver). Additionally TRB for RTIT and EXI are maintained in STM (System Trace Module) unit and the EXI target driver will as well configure the TRB location for EP #1 IN and EP#8 (IN and OUT). Since STM/PTI and EXI hardware blocks manage these endpoints and interface to OTG3 controller through EBC interface, there is no need to enable any events (such as XferComplete etc) for these end points.
--- drivers/usb/dwc3/dwc3-pci.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/usb/dwc3/dwc3-pci.c +10 -0
@@ -148,11 +148,21 @@ static const struct property_entry dwc3_pci_intel_byt_properties[] = { {} }; +/* +* Intel Merrifield SoC uses these endpoints for tracing and they cannot +* be re-allocated if being used because the side band flow control signals +* are hard wired to certain endpoints: +* - 1 High BW Bulk IN (IN#1) (RTIT) +* - 1 1KB BW Bulk IN (IN#8) + 1 1KB BW Bulk OUT (Run Control) (OUT#8) +*/ +static const u8 dwc3_pci_mrfld_reserved_endpoints[] = {3 ,16 ,17 }; +static const struct property_entry dwc3_pci_mrfld_properties[] = {PROPERTY_ENTRY_STRING ("dr_mode" ,"otg" ),PROPERTY_ENTRY_STRING ("linux,extcon-name" ,"mrfld_bcove_pwrsrc" ),PROPERTY_ENTRY_BOOL ("snps,dis_u3_susphy_quirk" ),PROPERTY_ENTRY_BOOL ("snps,dis_u2_susphy_quirk" ), +PROPERTY_ENTRY_U8_ARRAY ("snps,reserved-endpoints" , dwc3_pci_mrfld_reserved_endpoints),PROPERTY_ENTRY_BOOL ("snps,usb2-gadget-lpm-disable" ),PROPERTY_ENTRY_BOOL ("linux,sysdev_is_parent" ), {}
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 175/280 sound/virtio: Fix cancel_sync warnings on uninitialized work_structs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <[email protected]>
[ Upstream commit 3c7df2e27346eb40a0e86230db1ccab195c97cfe ]
Betty reported hitting the following warning:
[ 8.709131][ T221] WARNING: CPU: 2 PID: 221 at kernel/workqueue.c:4182 ... [ 8.713282][ T221] Call trace: [ 8.713365][ T221] __flush_work+0x8d0/0x914 [ 8.713468][ T221] __cancel_work_sync+0xac/0xfc [ 8.713570][ T221] cancel_work_sync+0x24/0x34 [ 8.713667][ T221] virtsnd_remove+0xa8/0xf8 [virtio_snd ab15f34d0dd772f6d11327e08a81d46dc9c36276] [ 8.713868][ T221] virtsnd_probe+0x48c/0x664 [virtio_snd ab15f34d0dd772f6d11327e08a81d46dc9c36276] [ 8.714035][ T221] virtio_dev_probe+0x28c/0x390 [ 8.714139][ T221] really_probe+0x1bc/0x4c8
...
It seems we're hitting the error path in virtsnd_probe(), which triggers a virtsnd_remove() which iterates over the substreams calling cancel_work_sync() on the elapsed_period work_struct.
Looking at the code, from earlier in:
virtsnd_probe()->virtsnd_build_devs()->virtsnd_pcm_parse_cfg()
We set snd->nsubstreams, allocate the snd->substreams, and if we then hit an error on the info allocation or something in virtsnd_ctl_query_info() fails, we will exit without having initialized the elapsed_period work_struct.
When that error path unwinds we then call virtsnd_remove() which as long as the substreams array is allocated, will iterate through calling cancel_work_sync() on the uninitialized work struct hitting this warning.
Takashi Iwai suggested this fix, which initializes the substreams structure right after allocation, so that if we hit the error paths we avoid trying to cleanup uninitialized data.
Note: I have not yet managed to reproduce the issue myself, so this patch has had limited testing.
Feedback or thoughts would be appreciated!
Message-Id: <[email protected]>
--- sound/virtio/virtio_pcm.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
sound/virtio/virtio_pcm.c +15 -6
@@ -339,6 +339,21 @@ int virtsnd_pcm_parse_cfg(struct virtio_snd *snd)if (!snd->substreams)return -ENOMEM ; +/* +* Initialize critical substream fields early in case we hit an +* error path and end up trying to clean up uninitialized structures +* elsewhere. +*/ +for (i =0 ; i < snd->nsubstreams; ++i) { +struct virtio_pcm_substream *vss = &snd->substreams[i]; + + vss->snd = snd; + vss->sid = i; +INIT_WORK (&vss->elapsed_period, virtsnd_pcm_period_elapsed); +init_waitqueue_head (&vss->msg_empty); +spin_lock_init (&vss->lock); + } + info =kcalloc (snd->nsubstreams,sizeof (*info),GFP_KERNEL );if (!info)return -ENOMEM ;
@@ -352,12 +367,6 @@ int virtsnd_pcm_parse_cfg(struct virtio_snd *snd)struct virtio_pcm_substream *vss = &snd->substreams[i];struct virtio_pcm *vpcm; - vss->snd = snd; - vss->sid = i; -INIT_WORK (&vss->elapsed_period, virtsnd_pcm_period_elapsed); -init_waitqueue_head (&vss->msg_empty); -spin_lock_init (&vss->lock); - rc =virtsnd_pcm_build_hw (vss, &info[i]);if (rc) goto on_exit;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 176/280 usb: xhci: Complete error mid TD transfers when handling Missed Service
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pecio <[email protected]>
[ Upstream commit bfa8459942822bdcc86f0e87f237c0723ae64948 ]
Missed Service Error after an error mid TD means that the failed TD has already been passed by the xHC without acknowledgment of the final TRB, a known hardware bug. So don't wait any more and give back the TD.
Reproduced on NEC uPD720200 under conditions of ludicrously bad USB link quality, confirmed to behave as expected using dynamic debug.
--- drivers/usb/host/xhci-ring.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-ring.c +5 -1
@@ -2787,7 +2787,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,xhci_dbg (xhci,"Miss service interval error for slot %u ep %u, set skip flag\n" , slot_id, ep_index); -return 0 ; +break ;case COMP_NO_PING_RESPONSE_ERROR : ep->skip = true; xhci_dbg(xhci,
@@ -2838,6 +2838,10 @@ static int handle_tx_event(struct xhci_hcd *xhci,xhci_td_cleanup (xhci, td, ep_ring, td->status); } +/* Missed TDs will be skipped on the next event */ +if (trb_comp_code ==COMP_MISSED_SERVICE_ERROR ) +return 0 ; +if (list_empty (&ep_ring->td_list)) {/* * Don't print wanings if ring is empty due to a stopped endpoint generating an
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 177/280 usb: xhci: Fix isochronous Ring Underrun/Overrun event handling
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pecio <[email protected]>
[ Upstream commit 906dec15b9b321b546fd31a3c99ffc13724c7af4 ]
The TRB pointer of these events points at enqueue at the time of error occurrence on xHCI 1.1+ HCs or it's NULL on older ones. By the time we are handling the event, a new TD may be queued at this ring position.
I can trigger this race by rising interrupt moderation to increase IRQ handling delay. Similar delay may occur naturally due to system load.
If this ever happens after a Missed Service Error, missed TDs will be skipped and the new TD processed as if it matched the event. It could be given back prematurely, risking data loss or buffer UAF by the xHC.
Don't complete TDs on xrun events and don't warn if queued TDs don't match the event's TRB pointer, which can be NULL or a link/no-op TRB. Don't warn if there are no queued TDs at all.
Now that it's safe, also handle xrun events if the skip flag is clear. This ensures completion of any TD stuck in 'error mid TD' state right before the xrun event, which could happen if a driver submits a finite number of URBs to a buggy HC and then an error occurs on the last TD.
--- drivers/usb/host/xhci-ring.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/usb/host/xhci-ring.c +14 -6
@@ -2662,6 +2662,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,int status = -EINPROGRESS ;struct xhci_ep_ctx *ep_ctx;u32 trb_comp_code; +bool ring_xrun_event = false; slot_id =TRB_TO_SLOT_ID (le32_to_cpu (event->flags)); ep_index =TRB_TO_EP_ID (le32_to_cpu (event->flags)) -1 ;
@@ -2768,14 +2769,12 @@ static int handle_tx_event(struct xhci_hcd *xhci,* Underrun Event for OUT Isoch endpoint. */ xhci_dbg (xhci,"Underrun event on slot %u ep %u\n" , slot_id, ep_index); -if (ep->skip) -break ; -return 0 ; + ring_xrun_event = true; +break ;case COMP_RING_OVERRUN :xhci_dbg (xhci,"Overrun event on slot %u ep %u\n" , slot_id, ep_index); -if (ep->skip) -break ; -return 0 ; + ring_xrun_event = true; +break ;case COMP_MISSED_SERVICE_ERROR :/* * When encounter missed service error, one or more isoc tds
@@ -2851,6 +2850,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,*/ if (trb_comp_code !=COMP_STOPPED && trb_comp_code !=COMP_STOPPED_LENGTH_INVALID && + !ring_xrun_event && !ep_ring->last_td_was_short) {xhci_warn (xhci,"Event TRB for slot %u ep %u with no TDs queued\n" , slot_id, ep_index);
@@ -2885,6 +2885,10 @@ static int handle_tx_event(struct xhci_hcd *xhci, goto check_endpoint_halted; } +/* TD was queued after xrun, maybe xrun was on a link, don't panic yet */ +if (ring_xrun_event) +return 0 ; +/* * Skip the Force Stopped Event. The 'ep_trb' of FSE is not in the current * TD pointed by 'ep_ring->dequeue' because that the hardware dequeue
@@ -2931,6 +2935,10 @@ static int handle_tx_event(struct xhci_hcd *xhci,*/ }while (ep->skip); +/* Get out if a TD was queued at enqueue after the xrun occurred */ +if (ring_xrun_event) +return 0 ; +if (trb_comp_code ==COMP_SHORT_PACKET ) ep_ring->last_td_was_short = true;else
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 178/280 xhci: Handle spurious events on Etron host isoc enpoints
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
[ Upstream commit b331a3d8097fad4e541d212684192f21fedbd6e5 ]
Unplugging a USB3.0 webcam from Etron hosts while streaming results in errors like this:
[ 2.646387] xhci_hcd 0000:03:00.0: ERROR Transfer event TRB DMA ptr not part of current TD ep_index 18 comp_code 13 [ 2.646446] xhci_hcd 0000:03:00.0: Looking for event-dma 000000002fdf8630 trb-start 000000002fdf8640 trb-end 000000002fdf8650 [ 2.646560] xhci_hcd 0000:03:00.0: ERROR Transfer event TRB DMA ptr not part of current TD ep_index 18 comp_code 13 [ 2.646568] xhci_hcd 0000:03:00.0: Looking for event-dma 000000002fdf8660 trb-start 000000002fdf8670 trb-end 000000002fdf8670
Etron xHC generates two transfer events for the TRB if an error is detected while processing the last TRB of an isoc TD.
The first event can be any sort of error (like USB Transaction or Babble Detected, etc), and the final event is Success.
The xHCI driver will handle the TD after the first event and remove it from its internal list, and then print an "Transfer event TRB DMA ptr not part of current TD" error message after the final event.
Commit 5372c65e1311 ("xhci: process isoc TD properly when there was a transaction error mid TD.") is designed to address isoc transaction errors, but unfortunately it doesn't account for this scenario.
This issue is similar to the XHCI_SPURIOUS_SUCCESS case where a success event follows a 'short transfer' event, but the TD the event points to is already given back.
Expand the spurious success 'short transfer' event handling to cover the spurious success after error on Etron hosts.
Kuangyi Chiang reported this issue and submitted a different solution based on using error_mid_td. This commit message is mostly taken from that patch.
--- drivers/usb/host/xhci-ring.c | 38 ++++++++++++++++++++++++------------ drivers/usb/host/xhci.h | 2 +- 2 files changed, 27 insertions(+), 13 deletions(-)
drivers/usb/host/xhci-ring.c +26 -12
@@ -2642,6 +2642,22 @@ static int handle_transferless_tx_event(struct xhci_hcd *xhci, struct xhci_virt_return 0 ; } +static bool xhci_spurious_success_tx_event (struct xhci_hcd *xhci, +struct xhci_ring *ring) +{ +switch (ring->old_trb_comp_code) { +case COMP_SHORT_PACKET : +return xhci->quirks &XHCI_SPURIOUS_SUCCESS ; +case COMP_USB_TRANSACTION_ERROR : +case COMP_BABBLE_DETECTED_ERROR : +case COMP_ISOCH_BUFFER_OVERRUN : +return xhci->quirks &XHCI_ETRON_HOST && + ring->type ==TYPE_ISOC ; +default : +return false; + } +} +/* * If this function returns an error condition, it means it got a Transfer * event with a corrupted Slot ID, Endpoint ID, or TRB DMA address.
@@ -2696,8 +2712,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,case COMP_SUCCESS :if (EVENT_TRB_LEN (le32_to_cpu (event->transfer_len)) !=0 ) { trb_comp_code =COMP_SHORT_PACKET ; -xhci_dbg (xhci,"Successful completion on short TX for slot %u ep %u with last td short %d\n" , - slot_id, ep_index, ep_ring->last_td_was_short); +xhci_dbg (xhci,"Successful completion on short TX for slot %u ep %u with last td comp code %d\n" , + slot_id, ep_index, ep_ring->old_trb_comp_code); }break ;case COMP_SHORT_PACKET :
@@ -2851,7 +2867,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,if (trb_comp_code !=COMP_STOPPED && trb_comp_code !=COMP_STOPPED_LENGTH_INVALID && !ring_xrun_event && - !ep_ring->last_td_was_short) { + !xhci_spurious_success_tx_event (xhci, ep_ring)) {xhci_warn (xhci,"Event TRB for slot %u ep %u with no TDs queued\n" , slot_id, ep_index); }
@@ -2903,11 +2919,12 @@ static int handle_tx_event(struct xhci_hcd *xhci,/* * Some hosts give a spurious success event after a short -* transfer. Ignore it. +* transfer or error on last TRB. Ignore it. */ -if ((xhci->quirks &XHCI_SPURIOUS_SUCCESS ) && - ep_ring->last_td_was_short) { - ep_ring->last_td_was_short = false; +if (xhci_spurious_success_tx_event (xhci, ep_ring)) { +xhci_dbg (xhci,"Spurious event dma %pad, comp_code %u after %u\n" , + &ep_trb_dma, trb_comp_code, ep_ring->old_trb_comp_code); + ep_ring->old_trb_comp_code = trb_comp_code;return 0 ; }
@@ -2935,15 +2952,12 @@ static int handle_tx_event(struct xhci_hcd *xhci,*/ }while (ep->skip); + ep_ring->old_trb_comp_code = trb_comp_code; +/* Get out if a TD was queued at enqueue after the xrun occurred */ if (ring_xrun_event)return 0 ; -if (trb_comp_code ==COMP_SHORT_PACKET ) - ep_ring->last_td_was_short = true; -else - ep_ring->last_td_was_short = false; - ep_trb = &ep_seg->trbs[(ep_trb_dma - ep_seg->dma) /sizeof (*ep_trb)];trace_xhci_handle_transfer (ep_ring, (struct xhci_generic_trb *) ep_trb);
drivers/usb/host/xhci.h +1 -1
@@ -1360,7 +1360,7 @@ struct xhci_ring {unsigned int num_trbs_free;/* used only by xhci DbC */ unsigned int bounce_buf_len;enum xhci_ring_type type; -bool last_td_was_short; +u32 old_trb_comp_code;struct radix_tree_root *trb_address_map; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 179/280 i3c: master: svc: Add support for Nuvoton npcm845 i3c
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanley Chu <[email protected]>
[ Upstream commit 98d87600a04e42282797631aa6b98dd43999e274 ]
Nuvoton npcm845 SoC uses an older IP version, which has specific hardware issues that need to be addressed with a different compatible string.
Add driver data for different compatible strings to define platform specific quirks.
Add compatible string for npcm845 to define its own driver data.
--- drivers/i3c/master/svc-i3c-master.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/i3c/master/svc-i3c-master.c +16 -1
@@ -158,6 +158,10 @@ struct svc_i3c_regs_save {u32 mdynaddr; }; +struct svc_i3c_drvdata { +u32 quirks; +}; +/** * struct svc_i3c_master - Silvaco I3C Master structure * @base: I3C master controller
@@ -183,6 +187,7 @@ struct svc_i3c_regs_save {* @ibi.tbq_slot: To be queued IBI slot * @ibi.lock: IBI lock * @lock: Transfer lock, protect between IBI work thread and callbacks from master +* @drvdata: Driver data * @enabled_events: Bit masks for enable events (IBI, HotJoin). * @mctrl_config: Configuration value in SVC_I3C_MCTRL for setting speed back. */
@@ -214,6 +219,7 @@ struct svc_i3c_master {spinlock_t lock; } ibi;struct mutex lock; +const struct svc_i3c_drvdata *drvdata;u32 enabled_events;u32 mctrl_config; };
@@ -1768,6 +1774,10 @@ static int svc_i3c_master_probe(struct platform_device *pdev)if (!master)return -ENOMEM ; + master->drvdata =of_device_get_match_data (dev); +if (!master->drvdata) +return -EINVAL ; + master->regs =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (master->regs))return PTR_ERR (master->regs);
@@ -1909,8 +1919,13 @@ static const struct dev_pm_ops svc_i3c_pm_ops = { svc_i3c_runtime_resume, NULL) }; +static const struct svc_i3c_drvdata npcm845_drvdata = {}; + +static const struct svc_i3c_drvdata svc_default_drvdata = {}; +static const struct of_device_id svc_i3c_master_of_match_tbl[] = { - { .compatible ="silvaco,i3c-master-v1" }, + { .compatible ="nuvoton,npcm845-i3c" , .data = &npcm845_drvdata }, + { .compatible ="silvaco,i3c-master-v1" , .data = &svc_default_drvdata }, {/* sentinel */ }, };MODULE_DEVICE_TABLE (of, svc_i3c_master_of_match_tbl);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 180/280 dmaengine: dmatest: Fix dmatest waiting less when interrupted
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinicius Costa Gomes <[email protected]>
[ Upstream commit e87ca16e99118ab4e130a41bdf12abbf6a87656c ]
Change the "wait for operation finish" logic to take interrupts into account.
When using dmatest with idxd DMA engine, it's possible that during longer tests, the interrupt notifying the finish of an operation happens during wait_event_freezable_timeout(), which causes dmatest to cleanup all the resources, some of which might still be in use.
This fix ensures that the wait logic correctly handles interrupts, preventing premature cleanup of resources.
--- drivers/dma/dmatest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/dma/dmatest.c +3 -3
@@ -841,9 +841,9 @@ static int dmatest_func(void *data) }else {dma_async_issue_pending (chan); -wait_event_freezable_timeout (thread->done_wait, - done->done, -msecs_to_jiffies (params->timeout)); +wait_event_timeout (thread->done_wait, + done->done, +msecs_to_jiffies (params->timeout)); status =dma_async_is_tx_complete (chan, cookie,NULL ,NULL );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 181/280 usb: xhci: Avoid Stop Endpoint retry loop if the endpoint seems Running
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pecio <[email protected]>
[ Upstream commit 28a76fcc4c85dd39633fb96edb643c91820133e3 ]
Nothing prevents a broken HC from claiming that an endpoint is Running and repeatedly rejecting Stop Endpoint with Context State Error.
Avoid infinite retries and give back cancelled TDs.
No such cases known so far, but HCs have bugs.
--- drivers/usb/host/xhci-ring.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/usb/host/xhci-ring.c +7 -4
@@ -1190,16 +1190,19 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id,* Stopped state, but it will soon change to Running. * * Assume this bug on unexpected Stop Endpoint failures. -* Keep retrying until the EP starts and stops again, on -* chips where this is known to help. Wait for 100ms. +* Keep retrying until the EP starts and stops again. */ -if (time_is_before_jiffies (ep->stop_time +msecs_to_jiffies (100 ))) -break ; fallthrough;case EP_STATE_RUNNING :/* Race, HW handled stop ep cmd before ep was running */ xhci_dbg (xhci,"Stop ep completion ctx error, ctx_state %d\n" ,GET_EP_CTX_STATE (ep_ctx)); +/* +* Don't retry forever if we guessed wrong or a defective HC never starts +* the EP or says 'Running' but fails the command. We must give back TDs. +*/ +if (time_is_before_jiffies (ep->stop_time +msecs_to_jiffies (100 ))) +break ; command =xhci_alloc_command (xhci, false,GFP_ATOMIC );if (!command) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 182/280 phy: rockchip: usbdp: Avoid call hpd_event_trigger in dp_phy_init
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Yan <[email protected]>
[ Upstream commit 28dc672a1a877c77b000c896abd8f15afcdc1b0c ]
Function rk_udphy_dp_hpd_event_trigger will set vogrf let it trigger HPD interrupt to DP by Type-C. This configuration is only required when the DP work in Alternate Mode, and called by typec_mux_set. In standard DP mode, such settings will prevent the DP from receiving HPD interrupts.
--- drivers/phy/rockchip/phy-rockchip-usbdp.c | 1 - 1 file changed, 1 deletion(-)
drivers/phy/rockchip/phy-rockchip-usbdp.c +0 -1
@@ -1045,7 +1045,6 @@ static int rk_udphy_dp_phy_init(struct phy *phy)mutex_lock (&udphy->mutex); udphy->dp_in_use = true; -rk_udphy_dp_hpd_event_trigger (udphy, udphy->dp_sink_hpd_cfg);mutex_unlock (&udphy->mutex);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 183/280 usb: gadget: aspeed: Add NULL pointer check in ast_vhub_init_dev()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenyuan Yang <[email protected]>
[ Upstream commit 8c75f3e6a433d92084ad4e78b029ae680865420f ]
The variable d->name, returned by devm_kasprintf(), could be NULL. A pointer check is added to prevent potential NULL pointer dereference. This is similar to the fix in commit 3027e7b15b02
("ice: Fix some null pointer dereference issues in ice_ptp.c").
This issue is found by our static analysis tool
--- drivers/usb/gadget/udc/aspeed-vhub/dev.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/gadget/udc/aspeed-vhub/dev.c +3 -0
@@ -548,6 +548,9 @@ int ast_vhub_init_dev(struct ast_vhub *vhub, unsigned int idx) d->vhub = vhub; d->index = idx; d->name =devm_kasprintf (parent,GFP_KERNEL ,"port%d" , idx+1 ); +if (!d->name) +return -ENOMEM ; + d->regs = vhub->regs +0x100 +0x10 * idx;ast_vhub_init_ep0 (vhub, &d->ep0, d);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 184/280 usb: host: xhci-plat: mvebu: use ->quirks instead of ->init_quirk() func
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Théo Lebrun <[email protected]>
[ Upstream commit 64eb182d5f7a5ec30227bce4f6922ff663432f44 ]
Compatible "marvell,armada3700-xhci" match data uses the struct xhci_plat_priv::init_quirk() function pointer to add XHCI_RESET_ON_RESUME as quirk on XHCI.
Instead, use the struct xhci_plat_priv::quirks field.
--- drivers/usb/host/xhci-mvebu.c | 10 ---------- drivers/usb/host/xhci-mvebu.h | 6 ------ drivers/usb/host/xhci-plat.c | 2 +- 3 files changed, 1 insertion(+), 17 deletions(-)
drivers/usb/host/xhci-mvebu.c +0 -10
@@ -73,13 +73,3 @@ int xhci_mvebu_mbus_init_quirk(struct usb_hcd *hcd)return 0 ; } - -int xhci_mvebu_a3700_init_quirk (struct usb_hcd *hcd) -{ -struct xhci_hcd *xhci =hcd_to_xhci (hcd); - -/* Without reset on resume, the HC won't work at all */ - xhci->quirks |=XHCI_RESET_ON_RESUME ; - -return 0 ; -}
drivers/usb/host/xhci-mvebu.h +0 -6
@@ -12,16 +12,10 @@ struct usb_hcd;#if IS_ENABLED (CONFIG_USB_XHCI_MVEBU )int xhci_mvebu_mbus_init_quirk (struct usb_hcd *hcd); -int xhci_mvebu_a3700_init_quirk (struct usb_hcd *hcd);#else static inline int xhci_mvebu_mbus_init_quirk (struct usb_hcd *hcd) {return 0 ; } - -static inline int xhci_mvebu_a3700_init_quirk (struct usb_hcd *hcd) -{ -return 0 ; -}#endif #endif /* __LINUX_XHCI_MVEBU_H */
drivers/usb/host/xhci-plat.c +1 -1
@@ -106,7 +106,7 @@ static const struct xhci_plat_priv xhci_plat_marvell_armada = { };static const struct xhci_plat_priv xhci_plat_marvell_armada3700 = { - .init_quirk = xhci_mvebu_a3700_init_quirk, + .quirks =XHCI_RESET_ON_RESUME , };static const struct xhci_plat_priv xhci_plat_brcm = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 185/280 thunderbolt: Scan retimers after device router has been enumerated
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mika Westerberg <[email protected]>
[ Upstream commit 75749d2c1d8cef439f8b69fa1f4f36d0fc3193e6 ]
Thomas reported connection issues on AMD system with Pluggable UD-4VPD dock. After some experiments it looks like the device has some sort of internal timeout that triggers reconnect. This is completely against the USB4 spec, as there is no requirement for the host to enumerate the device right away or even at all.
In Linux case the delay is caused by scanning of retimers on the link so we can work this around by doing the scanning after the device router has been enumerated.
--- drivers/thunderbolt/tb.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/thunderbolt/tb.c +14 -2
@@ -1295,11 +1295,15 @@ static void tb_scan_port(struct tb_port *port) goto out_rpm_put; } -tb_retimer_scan (port, true); - sw =tb_switch_alloc (port->sw->tb, &port->sw->dev,tb_downstream_route (port));if (IS_ERR (sw)) { +/* +* Make the downstream retimers available even if there +* is no router connected. +*/ +tb_retimer_scan (port, true); +/* * If there is an error accessing the connected switch * it may be connected to another domain. Also we allow
@@ -1349,6 +1353,14 @@ static void tb_scan_port(struct tb_port *port) upstream_port =tb_upstream_port (sw);tb_configure_link (port, upstream_port, sw); +/* +* Scan for downstream retimers. We only scan them after the +* router has been enumerated to avoid issues with certain +* Pluggable devices that expect the host to enumerate them +* within certain timeout. +*/ +tb_retimer_scan (port, true); +/* * CL0s and CL1 are enabled and supported together. * Silently ignore CLx enabling in case CLx is not supported.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 186/280 um: work around sched_yield not yielding in time-travel mode
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Berg <[email protected]>
[ Upstream commit 887c5c12e80c8424bd471122d2e8b6b462e12874 ]
sched_yield by a userspace may not actually cause scheduling in time-travel mode as no time has passed. In the case seen it appears to be a badly implemented userspace spinlock in ASAN. Unfortunately, with time-travel it causes an extreme slowdown or even deadlock depending on the kernel configuration (CONFIG_UML_MAX_USERSPACE_ITERATIONS).
Work around it by accounting time to the process whenever it executes a sched_yield syscall.
--- arch/um/include/linux/time-internal.h | 2 ++ arch/um/kernel/skas/syscall.c | 11 +++++++++++ 2 files changed, 13 insertions(+)
arch/um/include/linux/time-internal.h +2 -0
@@ -83,6 +83,8 @@ extern void time_travel_not_configured(void);#define time_travel_del_event (...) time_travel_not_configured()#endif /* CONFIG_UML_TIME_TRAVEL_SUPPORT */ +extern unsigned long tt_extra_sched_jiffies; +/* * Without CONFIG_UML_TIME_TRAVEL_SUPPORT this is a linker error if used, * which is intentional since we really shouldn't link it in that case.
arch/um/kernel/skas/syscall.c +11 -0
@@ -31,6 +31,17 @@ void handle_syscall(struct uml_pt_regs *r) goto out; syscall =UPT_SYSCALL_NR (r); + +/* +* If no time passes, then sched_yield may not actually yield, causing +* broken spinlock implementations in userspace (ASAN) to hang for long +* periods of time. +*/ +if ((time_travel_mode ==TT_MODE_INFCPU || + time_travel_mode ==TT_MODE_EXTERNAL ) && + syscall == __NR_sched_yield) + tt_extra_sched_jiffies +=1 ; +if (syscall >=0 && syscall < __NR_syscalls) {unsigned long ret =EXECUTE_SYSCALL (syscall, regs);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 187/280 objtool: Silence more KCOV warnings
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
[ Upstream commit 6b023c7842048c4bbeede802f3cf36b96c7a8b25 ]
In the past there were issues with KCOV triggering unreachable instruction warnings, which is why unreachable warnings are now disabled with CONFIG_KCOV.
Now some new KCOV warnings are showing up with GCC 14:
vmlinux.o: warning: objtool: cpuset_write_resmask() falls through to next function cpuset_update_active_cpus.cold() drivers/usb/core/driver.o: error: objtool: usb_deregister() falls through to next function usb_match_device() sound/soc/codecs/snd-soc-wcd934x.o: warning: objtool: .text.wcd934x_slim_irq_handler: unexpected end of section
All are caused by GCC KCOV not finishing an optimization, leaving behind a never-taken conditional branch to a basic block which falls through to the next function (or end of section).
At a high level this is similar to the unreachable warnings mentioned above, in that KCOV isn't fully removing dead code. Treat it the same way by adding these to the list of warnings to ignore with CONFIG_KCOV.
--- tools/objtool/check.c | 6 ++++++ 1 file changed, 6 insertions(+)
tools/objtool/check.c +6 -0
@@ -3634,6 +3634,9 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, !strncmp(func->name, "__pfx_", 6))return 0 ; +if (file->ignore_unreachables) +return 0 ; +WARN ("%s() falls through to next function %s()" , func->name,insn_func (insn)->name);return 1 ;
@@ -3853,6 +3856,9 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,if (!next_insn) {if (state.cfi.cfa.base ==CFI_UNDEFINED )return 0 ; +if (file->ignore_unreachables) +return 0 ; +WARN ("%s: unexpected end of section" , sec->name);return 1 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 188/280 objtool, panic: Disable SMAP in __stack_chk_fail()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
[ Upstream commit 72c774aa9d1e16bfd247096935e7dae194d84929 ]
__stack_chk_fail() can be called from uaccess-enabled code. Make sure uaccess gets disabled before calling panic().
Fixes the following warning:
kernel/trace/trace_branch.o: error: objtool: ftrace_likely_update+0x1ea: call to __stack_chk_fail() with UACCESS enabled
--- kernel/panic.c | 6 ++++++ tools/objtool/check.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-)
kernel/panic.c +6 -0
@@ -832,9 +832,15 @@ device_initcall(register_warn_debugfs);*/ __visible noinstr void __stack_chk_fail(void) { +unsigned long flags; +instrumentation_begin (); + flags =user_access_save (); +panic ("stack-protector: Kernel stack is corrupted in: %pB" ,__builtin_return_address (0 )); + +user_access_restore (flags);instrumentation_end (); }EXPORT_SYMBOL (__stack_chk_fail);
tools/objtool/check.c +4 -1
@@ -1243,12 +1243,15 @@ static const char *uaccess_safe_builtin[] = {"__ubsan_handle_load_invalid_value" ,/* STACKLEAK */ "stackleak_track_stack" , +/* TRACE_BRANCH_PROFILING */ +"ftrace_likely_update" , +/* STACKPROTECTOR */ +"__stack_chk_fail" ,/* misc */ "csum_partial_copy_generic" ,"copy_mc_fragile" ,"copy_mc_fragile_handle_tail" ,"copy_mc_enhanced_fast_string" , -"ftrace_likely_update" ,/* CONFIG_TRACE_BRANCH_PROFILING */ "rep_stos_alternative" ,"rep_movs_alternative" , "__copy_user_nocache",
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 189/280 objtool, ASoC: codecs: wcd934x: Remove potential undefined behavior in wcd934x_slim_irq_handler()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
[ Upstream commit 060aed9c0093b341480770457093449771cf1496 ]
If 'port_id' is negative, the shift counts in wcd934x_slim_irq_handler() also become negative, resulting in undefined behavior due to shift out of bounds.
If I'm reading the code correctly, that appears to be not possible, but with KCOV enabled, Clang's range analysis isn't always able to determine that and generates undefined behavior.
As a result the code generation isn't optimal, and undefined behavior should be avoided regardless. Improve code generation and remove the undefined behavior by converting the signed variables to unsigned.
Fixes the following warning with UBSAN:
sound/soc/codecs/snd-soc-wcd934x.o: warning: objtool: .text.wcd934x_slim_irq_handler: unexpected end of section
--- sound/soc/codecs/wcd934x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wcd934x.c +1 -1
@@ -2273,7 +2273,7 @@ static irqreturn_t wcd934x_slim_irq_handler(int irq, void *data) {struct wcd934x_codec *wcd = data;unsigned long status =0 ; -int i, j, port_id; +unsigned int i, j, port_id;unsigned int val, int_val =0 ;irqreturn_t ret =IRQ_NONE ;bool tx;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 190/280 objtool, regulator: rk808: Remove potential undefined behavior in rk806_set_mode_dcdc()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
[ Upstream commit 29c578c848402a34e8c8e115bf66cb6008b77062 ]
If 'ctr_bit' is negative, the shift counts become negative, causing a shift of bounds and undefined behavior.
Presumably that's not possible in normal operation, but the code generation isn't optimal. And undefined behavior should be avoided regardless.
Improve code generation and remove the undefined behavior by converting the signed variables to unsigned.
Fixes the following warning with an UBSAN kernel:
vmlinux.o: warning: objtool: rk806_set_mode_dcdc() falls through to next function rk806_get_mode_dcdc() vmlinux.o: warning: objtool: .text.rk806_set_mode_dcdc: unexpected end of section
--- drivers/regulator/rk808-regulator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/regulator/rk808-regulator.c +2 -2
@@ -270,8 +270,8 @@ static const unsigned int rk817_buck1_4_ramp_table[] = {static int rk806_set_mode_dcdc (struct regulator_dev *rdev,unsigned int mode) { -int rid =rdev_get_id (rdev); -int ctr_bit, reg; +unsigned int rid =rdev_get_id (rdev); +unsigned int ctr_bit, reg; reg =RK806_POWER_FPWM_EN0 + rid /8 ; ctr_bit = rid %8 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 191/280 objtool, lkdtm: Obfuscate the do_nothing() pointer
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
[ Upstream commit 05026ea01e95ffdeb0e5ac8fb7fb1b551e3a8726 ]
If execute_location()'s memcpy of do_nothing() gets inlined and unrolled by the compiler, it copies one word at a time:
mov 0x0(%rip),%rax R_X86_64_PC32 .text+0x1374
mov %rax,0x38(%rbx)
mov 0x0(%rip),%rax R_X86_64_PC32 .text+0x136c
mov %rax,0x30(%rbx)
...Those .text references point to the middle of the function, causing objtool to complain about their lack of ENDBR.
Prevent that by resolving the function pointer at runtime rather than build time. This fixes the following warning:
drivers/misc/lkdtm/lkdtm.o: warning: objtool: execute_location+0x23: relocation to !ENDBR: .text+0x1378
--- drivers/misc/lkdtm/perms.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/misc/lkdtm/perms.c +11 -3
@@ -28,6 +28,13 @@ static const unsigned long rodata = 0xAA55AA55;/* This is marked __ro_after_init, so it should ultimately be .rodata. */ static unsigned long ro_after_init__ro_after_init =0x55AA5500 ; +/* +* This is a pointer to do_nothing() which is initialized at runtime rather +* than build time to avoid objtool IBT validation warnings caused by an +* inlined unrolled memcpy() in execute_location(). +*/ +static void __ro_after_init *do_nothing_ptr; +/* * This just returns to the caller. It is designed to be copied into * non-executable memory regions.
@@ -65,13 +72,12 @@ static noinline __nocfi void execute_location(void *dst, bool write) {void (*func)(void );func_desc_t fdesc; -void *do_nothing_text =dereference_function_descriptor (do_nothing); -pr_info ("attempting ok execution at %px\n" , do_nothing_text); +pr_info ("attempting ok execution at %px\n" , do_nothing_ptr);do_nothing ();if (write ==CODE_WRITE ) { -memcpy (dst, do_nothing_text,EXEC_SIZE ); +memcpy (dst, do_nothing_ptr,EXEC_SIZE );flush_icache_range ((unsigned long )dst, (unsigned long )dst +EXEC_SIZE ); }
@@ -267,6 +273,8 @@ static void lkdtm_ACCESS_NULL(void)void __init lkdtm_perms_init (void ) { + do_nothing_ptr =dereference_function_descriptor (do_nothing); +/* Make sure we can write to __ro_after_init values during __init */ ro_after_init |=0xAA ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 192/280 qibfs: fix _another_ leak
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit bdb43af4fdb39f844ede401bdb1258f67a580a27 ]
failure to allocate inode => leaked dentry...
this one had been there since the initial merge; to be fair, if we are that far OOM, the odds of failing at that particular allocation are low...
--- drivers/infiniband/hw/qib/qib_fs.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/qib/qib_fs.c +1 -0
@@ -55,6 +55,7 @@ static int qibfs_mknod(struct inode *dir, struct dentry *dentry,struct inode *inode =new_inode (dir->i_sb);if (!inode) { +dput (dentry); error = -EPERM ; goto bail; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 193/280 ntb: reduce stack usage in idt_scan_mws
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit aff12700b8dd7422bfe2277696e192af4df9de8f ]
idt_scan_mws() puts a large fixed-size array on the stack and copies it into a smaller dynamically allocated array at the end. On 32-bit targets, the fixed size can easily exceed the warning limit for possible stack overflow:
drivers/ntb/hw/idt/ntb_hw_idt.c:1041:27: error: stack frame size (1032) exceeds limit (1024) in 'idt_scan_mws' [-Werror,-Wframe-larger-than]
Change it to instead just always use dynamic allocation for the array from the start. It's too big for the stack, but not actually all that much for a permanent allocation.
--- drivers/ntb/hw/idt/ntb_hw_idt.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
drivers/ntb/hw/idt/ntb_hw_idt.c +7 -11
@@ -1041,7 +1041,7 @@ static inline char *idt_get_mw_name(enum idt_mw_type mw_type)static struct idt_mw_cfg *idt_scan_mws (struct idt_ntb_dev *ndev,int port,unsigned char *mw_cnt) { -struct idt_mw_cfg mws[IDT_MAX_NR_MWS ], *ret_mws; +struct idt_mw_cfg *mws;const struct idt_ntb_bar *bars;enum idt_mw_type mw_type;unsigned char widx, bidx, en_cnt;
@@ -1049,6 +1049,11 @@ static struct idt_mw_cfg *idt_scan_mws(struct idt_ntb_dev *ndev, int port,int aprt_size;u32 data; + mws =devm_kcalloc (&ndev->ntb.pdev->dev,IDT_MAX_NR_MWS , +sizeof (*mws),GFP_KERNEL ); +if (!mws) +return ERR_PTR (-ENOMEM ); +/* Retrieve the array of the BARs registers */ bars = portdata_tbl[port].bars;
@@ -1103,16 +1108,7 @@ static struct idt_mw_cfg *idt_scan_mws(struct idt_ntb_dev *ndev, int port, } } -/* Allocate memory for memory window descriptors */ - ret_mws =devm_kcalloc (&ndev->ntb.pdev->dev, *mw_cnt,sizeof (*ret_mws), -GFP_KERNEL ); -if (!ret_mws) -return ERR_PTR (-ENOMEM ); - -/* Copy the info of detected memory windows */ -memcpy (ret_mws, mws, (*mw_cnt)*sizeof (*ret_mws)); - -return ret_mws; +return mws; }/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 194/280 ntb_hw_amd: Add NTB PCI ID for new gen CPU
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Basavaraj Natikar <[email protected]>
[ Upstream commit bf8a7ce7e4c7267a6f5f2b2023cfc459b330b25e ]
Add NTB support for new generation of processor.
--- drivers/ntb/hw/amd/ntb_hw_amd.c | 1 + 1 file changed, 1 insertion(+)
drivers/ntb/hw/amd/ntb_hw_amd.c +1 -0
@@ -1318,6 +1318,7 @@ static const struct pci_device_id amd_ntb_pci_tbl[] = { { PCI_VDEVICE(AMD, 0x148b), (kernel_ulong_t)&dev_data[1] }, { PCI_VDEVICE(AMD, 0x14c0), (kernel_ulong_t)&dev_data[1] }, { PCI_VDEVICE(AMD, 0x14c3), (kernel_ulong_t)&dev_data[1] }, + { PCI_VDEVICE(AMD, 0x155a), (kernel_ulong_t)&dev_data[1] }, { PCI_VDEVICE(HYGON, 0x145b), (kernel_ulong_t)&dev_data[0] }, { 0, } };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 195/280 9p/net: fix improper handling of bogus negative read/write replies
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dominique Martinet <[email protected]>
[ Upstream commit d0259a856afca31d699b706ed5e2adf11086c73b ]
In p9_client_write() and p9_client_read_once(), if the server incorrectly replies with success but a negative write/read count then we would consider written (negative) <= rsize (positive) because both variables were signed.
Make variables unsigned to avoid this problem.
The reproducer linked below now fails with the following error instead of a null pointer deref:
9pnet: bogus RWRITE count (4294967295 > 3)
Message-ID: <[email protected]>
--- net/9p/client.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-)
net/9p/client.c +16 -14
@@ -1548,7 +1548,8 @@ p9_client_read_once(struct p9_fid *fid, u64 offset, struct iov_iter *to,struct p9_client *clnt = fid->clnt;struct p9_req_t *req;int count =iov_iter_count (to); -int rsize, received, non_zc =0 ; +u32 rsize, received; +bool non_zc = false;char *dataptr; *err =0 ;
@@ -1571,7 +1572,7 @@ p9_client_read_once(struct p9_fid *fid, u64 offset, struct iov_iter *to,0 ,11 ,"dqd" , fid->fid, offset, rsize); }else { - non_zc =1 ; + non_zc = true; req =p9_client_rpc (clnt,P9_TREAD ,"dqd" , fid->fid, offset, rsize); }
@@ -1592,11 +1593,11 @@ p9_client_read_once(struct p9_fid *fid, u64 offset, struct iov_iter *to,return 0 ; }if (rsize < received) { -pr_err ("bogus RREAD count (%d > %d)\n" , received, rsize); +pr_err ("bogus RREAD count (%u > %u)\n" , received, rsize); received = rsize; } -p9_debug (P9_DEBUG_9P ,"<<< RREAD count %d\n" , received); +p9_debug (P9_DEBUG_9P ,"<<< RREAD count %u\n" , received);if (non_zc) {int n =copy_to_iter (dataptr, received, to);
@@ -1623,9 +1624,9 @@ p9_client_write(struct p9_fid *fid, u64 offset, struct iov_iter *from, int *err) *err =0 ;while (iov_iter_count (from)) { -int count =iov_iter_count (from); -int rsize = fid->iounit; -int written; +size_t count =iov_iter_count (from); +u32 rsize = fid->iounit; +u32 written;if (!rsize || rsize > clnt->msize -P9_IOHDRSZ ) rsize = clnt->msize -P9_IOHDRSZ ;
@@ -1633,7 +1634,7 @@ p9_client_write(struct p9_fid *fid, u64 offset, struct iov_iter *from, int *err)if (count < rsize) rsize = count; -p9_debug (P9_DEBUG_9P ,">>> TWRITE fid %d offset %llu count %d (/%d)\n" , +p9_debug (P9_DEBUG_9P ,">>> TWRITE fid %d offset %llu count %u (/%zu)\n" , fid->fid, offset, rsize, count);/* Don't bother zerocopy for small IO (< 1024) */
@@ -1659,11 +1660,11 @@ p9_client_write(struct p9_fid *fid, u64 offset, struct iov_iter *from, int *err)break ; }if (rsize < written) { -pr_err ("bogus RWRITE count (%d > %d)\n" , written, rsize); +pr_err ("bogus RWRITE count (%u > %u)\n" , written, rsize); written = rsize; } -p9_debug (P9_DEBUG_9P ,"<<< RWRITE count %d\n" , written); +p9_debug (P9_DEBUG_9P ,"<<< RWRITE count %u\n" , written);p9_req_put (clnt, req);iov_iter_revert (from, count - written -iov_iter_count (from));
@@ -2098,7 +2099,8 @@ EXPORT_SYMBOL_GPL(p9_client_xattrcreate);int p9_client_readdir (struct p9_fid *fid,char *data,u32 count,u64 offset) { -int err, rsize, non_zc =0 ; +int err, non_zc =0 ; +u32 rsize;struct p9_client *clnt;struct p9_req_t *req;char *dataptr;
@@ -2107,7 +2109,7 @@ int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset)iov_iter_kvec (&to,ITER_DEST , &kv,1 , count); -p9_debug (P9_DEBUG_9P ,">>> TREADDIR fid %d offset %llu count %d\n" , +p9_debug (P9_DEBUG_9P ,">>> TREADDIR fid %d offset %llu count %u\n" , fid->fid, offset, count); clnt = fid->clnt;
@@ -2142,11 +2144,11 @@ int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset) goto free_and_error; }if (rsize < count) { -pr_err ("bogus RREADDIR count (%d > %d)\n" , count, rsize); +pr_err ("bogus RREADDIR count (%u > %u)\n" , count, rsize); count = rsize; } -p9_debug (P9_DEBUG_9P ,"<<< RREADDIR count %d\n" , count); +p9_debug (P9_DEBUG_9P ,"<<< RREADDIR count %u\n" , count);if (non_zc)memmove (data, dataptr, count);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 196/280 9p/trans_fd: mark concurrent read and writes to p9_conn->err
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ignacio Encinas <[email protected]>
[ Upstream commit fbc0283fbeae27b88448c90305e738991457fee2 ]
Writes for the error value of a connection are spinlock-protected inside p9_conn_cancel, but lockless reads are present elsewhere to avoid performing unnecessary work after an error has been met.
Mark the write and lockless reads to make KCSAN happy. Mark the write as exclusive following the recommendation in "Lock-Protected Writes with Lockless Reads" in tools/memory-model/Documentation/access-marking.txt while we are at it.
Mark p9_fd_request and p9_conn_cancel m->err reads despite the fact that they do not race with concurrent writes for stylistic reasons.
Message-ID: <20250318-p9_conn_err_benign_data_race-v3-1-290bb18335cc@iencinas.com>
--- net/9p/trans_fd.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
net/9p/trans_fd.c +10 -7
@@ -191,12 +191,13 @@ static void p9_conn_cancel(struct p9_conn *m, int err)spin_lock (&m->req_lock); -if (m->err) { +if (READ_ONCE (m->err)) {spin_unlock (&m->req_lock);return ; } - m->err = err; +WRITE_ONCE (m->err, err); +ASSERT_EXCLUSIVE_WRITER (m->err);list_for_each_entry_safe (req, rtmp, &m->req_list, req_list) {list_move (&req->req_list, &cancel_list);
@@ -283,7 +284,7 @@ static void p9_read_work(struct work_struct *work) m = container_of(work, struct p9_conn, rq); -if (m->err <0 ) +if (READ_ONCE (m->err) <0 )return ;p9_debug (P9_DEBUG_TRANS ,"start mux %p pos %zd\n" , m, m->rc.offset);
@@ -450,7 +451,7 @@ static void p9_write_work(struct work_struct *work) m = container_of(work, struct p9_conn, wq); -if (m->err <0 ) { +if (READ_ONCE (m->err) <0 ) {clear_bit (Wworksched, &m->wsched);return ; }
@@ -622,7 +623,7 @@ static void p9_poll_mux(struct p9_conn *m)__poll_t n;int err = -ECONNRESET ; -if (m->err <0 ) +if (READ_ONCE (m->err) <0 )return ; n =p9_fd_poll (m->client,NULL , &err);
@@ -665,6 +666,7 @@ static void p9_poll_mux(struct p9_conn *m)static int p9_fd_request (struct p9_client *client,struct p9_req_t *req) {__poll_t n; +int err;struct p9_trans_fd *ts = client->trans;struct p9_conn *m = &ts->conn;
@@ -673,9 +675,10 @@ static int p9_fd_request(struct p9_client *client, struct p9_req_t *req)spin_lock (&m->req_lock); -if (m->err <0 ) { + err =READ_ONCE (m->err); +if (err <0 ) {spin_unlock (&m->req_lock); -return m->err; +return err; }WRITE_ONCE (req->status,REQ_STATUS_UNSENT );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 197/280 rtc: pcf85063: do a SW reset if POR failed
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Stockmann <[email protected]>
[ Upstream commit 2b7cbd98495f6ee4cd6422fe77828a19e9edf87f ]
Power-on Reset has a documented issue in PCF85063, refer to its datasheet, section "Software reset":
"There is a low probability that some devices will have corruption of the registers after the automatic power-on reset if the device is powered up with a residual VDD level. It is required that the VDD starts at zero volts at power up or upon power cycling to ensure that there is no corruption of the registers. If this is not possible, a reset must be initiated after power-up (i.e. when power is stable) with the software reset command"
Trigger SW reset if there is an indication that POR has failed.
--- drivers/rtc/rtc-pcf85063.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/rtc/rtc-pcf85063.c +18 -1
@@ -35,6 +35,7 @@#define PCF85063_REG_CTRL1_CAP_SEL BIT(0)#define PCF85063_REG_CTRL1_STOP BIT(5)#define PCF85063_REG_CTRL1_EXT_TEST BIT(7) +#define PCF85063_REG_CTRL1_SWR 0x58#define PCF85063_REG_CTRL2 0x01#define PCF85063_CTRL2_AF BIT(6)
@@ -589,7 +590,7 @@ static int pcf85063_probe(struct i2c_client *client)i2c_set_clientdata (client, pcf85063); - err =regmap_read (pcf85063->regmap,PCF85063_REG_CTRL1 , &tmp); + err =regmap_read (pcf85063->regmap,PCF85063_REG_SC , &tmp);if (err) {dev_err (&client->dev,"RTC chip is not present\n" );return err;
@@ -599,6 +600,22 @@ static int pcf85063_probe(struct i2c_client *client)if (IS_ERR (pcf85063->rtc))return PTR_ERR (pcf85063->rtc); +/* +* If a Power loss is detected, SW reset the device. +* From PCF85063A datasheet: +* There is a low probability that some devices will have corruption +* of the registers after the automatic power-on reset... +*/ +if (tmp &PCF85063_REG_SC_OS ) { +dev_warn (&client->dev, +"POR issue detected, sending a SW reset\n" ); + err =regmap_write (pcf85063->regmap,PCF85063_REG_CTRL1 , +PCF85063_REG_CTRL1_SWR ); +if (err <0 ) +dev_warn (&client->dev, +"SW reset failed, trying to continue\n" ); + } + err =pcf85063_load_capacitance (pcf85063, client->dev.of_node, config->force_cap_7000 ?7000 :0 );if (err <0 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 198/280 io_uring: always do atomic put from iowq
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
[ Upstream commit 390513642ee6763c7ada07f0a1470474986e6c1c ]
io_uring always switches requests to atomic refcounting for iowq execution before there is any parallilism by setting REQ_F_REFCOUNT, and the flag is not cleared until the request completes. That should be fine as long as the compiler doesn't make up a non existing value for the flags, however KCSAN still complains when the request owner changes oter flag bits:
BUG: KCSAN: data-race in io_req_task_cancel / io_wq_free_work
...
read to 0xffff888117207448 of 8 bytes by task 3871 on cpu 0:
req_ref_put_and_test io_uring/refs.h:22 [inline]
Skip REQ_F_REFCOUNT checks for iowq, we know it's set.
--- io_uring/io_uring.c | 2 +- io_uring/refs.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-)
io_uring/io_uring.c +1 -1
@@ -1778,7 +1778,7 @@ struct io_wq_work *io_wq_free_work(struct io_wq_work *work) struct io_kiocb *req = container_of(work, struct io_kiocb, work);struct io_kiocb *nxt =NULL ; -if (req_ref_put_and_test (req)) { +if (req_ref_put_and_test_atomic (req)) {if (req->flags &IO_REQ_LINK_FLAGS ) nxt =io_req_find_next (req);io_free_req (req);
io_uring/refs.h +7 -0
@@ -17,6 +17,13 @@ static inline bool req_ref_inc_not_zero(struct io_kiocb *req)return atomic_inc_not_zero (&req->refs); } +static inline bool req_ref_put_and_test_atomic (struct io_kiocb *req) +{ +WARN_ON_ONCE (!(data_race (req->flags) &REQ_F_REFCOUNT )); +WARN_ON_ONCE (req_ref_zero_or_close_to_overflow (req)); +return atomic_dec_and_test (&req->refs); +} +static inline bool req_ref_put_and_test (struct io_kiocb *req) {if (likely (!(req->flags &REQ_F_REFCOUNT )))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 199/280 kbuild: add dependency from vmlinux to sorttable
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xi Ruoyao <[email protected]>
[ Upstream commit 82c09de2d4c472ab1b973e6e033671020691e637 ]
Without this dependency it's really puzzling when we bisect for a "bad" commit in a series of sorttable change: when "git bisect" switches to another commit, "make" just does nothing to vmlinux.
--- scripts/Makefile.vmlinux | 4 ++++ 1 file changed, 4 insertions(+)
scripts/Makefile.vmlinux +4 -0
@@ -33,6 +33,10 @@ targets += vmlinux vmlinux: scripts/link-vmlinux.sh vmlinux.o $(KBUILD_LDS) FORCE +$(call if_changed_dep,link_vmlinux) +ifdef CONFIG_BUILDTIME_TABLE_SORT +vmlinux: scripts/sorttable +endif + # module.builtin.ranges # --------------------------------------------------------------------------- ifdef CONFIG_BUILTIN_MODULE_RANGES
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 200/280 sched/isolation: Make CONFIG_CPU_ISOLATION depend on CONFIG_SMP
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
[ Upstream commit 975776841e689dd8ba36df9fa72ac3eca3c2957a ]
kernel/sched/isolation.c obviously makes no sense without CONFIG_SMP, but the Kconfig entry we have right now:
config CPU_ISOLATION bool "CPU isolation" depends on SMP || COMPILE_TEST
allows the creation of pointless .config's which cause build failures.
--- init/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
init/Kconfig +1 -1
@@ -708,7 +708,7 @@ endmenu # "CPU/Task time and stats accounting" config CPU_ISOLATION bool "CPU isolation" - depends on SMP || COMPILE_TEST + depends on SMP default y help Make sure that CPUs running critical tasks are not disturbed by
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 201/280 KVM: s390: Dont use %pK through tracepoints
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit 6c9567e0850be2f0f94ab64fa6512413fd1a1eb1 ]
Restricted pointers ("%pK") are not meant to be used through TP_format(). It can unintentionally expose security sensitive, raw pointer values.
Use regular pointer formatting instead.
Message-ID: <20250217-restricted-pointers-s390-v1-1-0e4ace75d8aa@linutronix.de>
--- arch/s390/kvm/trace-s390.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/kvm/trace-s390.h +2 -2
@@ -56,7 +56,7 @@ TRACE_EVENT(kvm_s390_create_vcpu, __entry->sie_block = sie_block; ), -TP_printk ("create cpu %d at 0x%pK, sie block at 0x%pK" , +TP_printk ("create cpu %d at 0x%p, sie block at 0x%p" , __entry->id, __entry->vcpu, __entry->sie_block) );
@@ -255,7 +255,7 @@ TRACE_EVENT(kvm_s390_enable_css, __entry->kvm = kvm; ), -TP_printk ("enabling channel I/O support (kvm @ %pK)\n" , +TP_printk ("enabling channel I/O support (kvm @ %p)\n" , __entry->kvm) );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 202/280 KVM: s390: Dont use %pK through debug printing
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit 0c7fbae5bc782429c97d68dc40fb126748d7e352 ]
Restricted pointers ("%pK") are only meant to be used when directly printing to a file from task context.
Otherwise it can unintentionally expose security sensitive, raw pointer values.
Use regular pointer formatting instead.
Message-ID: <20250217-restricted-pointers-s390-v1-2-0e4ace75d8aa@linutronix.de>
--- arch/s390/kvm/intercept.c | 2 +- arch/s390/kvm/interrupt.c | 8 ++++---- arch/s390/kvm/kvm-s390.c | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-)
arch/s390/kvm/intercept.c +1 -1
@@ -94,7 +94,7 @@ static int handle_validity(struct kvm_vcpu *vcpu) vcpu->stat.exit_validity++;trace_kvm_s390_intercept_validity (vcpu, viwhy); -KVM_EVENT (3 ,"validity intercept 0x%x for pid %u (kvm 0x%pK)" , viwhy, +KVM_EVENT (3 ,"validity intercept 0x%x for pid %u (kvm 0x%p)" , viwhy, current->pid, vcpu->kvm);/* do not warn on invalid runtime instrumentation mode */
arch/s390/kvm/interrupt.c +4 -4
@@ -3161,7 +3161,7 @@ void kvm_s390_gisa_clear(struct kvm *kvm)if (!gi->origin)return ;gisa_clear_ipm (gi->origin); -VM_EVENT (kvm,3 ,"gisa 0x%pK cleared" , gi->origin); +VM_EVENT (kvm,3 ,"gisa 0x%p cleared" , gi->origin); }void kvm_s390_gisa_init (struct kvm *kvm)
@@ -3178,7 +3178,7 @@ void kvm_s390_gisa_init(struct kvm *kvm) gi->timer.function = gisa_vcpu_kicker;memset (gi->origin,0 ,sizeof (struct kvm_s390_gisa )); gi->origin->next_alert = (u32 )virt_to_phys (gi->origin); -VM_EVENT (kvm,3 ,"gisa 0x%pK initialized" , gi->origin); +VM_EVENT (kvm,3 ,"gisa 0x%p initialized" , gi->origin); }void kvm_s390_gisa_enable (struct kvm *kvm)
@@ -3219,7 +3219,7 @@ void kvm_s390_gisa_destroy(struct kvm *kvm)process_gib_alert_list ();hrtimer_cancel (&gi->timer); gi->origin =NULL ; -VM_EVENT (kvm,3 ,"gisa 0x%pK destroyed" , gisa); +VM_EVENT (kvm,3 ,"gisa 0x%p destroyed" , gisa); }void kvm_s390_gisa_disable (struct kvm *kvm)
@@ -3468,7 +3468,7 @@ int __init kvm_s390_gib_init(u8 nisc) } } -KVM_EVENT (3 ,"gib 0x%pK (nisc=%d) initialized" , gib, gib->nisc); +KVM_EVENT (3 ,"gib 0x%p (nisc=%d) initialized" , gib, gib->nisc); goto out; out_unreg_gal:
arch/s390/kvm/kvm-s390.c +5 -5
@@ -998,7 +998,7 @@ static int kvm_s390_set_mem_control(struct kvm *kvm, struct kvm_device_attr *att }mutex_unlock (&kvm->lock);VM_EVENT (kvm,3 ,"SET: max guest address: %lu" , new_limit); -VM_EVENT (kvm,3 ,"New guest asce: 0x%pK" , +VM_EVENT (kvm,3 ,"New guest asce: 0x%p" , (void *) kvm->arch.gmap->asce);break ; }
@@ -3421,7 +3421,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)kvm_s390_gisa_init (kvm);INIT_LIST_HEAD (&kvm->arch.pv.need_cleanup); kvm->arch.pv.set_aside =NULL ; -KVM_EVENT (3 ,"vm 0x%pK created by pid %u" , kvm, current->pid); +KVM_EVENT (3 ,"vm 0x%p created by pid %u" , kvm, current->pid);return 0 ; out_err:
@@ -3484,7 +3484,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm)kvm_s390_destroy_adapters (kvm);kvm_s390_clear_float_irqs (kvm);kvm_s390_vsie_destroy (kvm); -KVM_EVENT (3 ,"vm 0x%pK destroyed" , kvm); +KVM_EVENT (3 ,"vm 0x%p destroyed" , kvm); }/* Section: vcpu related */
@@ -3605,7 +3605,7 @@ static int sca_switch_to_extended(struct kvm *kvm)free_page ((unsigned long )old_sca); -VM_EVENT (kvm,2 ,"Switched to ESCA (0x%pK -> 0x%pK)" , +VM_EVENT (kvm,2 ,"Switched to ESCA (0x%p -> 0x%p)" , old_sca, kvm->arch.sca);return 0 ; }
@@ -3978,7 +3978,7 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu) goto out_free_sie_block; } -VM_EVENT (vcpu->kvm,3 ,"create cpu %d at 0x%pK, sie block at 0x%pK" , +VM_EVENT (vcpu->kvm,3 ,"create cpu %d at 0x%p, sie block at 0x%p" , vcpu->vcpu_id, vcpu, vcpu->arch.sie_block);trace_kvm_s390_create_vcpu (vcpu->vcpu_id, vcpu, vcpu->arch.sie_block);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 203/280 cgroup/cpuset: Dont allow creation of local partition over a remote one
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
[ Upstream commit 6da580ec656a5ed135db2cdf574b47635611a4d7 ]
Currently, we don't allow the creation of a remote partition underneath another local or remote partition. However, it is currently possible to create a new local partition with an existing remote partition underneath it if top_cpuset is the parent. However, the current cpuset code does not set the effective exclusive CPUs correctly to account for those that are taken by the remote partition.
Changing the code to properly account for those remote partition CPUs under all possible circumstances can be complex. It is much easier to not allow such a configuration which is not that useful. So forbid that by making sure that exclusive_cpus mask doesn't overlap with subpartitions_cpus and invalidate the partition if that happens.
--- kernel/cgroup/cpuset-internal.h | 1 + kernel/cgroup/cpuset.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+)
kernel/cgroup/cpuset-internal.h +1 -0
@@ -33,6 +33,7 @@ enum prs_errcode {PERR_CPUSEMPTY ,PERR_HKEEPING ,PERR_ACCESS , + PERR_REMOTE, };/* bits in struct cpuset flags field */
kernel/cgroup/cpuset.c +14 -0
@@ -62,6 +62,7 @@ static const char * const perr_strings[] = { [PERR_CPUSEMPTY] = "cpuset.cpus and cpuset.cpus.exclusive are empty", [PERR_HKEEPING] = "partition config conflicts with housekeeping setup", [PERR_ACCESS] = "Enable partition not permitted", + [PERR_REMOTE] = "Have remote partition underneath", };/*
@@ -2824,6 +2825,19 @@ static int update_prstate(struct cpuset *cs, int new_prs) goto out; } +/* +* We don't support the creation of a new local partition with +* a remote partition underneath it. This unsupported +* setting can happen only if parent is the top_cpuset because +* a remote partition cannot be created underneath an existing +* local or remote partition. +*/ +if ((parent == &top_cpuset) && +cpumask_intersects (cs->exclusive_cpus, subpartitions_cpus)) { + err =PERR_REMOTE ; + goto out; + } +/* * If parent is valid partition, enable local partiion. * Otherwise, enable a remote partition.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 204/280 selftests: ublk: fix test_stripe_04
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
[ Upstream commit 72070e57b0a518ec8e562a2b68fdfc796ef5c040 ]
Commit 57ed58c13256 ("selftests: ublk: enable zero copy for stripe target") added test entry of test_stripe_04, but forgot to add the test script.
So fix the test by adding the script file.
--- .../testing/selftests/ublk/test_stripe_04.sh | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 tools/testing/selftests/ublk/test_stripe_04.sh
tools/testing/selftests/ublk/test_stripe_04.sh new file +24 -0
@@ -0,0 +1,24 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh + +TID="stripe_04" +ERR_CODE=0 + +_prep_test "stripe" "mkfs & mount & umount on zero copy" + +backfile_0=$(_create_backfile 256M) +backfile_1=$(_create_backfile 256M) +dev_id=$(_add_ublk_dev -t stripe -z -q 2 "$backfile_0" "$backfile_1") +_check_add_dev $TID $? "$backfile_0" "$backfile_1" + +_mkfs_mount_test /dev/ublkb"${dev_id}" +ERR_CODE=$? + +_cleanup_test "stripe" + +_remove_backfile "$backfile_0" +_remove_backfile "$backfile_1" + +_show_result $TID $ERR_CODE
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 205/280 perf/core: Fix WARN_ON(!ctx) in __free_event() for partial init
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriel Shahrouzi <[email protected]>
[ Upstream commit 0ba3a4ab76fd3367b9cb680cad70182c896c795c ]
Move the get_ctx(child_ctx) call and the child_event->ctx assignment to occur immediately after the child event is allocated. Ensure that child_event->ctx is non-NULL before any subsequent error path within inherit_event calls free_event(), satisfying the assumptions of the cleanup code.
Details:
There's no clear Fixes tag, because this bug is a side-effect of multiple interacting commits over time (up to 15 years old), not a single regression.
The code initially incremented refcount then assigned context immediately after the child_event was created. Later, an early validity check for child_event was added before the refcount/assignment. Even later, a WARN_ON_ONCE() cleanup check was added, assuming event->ctx is valid if the pmu_ctx is valid. The problem is that the WARN_ON_ONCE() could trigger after the initial check passed but before child_event->ctx was assigned, violating its precondition. The solution is to assign child_event->ctx right after its initial validation. This ensures the context exists for any subsequent checks or cleanup routines, resolving the WARN_ON_ONCE().
To resolve it, defer the refcount update and child_event->ctx assignment directly after child_event->pmu_ctx is set but before checking if the parent event is orphaned. The cleanup routine depends on event->pmu_ctx being non-NULL before it verifies event->ctx is non-NULL. This also maintains the author's original intent of passing in child_ctx to find_get_pmu_context before its refcount/assignment.
[ mingo: Expanded the changelog from another email by Gabriel Shahrouzi. ]
--- kernel/events/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/events/core.c +3 -3
@@ -13661,6 +13661,9 @@ inherit_event(struct perf_event *parent_event,if (IS_ERR (child_event))return child_event; +get_ctx (child_ctx); + child_event->ctx = child_ctx; + pmu_ctx =find_get_pmu_context (child_event->pmu, child_ctx, child_event);if (IS_ERR (pmu_ctx)) {free_event (child_event);
@@ -13683,8 +13686,6 @@ inherit_event(struct perf_event *parent_event,return NULL ; } -get_ctx (child_ctx); -/* * Make the child state follow the state of the parent event, * not its attr.disabled bit. We hold the parent's mutex,
@@ -13705,7 +13706,6 @@ inherit_event(struct perf_event *parent_event,local64_set (&hwc->period_left, sample_period); } - child_event->ctx = child_ctx; child_event->overflow_handler = parent_event->overflow_handler; child_event->overflow_handler_context = parent_event->overflow_handler_context;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 206/280 xen: Change xen-acpi-processor dom0 dependency
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Andryuk <[email protected]>
[ Upstream commit 0f2946bb172632e122d4033e0b03f85230a29510 ]
xen-acpi-processor functions under a PVH dom0 with only a xen_initial_domain() runtime check. Change the Kconfig dependency from PV dom0 to generic dom0 to reflect that.
Message-ID: <[email protected]>
--- drivers/xen/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/Kconfig +1 -1
@@ -278,7 +278,7 @@ config XEN_PRIVCMD_EVENTFD config XEN_ACPI_PROCESSOR tristate "Xen ACPI processor" - depends on XEN && XEN_PV_DOM0 && X86 && ACPI_PROCESSOR && CPU_FREQ + depends on XEN && XEN_DOM0 && X86 && ACPI_PROCESSOR && CPU_FREQ default m help This ACPI processor uploads Power Management information to the Xen
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 207/280 nvme: requeue namespace scan on missed AENs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Reinecke <[email protected]>
[ Upstream commit 9546ad1a9bda7362492114f5866b95b0ac4a100e ]
Scanning for namespaces can take some time, so if the target is reconfigured while the scan is running we may miss a Attached Namespace Attribute Changed AEN.
Check if the NVME_AER_NOTICE_NS_CHANGED bit is set once the scan has finished, and requeue scanning to pick up any missed change.
--- drivers/nvme/host/core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/nvme/host/core.c +4 -0
@@ -4273,6 +4273,10 @@ static void nvme_scan_work(struct work_struct *work)nvme_scan_ns_sequential (ctrl); }mutex_unlock (&ctrl->scan_lock); + +/* Requeue if we have missed AENs */ +if (test_bit (NVME_AER_NOTICE_NS_CHANGED , &ctrl->events)) +nvme_queue_scan (ctrl); }/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 208/280 ACPI: EC: Set ec_no_wakeup for Lenovo Go S
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit b988685388effd648150aab272533f833a2a70f0 ]
When AC adapter is unplugged or plugged in EC wakes from HW sleep but APU doesn't enter back into HW sleep.
The reason this happens is that, when the APU exits HW sleep, the power rails controlled by the EC will power up the TCON. The TCON has a GPIO that will be toggled at this time. The GPIO is not marked as a wakeup source, but the GPIO controller still has an unserviced interrupt. Unserviced interrupts will block entering HW sleep again. Clearing the GPIO doesn't help as the TCON continues to assert it until it's been initialized by i2c-hid.
Fixing this would require TCON F/W changes and it's already broken in the wild on production hardware.
To avoid triggering this issue add a quirk to avoid letting EC wake up system at all. The power button still works properly on this system.
--- drivers/acpi/ec.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/acpi/ec.c +28 -0
@@ -2301,6 +2301,34 @@ static const struct dmi_system_id acpi_ec_no_wakeup[] = { DMI_MATCH(DMI_PRODUCT_FAMILY, "103C_5336AN HP ZHAN 66 Pro"), }, }, +/* +* Lenovo Legion Go S; touchscreen blocks HW sleep when woken up from EC +* https://gitlab.freedesktop.org/drm/amd/-/issues/3929 +*/ + { + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "83L3"), + } + }, + { + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "83N6"), + } + }, + { + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "83Q2"), + } + }, + { + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "83Q3"), + } + }, { }, };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 209/280 ACPI PPTT: Fix coding mistakes in a couple of sizeof() calls
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Marc Eurin <[email protected]>
[ Upstream commit 7ab4f0e37a0f4207e742a8de69be03984db6ebf0 ]
The end of table checks should be done with the structure size, but 2 of the 3 similar calls use the pointer size.
--- drivers/acpi/pptt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/pptt.c +2 -2
@@ -229,7 +229,7 @@ static int acpi_pptt_leaf_node(struct acpi_table_header *table_hdr, node_entry =ACPI_PTR_DIFF (node, table_hdr); entry = ACPI_ADD_PTR(struct acpi_subtable_header, table_hdr,sizeof (struct acpi_table_pptt )); - proc_sz =sizeof (struct acpi_pptt_processor *); + proc_sz =sizeof (struct acpi_pptt_processor );while ((unsigned long )entry + proc_sz < table_end) { cpu_node = (struct acpi_pptt_processor *)entry;
@@ -270,7 +270,7 @@ static struct acpi_pptt_processor *acpi_find_processor_node(struct acpi_table_he table_end = (unsigned long )table_hdr + table_hdr->length; entry = ACPI_ADD_PTR(struct acpi_subtable_header, table_hdr,sizeof (struct acpi_table_pptt )); - proc_sz =sizeof (struct acpi_pptt_processor *); + proc_sz =sizeof (struct acpi_pptt_processor );/* find the processor structure associated with this cpuid */ while ((unsigned long )entry + proc_sz < table_end) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 210/280 drm/amdgpu: Increase KIQ invalidate_tlbs timeout
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jay Cornwall <[email protected]>
[ Upstream commit 3666ed821832f42baaf25f362680dda603cde732 ]
KIQ invalidate_tlbs request has been seen to marginally exceed the configured 100 ms timeout on systems under load.
All other KIQ requests in the driver use a 10 second timeout. Use a similar timeout implementation on the invalidate_tlbs path.
v2: Poll once before msleep
v3: Fix return value
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 19 ++++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -1
@@ -350,7 +350,6 @@ enum amdgpu_kiq_irq {AMDGPU_CP_KIQ_IRQ_DRIVER0 =0 , AMDGPU_CP_KIQ_IRQ_LAST }; -#define SRIOV_USEC_TIMEOUT 1200000/* wait 12 * 100ms for SRIOV */ #define MAX_KIQ_REG_WAIT 5000/* in usecs, 5ms */ #define MAX_KIQ_REG_BAILOUT_INTERVAL 5/* in msecs, 5ms */ #define MAX_KIQ_REG_TRY 1000
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +14 -5
@@ -678,12 +678,10 @@ int amdgpu_gmc_flush_gpu_tlb_pasid(struct amdgpu_device *adev, uint16_t pasid, uint32_t flush_type, bool all_hub, uint32_t inst) { - u32 usec_timeout = amdgpu_sriov_vf(adev) ? SRIOV_USEC_TIMEOUT : - adev->usec_timeout; struct amdgpu_ring *ring = &adev->gfx.kiq[inst].ring;struct amdgpu_kiq *kiq = &adev->gfx.kiq[inst];unsigned int ndw; -int r; +int r, cnt =0 ;uint32_t seq;/*
@@ -740,10 +738,21 @@ int amdgpu_gmc_flush_gpu_tlb_pasid(struct amdgpu_device *adev, uint16_t pasid,amdgpu_ring_commit (ring);spin_unlock (&adev->gfx.kiq[inst].ring_lock); -if (amdgpu_fence_wait_polling (ring, seq, usec_timeout) <1 ) { + + r =amdgpu_fence_wait_polling (ring, seq,MAX_KIQ_REG_WAIT ); + +might_sleep (); +while (r <1 && cnt++ <MAX_KIQ_REG_TRY && + !amdgpu_reset_pending (adev->reset_domain)) { +msleep (MAX_KIQ_REG_BAILOUT_INTERVAL ); + r =amdgpu_fence_wait_polling (ring, seq,MAX_KIQ_REG_WAIT ); + } + +if (cnt >MAX_KIQ_REG_TRY ) {dev_err (adev->dev,"timeout waiting for kiq fence\n" ); r = -ETIME ; - } + }else + r =0 ; } error_unlock_reset:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 211/280 drm/xe/xe3lpg: Apply Wa_14022293748, Wa_22019794406
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julia Filipchuk <[email protected]>
[ Upstream commit 00e0ae4f1f872800413c819f8a2a909dc29cdc35 ]
Extend Wa_14022293748, Wa_22019794406 to Xe3_LPG
--- drivers/gpu/drm/xe/xe_wa_oob.rules | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/xe/xe_wa_oob.rules +2 -0
@@ -29,8 +29,10 @@ 13011645652 GRAPHICS_VERSION(2004) 14022293748 GRAPHICS_VERSION(2001) GRAPHICS_VERSION(2004) + GRAPHICS_VERSION_RANGE(3000, 3001) 22019794406 GRAPHICS_VERSION(2001) GRAPHICS_VERSION(2004) + GRAPHICS_VERSION_RANGE(3000, 3001) 22019338487 MEDIA_VERSION(2000) GRAPHICS_VERSION(2001) MEDIA_VERSION(3000), MEDIA_STEP(A0, B0)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 212/280 nvme: re-read ANA log page after ns scan completes
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Reinecke <[email protected]>
[ Upstream commit 62baf70c327444338c34703c71aa8cc8e4189bd6 ]
When scanning for new namespaces we might have missed an ANA AEN.
The NVMe base spec (NVMe Base Specification v2.1, Figure 151 'Asynchonous Event Information - Notice': Asymmetric Namespace Access Change) states:
A controller shall not send this even if an Attached Namespace Attribute Changed asynchronous event [...] is sent for the same event.
so we need to re-read the ANA log page after we rescanned the namespace list to update the ANA states of the new namespaces.
--- drivers/nvme/host/core.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/nvme/host/core.c +5 -0
@@ -4277,6 +4277,11 @@ static void nvme_scan_work(struct work_struct *work)/* Requeue if we have missed AENs */ if (test_bit (NVME_AER_NOTICE_NS_CHANGED , &ctrl->events))nvme_queue_scan (ctrl); +#ifdef CONFIG_NVME_MULTIPATH + else +/* Re-read the ANA log page to not miss updates */ + queue_work(nvme_wq, &ctrl->ana_work); +#endif }/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 213/280 nvme: multipath: fix return value of nvme_available_path
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uday Shankar <[email protected]>
[ Upstream commit e3105f54a51554fb1bbf19dcaf93c4411d2d6c8a ]
The function returns bool so we should return false, not NULL. No functional changes are expected.
--- drivers/nvme/host/multipath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/multipath.c +1 -1
@@ -427,7 +427,7 @@ static bool nvme_available_path(struct nvme_ns_head *head)struct nvme_ns *ns;if (!test_bit (NVME_NSHEAD_DISK_LIVE , &head->flags)) -return NULL ; +return false;list_for_each_entry_srcu (ns, &head->list, siblings,srcu_read_lock_held (&head->srcu)) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 214/280 objtool: Stop UNRET validation on UD2
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
[ Upstream commit 9f9cc012c2cbac4833746a0182e06a8eec940d19 ]
In preparation for simplifying INSN_SYSCALL, make validate_unret() terminate control flow on UD2 just like validate_branch() already does.
--- tools/objtool/check.c | 3 +++ 1 file changed, 3 insertions(+)
tools/objtool/check.c +3 -0
@@ -4014,6 +4014,9 @@ static int validate_unret(struct objtool_file *file, struct instruction *insn)break ; } +if (insn->dead_end) +return 0 ; +if (!next) {WARN_INSN (insn,"teh end!" );return -1 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 215/280 gpiolib: of: Move Atmel HSMCI quirk up out of the regulator comment
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit b8c7a1ac884cc267d1031f8de07f1a689a69fbab ]
The regulator comment in of_gpio_set_polarity_by_property() made on top of a couple of the cases, while Atmel HSMCI quirk is not related to that. Make it clear by moving Atmel HSMCI quirk up out of the scope of the regulator comment.
--- drivers/gpio/gpiolib-of.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpiolib-of.c +3 -3
@@ -259,6 +259,9 @@ static void of_gpio_set_polarity_by_property(const struct device_node *np, { "fsl,imx8qm-fec", "phy-reset-gpios", "phy-reset-active-high" }, { "fsl,s32v234-fec", "phy-reset-gpios", "phy-reset-active-high" }, #endif +#if IS_ENABLED(CONFIG_MMC_ATMELMCI) + { "atmel,hsmci", "cd-gpios", "cd-inverted" }, +#endif #if IS_ENABLED(CONFIG_PCI_IMX6) { "fsl,imx6q-pcie", "reset-gpio", "reset-gpio-active-high" }, { "fsl,imx6sx-pcie", "reset-gpio", "reset-gpio-active-high" },
@@ -284,9 +287,6 @@ static void of_gpio_set_polarity_by_property(const struct device_node *np, #if IS_ENABLED(CONFIG_REGULATOR_GPIO) { "regulator-gpio", "enable-gpio", "enable-active-high" }, { "regulator-gpio", "enable-gpios", "enable-active-high" }, -#endif -#if IS_ENABLED(CONFIG_MMC_ATMELMCI) - { "atmel,hsmci", "cd-gpios", "cd-inverted" }, #endif }; unsigned int i;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 216/280 x86/xen: disable CPU idle and frequency drivers for PVH dom0
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roger Pau Monne <[email protected]>
[ Upstream commit 64a66e2c3b3113dc78a6124e14825d68ddc2e188 ]
When running as a PVH dom0 the ACPI tables exposed to Linux are (mostly) the native ones, thus exposing the C and P states, that can lead to attachment of CPU idle and frequency drivers. However the entity in control of the CPU C and P states is Xen, as dom0 doesn't have a full view of the system load, neither has all CPUs assigned and identity pinned.
Like it's done for classic PV guests, prevent Linux from using idle or frequency state drivers when running as a PVH dom0.
On an AMD EPYC 7543P system without this fix a Linux PVH dom0 will keep the host CPUs spinning at 100% even when dom0 is completely idle, as it's attempting to use the acpi_idle driver.
Message-ID: <[email protected]>
--- arch/x86/xen/enlighten_pvh.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
arch/x86/xen/enlighten_pvh.c +18 -1
@@ -1,5 +1,7 @@// SPDX-License-Identifier: GPL-2.0 #include <linux/acpi.h> +#include <linux/cpufreq.h> +#include <linux/cpuidle.h> #include <linux/export.h> #include <linux/mm.h>
@@ -123,8 +125,23 @@ static void __init pvh_arch_setup(void) {pvh_reserve_extra_memory (); -if (xen_initial_domain ()) +if (xen_initial_domain ()) {xen_add_preferred_consoles (); + +/* +* Disable usage of CPU idle and frequency drivers: when +* running as hardware domain the exposed native ACPI tables +* causes idle and/or frequency drivers to attach and +* malfunction. It's Xen the entity that controls the idle and +* frequency states. +* +* For unprivileged domains the exposed ACPI tables are +* fabricated and don't contain such data. +*/ +disable_cpuidle (); +disable_cpufreq (); +WARN_ON (xen_set_default_idle ()); + } }void __init xen_pvh_init (struct boot_params *boot_params)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 217/280 selftests/mincore: Allow read-ahead pages to reach the end of the file
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiuxu Zhuo <[email protected]>
[ Upstream commit 197c1eaa7ba633a482ed7588eea6fd4aa57e08d4 ]
When running the mincore_selftest on a system with an XFS file system, it failed the "check_file_mmap" test case due to the read-ahead pages reaching the end of the file. The failure log is as below:
RUN global.check_file_mmap ...
mincore_selftest.c:264:check_file_mmap:Expected i (1024) < vec_size (1024) mincore_selftest.c:265:check_file_mmap:Read-ahead pages reached the end of the file
check_file_mmap: Test failed
FAIL global.check_file_mmap
This is because the read-ahead window size of the XFS file system on this machine is 4 MB, which is larger than the size from the #PF address to the end of the file. As a result, all the pages for this file are populated.
blockdev --getra /dev/nvme0n1p5
8192
blockdev --getbsz /dev/nvme0n1p5
512This issue can be fixed by extending the current FILE_SIZE 4MB to a larger number, but it will still fail if the read-ahead window size of the file system is larger enough. Additionally, in the real world, read-ahead pages reaching the end of the file can happen and is an expected behavior. Therefore, allowing read-ahead pages to reach the end of the file is a better choice for the "check_file_mmap" test case.
--- tools/testing/selftests/mincore/mincore_selftest.c | 3 --- 1 file changed, 3 deletions(-)
tools/testing/selftests/mincore/mincore_selftest.c +0 -3
@@ -261,9 +261,6 @@ TEST(check_file_mmap)TH_LOG ("No read-ahead pages found in memory" ); } - EXPECT_LT(i, vec_size) { -TH_LOG ("Read-ahead pages reached the end of the file" ); - }/* * End of the readahead window. The rest of the pages shouldn't * be in memory.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 218/280 x86/bugs: Use SBPB in write_ibpb() if applicable
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
[ Upstream commit fc9fd3f98423367c79e0bd85a9515df26dc1b3cc ]
write_ibpb() does IBPB, which (among other things) flushes branch type predictions on AMD. If the CPU has SRSO_NO, or if the SRSO mitigation has been disabled, branch type flushing isn't needed, in which case the lighter-weight SBPB can be used.
The 'x86_pred_cmd' variable already keeps track of whether IBPB or SBPB should be used. Use that instead of hardcoding IBPB.
--- arch/x86/entry/entry.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/entry/entry.S +1 -1
@@ -18,7 +18,7 @@ SYM_FUNC_START(entry_ibpb) movl $MSR_IA32_PRED_CMD, %ecx - movl $PRED_CMD_IBPB, %eax + movl _ASM_RIP(x86_pred_cmd), %eax xorl %edx, %edx wrmsr
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 219/280 x86/bugs: Dont fill RSB on VMEXIT with eIBRS+retpoline
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
[ Upstream commit 18bae0dfec15b24ec14ca17dc18603372f5f254f ]
eIBRS protects against guest->host RSB underflow/poisoning attacks. Adding retpoline to the mix doesn't change that. Retpoline has a balanced CALL/RET anyway.
So the current full RSB filling on VMEXIT with eIBRS+retpoline is overkill. Disable it or do the VMEXIT_LITE mitigation if needed.
--- arch/x86/kernel/cpu/bugs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/bugs.c +4 -4
@@ -1604,20 +1604,20 @@ static void __init spectre_v2_determine_rsb_fill_type_at_vmexit(enum spectre_v2_case SPECTRE_V2_NONE :return ; -case SPECTRE_V2_EIBRS_LFENCE :case SPECTRE_V2_EIBRS : +case SPECTRE_V2_EIBRS_LFENCE : +case SPECTRE_V2_EIBRS_RETPOLINE :if (boot_cpu_has_bug (X86_BUG_EIBRS_PBRSB )) { -setup_force_cpu_cap (X86_FEATURE_RSB_VMEXIT_LITE );pr_info ("Spectre v2 / PBRSB-eIBRS: Retire a single CALL on VMEXIT\n" ); +setup_force_cpu_cap (X86_FEATURE_RSB_VMEXIT_LITE ); }return ; -case SPECTRE_V2_EIBRS_RETPOLINE :case SPECTRE_V2_RETPOLINE :case SPECTRE_V2_LFENCE :case SPECTRE_V2_IBRS : -setup_force_cpu_cap (X86_FEATURE_RSB_VMEXIT );pr_info ("Spectre v2 / SpectreRSB : Filling RSB on VMEXIT\n" ); +setup_force_cpu_cap (X86_FEATURE_RSB_VMEXIT );return ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 220/280 x86/bugs: Dont fill RSB on context switch with eIBRS
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
[ Upstream commit 27ce8299bc1ec6df8306073785ff82b30b3cc5ee ]
User->user Spectre v2 attacks (including RSB) across context switches are already mitigated by IBPB in cond_mitigation(), if enabled globally or if either the prev or the next task has opted in to protection. RSB filling without IBPB serves no purpose for protecting user space, as indirect branches are still vulnerable.
User->kernel RSB attacks are mitigated by eIBRS. In which case the RSB filling on context switch isn't needed, so remove it.
--- arch/x86/kernel/cpu/bugs.c | 24 ++++++++++++------------ arch/x86/mm/tlb.c | 6 +++--- 2 files changed, 15 insertions(+), 15 deletions(-)
arch/x86/kernel/cpu/bugs.c +12 -12
@@ -1578,7 +1578,7 @@ static void __init spec_ctrl_disable_kernel_rrsba(void) rrsba_disabled = true; } -static void __init spectre_v2_determine_rsb_fill_type_at_vmexit (enum spectre_v2_mitigation mode) +static void __init spectre_v2_select_rsb_mitigation (enum spectre_v2_mitigation mode) {/* * Similar to context switches, there are two types of RSB attacks
@@ -1602,7 +1602,7 @@ static void __init spectre_v2_determine_rsb_fill_type_at_vmexit(enum spectre_v2_*/ switch (mode) {case SPECTRE_V2_NONE : -return ; +break ;case SPECTRE_V2_EIBRS :case SPECTRE_V2_EIBRS_LFENCE :
@@ -1611,18 +1611,21 @@ static void __init spectre_v2_determine_rsb_fill_type_at_vmexit(enum spectre_v2_pr_info ("Spectre v2 / PBRSB-eIBRS: Retire a single CALL on VMEXIT\n" );setup_force_cpu_cap (X86_FEATURE_RSB_VMEXIT_LITE ); } -return ; +break ;case SPECTRE_V2_RETPOLINE :case SPECTRE_V2_LFENCE :case SPECTRE_V2_IBRS : -pr_info ("Spectre v2 / SpectreRSB : Filling RSB on VMEXIT\n" ); +pr_info ("Spectre v2 / SpectreRSB: Filling RSB on context switch and VMEXIT\n" ); +setup_force_cpu_cap (X86_FEATURE_RSB_CTXSW );setup_force_cpu_cap (X86_FEATURE_RSB_VMEXIT ); -return ; - } +break ; -pr_warn_once ("Unknown Spectre v2 mode, disabling RSB mitigation at VM exit" ); -dump_stack (); +default : +pr_warn_once ("Unknown Spectre v2 mode, disabling RSB mitigation\n" ); +dump_stack (); +break ; + } }/*
@@ -1854,10 +1857,7 @@ static void __init spectre_v2_select_mitigation(void)* * FIXME: Is this pointless for retbleed-affected AMD? */ -setup_force_cpu_cap (X86_FEATURE_RSB_CTXSW ); -pr_info ("Spectre v2 / SpectreRSB mitigation: Filling RSB on context switch\n" ); - -spectre_v2_determine_rsb_fill_type_at_vmexit (mode); +spectre_v2_select_rsb_mitigation (mode);/* * Retpoline protects the kernel, but doesn't protect firmware. IBRS
arch/x86/mm/tlb.c +3 -3
@@ -389,9 +389,9 @@ static void cond_mitigation(struct task_struct *next) prev_mm =this_cpu_read (cpu_tlbstate.last_user_mm_spec);/* -* Avoid user/user BTB poisoning by flushing the branch predictor -* when switching between processes. This stops one process from -* doing Spectre-v2 attacks on another. +* Avoid user->user BTB/RSB poisoning by flushing them when switching +* between processes. This stops one process from doing Spectre-v2 +* attacks on another. * * Both, the conditional and the always IBPB mode use the mm * pointer to avoid the IBPB when switching between tasks of the
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 221/280 nvmet-fc: take tgtport reference only once
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Wagner <[email protected]>
[ Upstream commit b0b26ad0e1943de25ce82a7e5af3574f31b1cf99 ]
The reference counting code can be simplified. Instead taking a tgtport refrerence at the beginning of nvmet_fc_alloc_hostport and put it back if not a new hostport object is allocated, only take it when a new hostport object is allocated.
--- drivers/nvme/target/fc.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-)
drivers/nvme/target/fc.c +7 -15
@@ -1028,33 +1028,24 @@ nvmet_fc_alloc_hostport(struct nvmet_fc_tgtport *tgtport, void *hosthandle)struct nvmet_fc_hostport *newhost, *match =NULL ;unsigned long flags; +/* +* Caller holds a reference on tgtport. +*/ +/* if LLDD not implemented, leave as NULL */ if (!hosthandle)return NULL ; -/* -* take reference for what will be the newly allocated hostport if -* we end up using a new allocation -*/ -if (!nvmet_fc_tgtport_get (tgtport)) -return ERR_PTR (-EINVAL ); -spin_lock_irqsave (&tgtport->lock, flags); match =nvmet_fc_match_hostport (tgtport, hosthandle);spin_unlock_irqrestore (&tgtport->lock, flags); -if (match) { -/* no new allocation - release reference */ -nvmet_fc_tgtport_put (tgtport); +if (match)return match; - } newhost =kzalloc (sizeof (*newhost),GFP_KERNEL ); -if (!newhost) { -/* no new allocation - release reference */ -nvmet_fc_tgtport_put (tgtport); +if (!newhost)return ERR_PTR (-ENOMEM ); - }spin_lock_irqsave (&tgtport->lock, flags); match =nvmet_fc_match_hostport (tgtport, hosthandle);
@@ -1063,6 +1054,7 @@ nvmet_fc_alloc_hostport(struct nvmet_fc_tgtport *tgtport, void *hosthandle)kfree (newhost); newhost = match; }else { +nvmet_fc_tgtport_get (tgtport); newhost->tgtport = tgtport; newhost->hosthandle = hosthandle;INIT_LIST_HEAD (&newhost->host_list);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 222/280 nvmet-fc: put ref when assoc->del_work is already scheduled
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Wagner <[email protected]>
[ Upstream commit 70289ae5cac4d3a39575405aaf63330486cea030 ]
Do not leak the tgtport reference when the work is already scheduled.
--- drivers/nvme/target/fc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/target/fc.c +2 -1
@@ -1089,7 +1089,8 @@ static void nvmet_fc_schedule_delete_assoc(struct nvmet_fc_tgt_assoc *assoc) {nvmet_fc_tgtport_get (assoc->tgtport); -queue_work (nvmet_wq, &assoc->del_work); +if (!queue_work (nvmet_wq, &assoc->del_work)) +nvmet_fc_tgtport_put (assoc->tgtport); } static bool
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 223/280 cifs: Fix encoding of SMB1 Session Setup Kerberos Request in non-UNICODE mode
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pali Rohár <[email protected]>
[ Upstream commit 16cb6b0509b65ac89187e9402e0b7a9ddf1765ef ]
Like in UNICODE mode, SMB1 Session Setup Kerberos Request contains oslm and domain strings.
Extract common code into ascii_oslm_strings() and ascii_domain_string() functions (similar to unicode variants) and use these functions in non-UNICODE code path in sess_auth_kerberos().
Decision if non-UNICODE or UNICODE mode is used is based on the SMBFLG2_UNICODE flag in Flags2 packed field, and not based on the capabilities of server. Fix this check too.
--- fs/smb/client/sess.c | 60 +++++++++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 20 deletions(-)
fs/smb/client/sess.c +40 -20
@@ -707,6 +707,22 @@ unicode_oslm_strings(char **pbcc_area, const struct nls_table *nls_cp) *pbcc_area = bcc_ptr; } +static void +ascii_oslm_strings (char **pbcc_area,const struct nls_table *nls_cp) +{ +char *bcc_ptr = *pbcc_area; + +strcpy (bcc_ptr,"Linux version " ); + bcc_ptr +=strlen ("Linux version " ); +strcpy (bcc_ptr,init_utsname ()->release); + bcc_ptr +=strlen (init_utsname ()->release) +1 ; + +strcpy (bcc_ptr,CIFS_NETWORK_OPSYS ); + bcc_ptr +=strlen (CIFS_NETWORK_OPSYS ) +1 ; + + *pbcc_area = bcc_ptr; +} +static void unicode_domain_string (char **pbcc_area,struct cifs_ses *ses,const struct nls_table *nls_cp) {
@@ -731,6 +747,25 @@ static void unicode_domain_string(char **pbcc_area, struct cifs_ses *ses, *pbcc_area = bcc_ptr; } +static void ascii_domain_string (char **pbcc_area,struct cifs_ses *ses, +const struct nls_table *nls_cp) +{ +char *bcc_ptr = *pbcc_area; +int len; + +/* copy domain */ +if (ses->domainName !=NULL ) { + len =strscpy (bcc_ptr, ses->domainName,CIFS_MAX_DOMAINNAME_LEN ); +if (WARN_ON_ONCE (len <0 )) + len =CIFS_MAX_DOMAINNAME_LEN -1 ; + bcc_ptr += len; + }/* else we send a null domain name so server will default to its own domain */ + *bcc_ptr =0 ; + bcc_ptr++; + + *pbcc_area = bcc_ptr; +} +static void unicode_ssetup_strings (char **pbcc_area,struct cifs_ses *ses,const struct nls_table *nls_cp) {
@@ -776,25 +811,10 @@ static void ascii_ssetup_strings(char **pbcc_area, struct cifs_ses *ses, *bcc_ptr =0 ; bcc_ptr++;/* account for null termination */ -/* copy domain */ -if (ses->domainName !=NULL ) { - len =strscpy (bcc_ptr, ses->domainName,CIFS_MAX_DOMAINNAME_LEN ); -if (WARN_ON_ONCE (len <0 )) - len =CIFS_MAX_DOMAINNAME_LEN -1 ; - bcc_ptr += len; - }/* else we send a null domain name so server will default to its own domain */ - *bcc_ptr =0 ; - bcc_ptr++; -/* BB check for overflow here */ -strcpy (bcc_ptr,"Linux version " ); - bcc_ptr +=strlen ("Linux version " ); -strcpy (bcc_ptr,init_utsname ()->release); - bcc_ptr +=strlen (init_utsname ()->release) +1 ; - -strcpy (bcc_ptr,CIFS_NETWORK_OPSYS ); - bcc_ptr +=strlen (CIFS_NETWORK_OPSYS ) +1 ; +ascii_domain_string (&bcc_ptr, ses, nls_cp); +ascii_oslm_strings (&bcc_ptr, nls_cp); *pbcc_area = bcc_ptr; }
@@ -1597,7 +1617,7 @@ sess_auth_kerberos(struct sess_data *sess_data) sess_data->iov[1 ].iov_len = msg->secblob_len; pSMB->req.SecurityBlobLength =cpu_to_le16 (sess_data->iov[1 ].iov_len); -if (ses->capabilities &CAP_UNICODE ) { +if (pSMB->req.hdr.Flags2 &SMBFLG2_UNICODE ) {/* unicode strings must be word aligned */ if (!IS_ALIGNED (sess_data->iov[0 ].iov_len + sess_data->iov[1 ].iov_len,2 )) { *bcc_ptr =0 ;
@@ -1606,8 +1626,8 @@ sess_auth_kerberos(struct sess_data *sess_data)unicode_oslm_strings (&bcc_ptr, sess_data->nls_cp);unicode_domain_string (&bcc_ptr, ses, sess_data->nls_cp); }else { -/* BB: is this right? */ -ascii_ssetup_strings (&bcc_ptr, ses, sess_data->nls_cp); +ascii_oslm_strings (&bcc_ptr, sess_data->nls_cp); +ascii_domain_string (&bcc_ptr, ses, sess_data->nls_cp); } sess_data->iov[2].iov_len = (long) bcc_ptr -
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 224/280 timekeeping: Add a lockdep override in tick_freeze()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit 92e250c624ea37fde64bfd624fd2556f0d846f18 ]
tick_freeze() acquires a raw spinlock (tick_freeze_lock). Later in the callchain (timekeeping_suspend() -> mc146818_avoid_UIP()) the RTC driver acquires a spinlock which becomes a sleeping lock on PREEMPT_RT. Lockdep complains about this lock nesting.
Add a lockdep override for this special case and a comment explaining why it is okay.
--- kernel/time/tick-common.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
kernel/time/tick-common.c +22 -0
@@ -509,6 +509,7 @@ void tick_resume(void)#ifdef CONFIG_SUSPEND static DEFINE_RAW_SPINLOCK (tick_freeze_lock); +static DEFINE_WAIT_OVERRIDE_MAP(tick_freeze_map, LD_WAIT_SLEEP);static unsigned int tick_freeze_depth;/**
@@ -528,9 +529,22 @@ void tick_freeze(void)if (tick_freeze_depth ==num_online_cpus ()) {trace_suspend_resume (TPS ("timekeeping_freeze" ),smp_processor_id (), true); +/* +* All other CPUs have their interrupts disabled and are +* suspended to idle. Other tasks have been frozen so there +* is no scheduling happening. This means that there is no +* concurrency in the system at this point. Therefore it is +* okay to acquire a sleeping lock on PREEMPT_RT, such as a +* spinlock, because the lock cannot be held by other CPUs +* or threads and acquiring it cannot block. +* +* Inform lockdep about the situation. +*/ +lock_map_acquire_try (&tick_freeze_map); system_state =SYSTEM_SUSPEND ;sched_clock_suspend ();timekeeping_suspend (); +lock_map_release (&tick_freeze_map); }else {tick_suspend_local (); }
@@ -552,8 +566,16 @@ void tick_unfreeze(void)raw_spin_lock (&tick_freeze_lock);if (tick_freeze_depth ==num_online_cpus ()) { +/* +* Similar to tick_freeze(). On resumption the first CPU may +* acquire uncontended sleeping locks while other CPUs block on +* tick_freeze_lock. +*/ +lock_map_acquire_try (&tick_freeze_map);timekeeping_resume ();sched_clock_resume (); +lock_map_release (&tick_freeze_map); + system_state =SYSTEM_RUNNING ;trace_suspend_resume (TPS ("timekeeping_freeze" ),smp_processor_id (), false);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 225/280 cifs: Fix querying of WSL CHR and BLK reparse points over SMB1
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pali Rohár <[email protected]>
[ Upstream commit ef86ab131d9127dfbfa8f06e12441d05fdfb090b ]
When reparse point in SMB1 query_path_info() callback was detected then query also for EA $LXDEV. In this EA are stored device major and minor numbers used by WSL CHR and BLK reparse points. Without major and minor numbers, stat() syscall does not work for char and block devices.
Similar code is already in SMB2+ query_path_info() callback function.
--- fs/smb/client/smb1ops.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
fs/smb/client/smb1ops.c +36 -0
@@ -597,6 +597,42 @@ static int cifs_query_path_info(const unsigned int xid,CIFSSMBClose (xid, tcon, fid.netfid); } +#ifdef CONFIG_CIFS_XATTR +/* +* For WSL CHR and BLK reparse points it is required to fetch +* EA $LXDEV which contains major and minor device numbers. +*/ +if (!rc && data->reparse_point) { +struct smb2_file_full_ea_info *ea; + + ea = (struct smb2_file_full_ea_info *)data->wsl.eas; + rc =CIFSSMBQAllEAs (xid, tcon, full_path,SMB2_WSL_XATTR_DEV , + &ea->ea_data[SMB2_WSL_XATTR_NAME_LEN +1 ], +SMB2_WSL_XATTR_DEV_SIZE , cifs_sb); +if (rc ==SMB2_WSL_XATTR_DEV_SIZE ) { + ea->next_entry_offset =cpu_to_le32 (0 ); + ea->flags =0 ; + ea->ea_name_length =SMB2_WSL_XATTR_NAME_LEN ; + ea->ea_value_length =cpu_to_le16 (SMB2_WSL_XATTR_DEV_SIZE ); +memcpy (&ea->ea_data[0 ],SMB2_WSL_XATTR_DEV ,SMB2_WSL_XATTR_NAME_LEN +1 ); + data->wsl.eas_len =sizeof (*ea) +SMB2_WSL_XATTR_NAME_LEN +1 + +SMB2_WSL_XATTR_DEV_SIZE ; + rc =0 ; + }else if (rc >=0 ) { +/* It is an error if EA $LXDEV has wrong size. */ + rc = -EINVAL ; + }else { +/* +* In all other cases ignore error if fetching +* of EA $LXDEV failed. It is needed only for +* WSL CHR and BLK reparse points and wsl_to_fattr() +* handle the case when EA is missing. +*/ + rc =0 ; + } + } +#endif +return rc; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 226/280 iommu: Clear iommu-dma ops on cleanup
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robin Murphy <[email protected]>
[ Upstream commit 280e5a30100578106a4305ce0118e0aa9b866f12 ]
If iommu_device_register() encounters an error, it can end up tearing down already-configured groups and default domains, however this currently still leaves devices hooked up to iommu-dma (and even historically the behaviour in this area was at best inconsistent across architectures/drivers...) Although in the case that an IOMMU is present whose driver has failed to probe, users cannot necessarily expect DMA to work anyway, it's still arguable that we should do our best to put things back as if the IOMMU driver was never there at all, and certainly the potential for crashing in iommu-dma itself is undesirable. Make sure we clean up the dev->dma_iommu flag along with everything else.
--- drivers/iommu/iommu.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iommu/iommu.c +3 -0
@@ -503,6 +503,9 @@ static void iommu_deinit_device(struct device *dev) dev->iommu_group =NULL ;module_put (ops->owner);dev_iommu_free (dev); +#ifdef CONFIG_IOMMU_DMA + dev->dma_iommu = false; +#endif }DEFINE_MUTEX (iommu_probe_device_lock);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 227/280 ext4: make block validity check resistent to sb bh corruption
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ojaswin Mujoo <[email protected]>
[ Upstream commit ccad447a3d331a239477c281533bacb585b54a98 ]
Block validity checks need to be skipped in case they are called for journal blocks since they are part of system's protected zone.
Currently, this is done by checking inode->ino against sbi->s_es->s_journal_inum, which is a direct read from the ext4 sb buffer head. If someone modifies this underneath us then the s_journal_inum field might get corrupted. To prevent against this, change the check to directly compare the inode with journal->j_inode.
**Slight change in behavior**: During journal init path, check_block_validity etc might be called for journal inode when sbi->s_journal is not set yet. In this case we now proceed with ext4_inode_block_valid() instead of returning early. Since systems zones have not been set yet, it is okay to proceed so we can perform basic checks on the blocks.
--- fs/ext4/block_validity.c | 5 ++--- fs/ext4/inode.c | 7 ++++--- 2 files changed, 6 insertions(+), 6 deletions(-)
fs/ext4/block_validity.c +2 -3
@@ -351,10 +351,9 @@ int ext4_check_blockref(const char *function, unsigned int line, {__le32 *bref = p;unsigned int blk; +journal_t *journal =EXT4_SB (inode->i_sb)->s_journal; -if (ext4_has_feature_journal (inode->i_sb) && - (inode->i_ino == -le32_to_cpu (EXT4_SB (inode->i_sb)->s_es->s_journal_inum))) +if (journal && inode == journal->j_inode)return 0 ;while (bref < p+max) {
fs/ext4/inode.c +4 -3
@@ -383,10 +383,11 @@ static int __check_block_validity(struct inode *inode, const char *func,unsigned int line, struct ext4_map_blocks *map) { - if (ext4_has_feature_journal(inode->i_sb) && - (inode->i_ino == - le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_journal_inum))) + journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; + +if (journal && inode == journal->j_inode)return 0 ; +if (!ext4_inode_block_valid (inode, map->m_pblk, map->m_len)) {ext4_error_inode (inode, func, line, map->m_pblk, "lblock %lu mapped to illegal pblock %llu "
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 228/280 scsi: hisi_sas: Fix I/O errors caused by hardware port ID changes
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xingui Yang <[email protected]>
[ Upstream commit daff37f00c7506ca322ccfce95d342022f06ec58 ]
The hw port ID of phy may change when inserting disks in batches, causing the port ID in hisi_sas_port and itct to be inconsistent with the hardware, resulting in I/O errors. The solution is to set the device state to gone to intercept I/O sent to the device, and then execute linkreset to discard and find the disk to re-update its information.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/scsi/hisi_sas/hisi_sas_main.c +20 -0
@@ -912,8 +912,28 @@ static void hisi_sas_phyup_work_common(struct work_struct *work,container_of (work,typeof (*phy), works[event]);struct hisi_hba *hisi_hba = phy->hisi_hba;struct asd_sas_phy *sas_phy = &phy->sas_phy; +struct asd_sas_port *sas_port = sas_phy->port; +struct hisi_sas_port *port = phy->port; +struct device *dev = hisi_hba->dev; +struct domain_device *port_dev;int phy_no = sas_phy->id; +if (!test_bit (HISI_SAS_RESETTING_BIT , &hisi_hba->flags) && + sas_port && port && (port->id != phy->port_id)) { +dev_info (dev,"phy%d's hw port id changed from %d to %llu\n" , + phy_no, port->id, phy->port_id); + port_dev = sas_port->port_dev; +if (port_dev && !dev_is_expander (port_dev->dev_type)) { +/* +* Set the device state to gone to block +* sending IO to the device. +*/ +set_bit (SAS_DEV_GONE , &port_dev->state); +hisi_sas_notify_phy_event (phy,HISI_PHYE_LINK_RESET ); +return ; + } + } + phy->wait_phyup_cnt =0 ;if (phy->identify.target_port_protocols ==SAS_PROTOCOL_SSP ) hisi_hba->hw->sl_notify_ssp (hisi_hba, phy_no);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 229/280 scsi: ufs: exynos: Ensure pre_link() executes before exynos_ufs_phy_init()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Griffin <[email protected]>
[ Upstream commit 3d101165e72316775947d71321d97194f03dfef3 ]
Ensure clocks are enabled before configuring unipro. Additionally move the pre_link() hook before the exynos_ufs_phy_init() calls. This means the register write sequence more closely resembles the ordering of the downstream driver.
--- drivers/ufs/host/ufs-exynos.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/ufs/host/ufs-exynos.c +5 -5
@@ -1028,9 +1028,14 @@ static int exynos_ufs_pre_link(struct ufs_hba *hba)exynos_ufs_config_intr (ufs,DFES_DEF_L4_ERRS ,UNIPRO_L4 );exynos_ufs_set_unipro_pclk_div (ufs); +exynos_ufs_setup_clocks (hba, true,PRE_CHANGE ); +/* unipro */ exynos_ufs_config_unipro (ufs); +if (ufs->drv_data->pre_link) + ufs->drv_data->pre_link (ufs); +/* m-phy */ exynos_ufs_phy_init (ufs);if (!(ufs->opts &EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR )) {
@@ -1038,11 +1043,6 @@ static int exynos_ufs_pre_link(struct ufs_hba *hba)exynos_ufs_config_phy_cap_attr (ufs); } -exynos_ufs_setup_clocks (hba, true,PRE_CHANGE ); - -if (ufs->drv_data->pre_link) - ufs->drv_data->pre_link (ufs); -return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 230/280 scsi: ufs: exynos: Enable PRDT pre-fetching with UFSHCD_CAP_CRYPTO
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Griffin <[email protected]>
[ Upstream commit deac9ad496ec17e1ec06848964ecc635bdaca703 ]
PRDT_PREFETCH_ENABLE[31] bit should be set when desctype field of fmpsecurity0 register is type2 (double file encryption) or type3 (support for file and disk encryption). Setting this bit enables PRDT pre-fetching on both TXPRDT and RXPRDT.
--- drivers/ufs/host/ufs-exynos.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/ufs/host/ufs-exynos.c +7 -2
@@ -34,7 +34,7 @@* Exynos's Vendor specific registers for UFSHCI */ #define HCI_TXPRDT_ENTRY_SIZE 0x00 -#define PRDT_PREFECT_EN BIT(31) +#define PRDT_PREFETCH_EN BIT(31)#define HCI_RXPRDT_ENTRY_SIZE 0x04#define HCI_1US_TO_CNT_VAL 0x0C#define CNT_VAL_1US_MASK 0x3FF
@@ -1066,12 +1066,17 @@ static int exynos_ufs_post_link(struct ufs_hba *hba)struct exynos_ufs *ufs =ufshcd_get_variant (hba);struct phy *generic_phy = ufs->phy;struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr; +u32 val =ilog2 (DATA_UNIT_SIZE );exynos_ufs_establish_connt (ufs);exynos_ufs_fit_aggr_timeout (ufs);hci_writel (ufs,0xa ,HCI_DATA_REORDER ); -hci_writel (ufs,ilog2 (DATA_UNIT_SIZE ),HCI_TXPRDT_ENTRY_SIZE ); + +if (hba->caps &UFSHCD_CAP_CRYPTO ) + val |=PRDT_PREFETCH_EN ; +hci_writel (ufs, val,HCI_TXPRDT_ENTRY_SIZE ); +hci_writel (ufs,ilog2 (DATA_UNIT_SIZE ),HCI_RXPRDT_ENTRY_SIZE );hci_writel (ufs, (1 << hba->nutrs) -1 ,HCI_UTRL_NEXUS_TYPE );hci_writel (ufs, (1 << hba->nutmrs) -1 ,HCI_UTMRL_NEXUS_TYPE );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 231/280 scsi: ufs: exynos: Move phy calls to .exit() callback
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Griffin <[email protected]>
[ Upstream commit 67e4085015c33bf2fb552af1f171c58b81ef0616 ]
ufshcd_pltfrm_remove() calls ufshcd_remove(hba) which in turn calls ufshcd_hba_exit().
By moving the phy_power_off() and phy_exit() calls to the newly created .exit callback they get called by ufshcd_variant_hba_exit() before ufshcd_hba_exit() turns off the regulators. This is also similar flow to the ufs-qcom driver.
--- drivers/ufs/host/ufs-exynos.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/ufs/host/ufs-exynos.c +9 -6
@@ -1490,6 +1490,14 @@ static int exynos_ufs_init(struct ufs_hba *hba)return ret; } +static void exynos_ufs_exit (struct ufs_hba *hba) +{ +struct exynos_ufs *ufs =ufshcd_get_variant (hba); + +phy_power_off (ufs->phy); +phy_exit (ufs->phy); +} +static int exynos_ufs_host_reset (struct ufs_hba *hba) {struct exynos_ufs *ufs =ufshcd_get_variant (hba);
@@ -1958,6 +1966,7 @@ static int gs101_ufs_pre_pwr_change(struct exynos_ufs *ufs,static const struct ufs_hba_variant_ops ufs_hba_exynos_ops = { .name ="exynos_ufs" , .init = exynos_ufs_init, + .exit = exynos_ufs_exit, .hce_enable_notify = exynos_ufs_hce_enable_notify, .link_startup_notify = exynos_ufs_link_startup_notify, .pwr_change_notify = exynos_ufs_pwr_change_notify,
@@ -1996,13 +2005,7 @@ static int exynos_ufs_probe(struct platform_device *pdev)static void exynos_ufs_remove (struct platform_device *pdev) { -struct ufs_hba *hba =platform_get_drvdata (pdev); -struct exynos_ufs *ufs =ufshcd_get_variant (hba); -ufshcd_pltfrm_remove (pdev); - -phy_power_off (ufs->phy); -phy_exit (ufs->phy); }static struct exynos_ufs_uic_attr exynos7_uic_attr = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 232/280 scsi: ufs: exynos: gs101: Put UFS device in reset on .suspend()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Griffin <[email protected]>
[ Upstream commit cd4c0025069f16fc666c6ffc56c49c9b1154841f ]
GPIO_OUT[0] is connected to the reset pin of embedded UFS device. Before powering off the phy assert the reset signal.
This is added as a gs101 specific suspend hook so as not to have any unintended consequences for other SoCs supported by this driver.
--- drivers/ufs/host/ufs-exynos.c | 10 ++++++++++ drivers/ufs/host/ufs-exynos.h | 1 + 2 files changed, 11 insertions(+)
drivers/ufs/host/ufs-exynos.c +10 -0
@@ -1687,6 +1687,12 @@ static void exynos_ufs_hibern8_notify(struct ufs_hba *hba, } } +static int gs101_ufs_suspend (struct exynos_ufs *ufs) +{ +hci_writel (ufs,0 <<0 ,HCI_GPIO_OUT ); +return 0 ; +} +static int exynos_ufs_suspend (struct ufs_hba *hba,enum ufs_pm_op pm_op,enum ufs_notify_change_status status) {
@@ -1695,6 +1701,9 @@ static int exynos_ufs_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op,if (status ==PRE_CHANGE )return 0 ; +if (ufs->drv_data->suspend) + ufs->drv_data->suspend (ufs); +if (!ufshcd_is_link_active (hba))phy_power_off (ufs->phy);
@@ -2172,6 +2181,7 @@ static const struct exynos_ufs_drv_data gs101_ufs_drvs = { .pre_link = gs101_ufs_pre_link, .post_link = gs101_ufs_post_link, .pre_pwr_change = gs101_ufs_pre_pwr_change, + .suspend = gs101_ufs_suspend, };static const struct of_device_id exynos_ufs_of_match[] = {
drivers/ufs/host/ufs-exynos.h +1 -0
@@ -192,6 +192,7 @@ struct exynos_ufs_drv_data { struct ufs_pa_layer_attr *pwr);int (*pre_hce_enable)(struct exynos_ufs *ufs);int (*post_hce_enable)(struct exynos_ufs *ufs); +int (*suspend)(struct exynos_ufs *ufs); };struct ufs_phy_time_cfg {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 233/280 scsi: pm80xx: Set phy_attached to zero when device is gone
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Pylypiv <[email protected]>
[ Upstream commit f7b705c238d1483f0a766e2b20010f176e5c0fb7 ]
When a fatal error occurs, a phy down event may not be received to set phy->phy_attached to zero.
--- drivers/scsi/pm8001/pm8001_sas.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/pm8001/pm8001_sas.c +1 -0
@@ -719,6 +719,7 @@ static void pm8001_dev_gone_notify(struct domain_device *dev)spin_lock_irqsave (&pm8001_ha->lock, flags); }PM8001_CHIP_DISP ->dereg_dev_req (pm8001_ha, device_id); + pm8001_ha->phy[pm8001_dev->attached_phy].phy_attached =0 ;pm8001_free_dev (pm8001_dev); }else {pm8001_dbg (pm8001_ha,DISC ,"Found dev has gone.\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 234/280 ASoC: fsl_asrc_dma: get codec or cpu dai from backend
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shengjiu Wang <[email protected]>
[ Upstream commit ef5c23ae9ab380fa756f257411024a9b4518d1b9 ]
With audio graph card, original cpu dai is changed to codec device in backend, so if cpu dai is dummy device in backend, get the codec dai device, which is the real hardware device connected.
The specific case is ASRC->SAI->AMIX->CODEC.
--- sound/soc/fsl/fsl_asrc_dma.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
sound/soc/fsl/fsl_asrc_dma.c +14 -1
@@ -156,11 +156,24 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component *component,for_each_dpcm_be (rtd, stream, dpcm) {struct snd_soc_pcm_runtime *be = dpcm->be;struct snd_pcm_substream *substream_be; -struct snd_soc_dai *dai =snd_soc_rtd_to_cpu (be,0 ); +struct snd_soc_dai *dai_cpu =snd_soc_rtd_to_cpu (be,0 ); +struct snd_soc_dai *dai_codec =snd_soc_rtd_to_codec (be,0 ); +struct snd_soc_dai *dai;if (dpcm->fe != rtd)continue ; +/* +* With audio graph card, original cpu dai is changed to codec +* device in backend, so if cpu dai is dummy device in backend, +* get the codec dai device, which is the real hardware device +* connected. +*/ +if (!snd_soc_dai_is_dummy (dai_cpu)) + dai = dai_cpu; +else + dai = dai_codec; + substream_be =snd_soc_dpcm_get_substream (be, stream); dma_params_be =snd_soc_dai_get_dma_data (dai, substream_be); dev_be = dai->dev;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 235/280 x86/i8253: Call clockevent_i8253_disable() with interrupts disabled
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fernando Fernandez Mancera <[email protected]>
[ Upstream commit 3940f5349b476197fb079c5aa19c9a988de64efb ]
There's a lockdep false positive warning related to i8253_lock:
WARNING: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected
...
systemd-sleep/3324 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire:
ffffffffb2c23398 (i8253_lock){+.+.}-{2:2}, at: pcspkr_event+0x3f/0xe0 [pcspkr]
...
... which became HARDIRQ-irq-unsafe at:
...
lock_acquire+0xd0/0x2f0
_raw_spin_lock+0x30/0x40
clockevent_i8253_disable+0x1c/0x60
pit_timer_init+0x25/0x50
hpet_time_init+0x46/0x50
x86_late_time_init+0x1b/0x40
start_kernel+0x962/0xa00
x86_64_start_reservations+0x24/0x30
x86_64_start_kernel+0xed/0xf0
common_startup_64+0x13e/0x141
...Lockdep complains due pit_timer_init() using the lock in an IRQ-unsafe fashion, but it's a false positive, because there is no deadlock possible at that point due to init ordering: at the point where pit_timer_init() is called there is no other possible usage of i8253_lock because the system is still in the very early boot stage with no interrupts.
But in any case, pit_timer_init() should disable interrupts before calling clockevent_i8253_disable() out of general principle, and to keep lockdep working even in this scenario.
Use scoped_guard() for that, as suggested by Thomas Gleixner.
[ mingo: Cleaned up the changelog. ]
--- arch/x86/kernel/i8253.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/i8253.c +2 -1
@@ -46,7 +46,8 @@ bool __init pit_timer_init(void)* VMMs otherwise steal CPU time just to pointlessly waggle * the (masked) IRQ. */ -clockevent_i8253_disable (); +scoped_guard (irq) +clockevent_i8253_disable ();return false; }clockevent_i8253_init (true);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 236/280 netfs: Only create /proc/fs/netfs with CONFIG_PROC_FS
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Song Liu <[email protected]>
[ Upstream commit 40cb48eba3b4b79e110c1a35d33a48cac54507a2 ]
When testing a special config:
CONFIG_NETFS_SUPPORTS=yCONFIG_PROC_FS=n
The system crashes with something like:
[ 3.766197] ------------[ cut here ]------------ [ 3.766484] kernel BUG at mm/mempool.c:560! [ 3.766789] Oops: invalid opcode: 0000 [#1] SMP NOPTI [ 3.767123] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Tainted: G W [ 3.767777] Tainted: [W]=WARN [ 3.767968] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), [ 3.768523] RIP: 0010:mempool_alloc_slab.cold+0x17/0x19 [ 3.768847] Code: 50 fe ff 58 5b 5d 41 5c 41 5d 41 5e 41 5f e9 93 95 13 00 [ 3.769977] RSP: 0018:ffffc90000013998 EFLAGS: 00010286 [ 3.770315] RAX: 000000000000002f RBX: ffff888100ba8640 RCX: 0000000000000000 [ 3.770749] RDX: 0000000000000000 RSI: 0000000000000003 RDI: 00000000ffffffff [ 3.771217] RBP: 0000000000092880 R08: 0000000000000000 R09: ffffc90000013828 [ 3.771664] R10: 0000000000000001 R11: 00000000ffffffea R12: 0000000000092cc0 [ 3.772117] R13: 0000000000000400 R14: ffff8881004b1620 R15: ffffea0004ef7e40 [ 3.772554] FS: 0000000000000000(0000) GS:ffff8881b5f3c000(0000) knlGS:0000000000000000 [ 3.773061] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 3.773443] CR2: ffffffff830901b4 CR3: 0000000004296001 CR4: 0000000000770ef0 [ 3.773884] PKRU: 55555554 [ 3.774058] Call Trace: [ 3.774232] <TASK> [ 3.774371] mempool_alloc_noprof+0x6a/0x190 [ 3.774649] ? _printk+0x57/0x80 [ 3.774862] netfs_alloc_request+0x85/0x2ce [ 3.775147] netfs_readahead+0x28/0x170 [ 3.775395] read_pages+0x6c/0x350 [ 3.775623] ? srso_alias_return_thunk+0x5/0xfbef5 [ 3.775928] page_cache_ra_unbounded+0x1bd/0x2a0 [ 3.776247] filemap_get_pages+0x139/0x970 [ 3.776510] ? srso_alias_return_thunk+0x5/0xfbef5 [ 3.776820] filemap_read+0xf9/0x580 [ 3.777054] ? srso_alias_return_thunk+0x5/0xfbef5 [ 3.777368] ? srso_alias_return_thunk+0x5/0xfbef5 [ 3.777674] ? find_held_lock+0x32/0x90 [ 3.777929] ? netfs_start_io_read+0x19/0x70 [ 3.778221] ? netfs_start_io_read+0x19/0x70 [ 3.778489] ? srso_alias_return_thunk+0x5/0xfbef5 [ 3.778800] ? lock_acquired+0x1e6/0x450 [ 3.779054] ? srso_alias_return_thunk+0x5/0xfbef5 [ 3.779379] netfs_buffered_read_iter+0x57/0x80 [ 3.779670] __kernel_read+0x158/0x2c0 [ 3.779927] bprm_execve+0x300/0x7a0 [ 3.780185] kernel_execve+0x10c/0x140 [ 3.780423] ? __pfx_kernel_init+0x10/0x10 [ 3.780690] kernel_init+0xd5/0x150 [ 3.780910] ret_from_fork+0x2d/0x50 [ 3.781156] ? __pfx_kernel_init+0x10/0x10 [ 3.781414] ret_from_fork_asm+0x1a/0x30 [ 3.781677] </TASK> [ 3.781823] Modules linked in: [ 3.782065] ---[ end trace 0000000000000000 ]---
This is caused by the following error path in netfs_init():
if (!proc_mkdir("fs/netfs", NULL))
goto error_proc;Fix this by adding ifdef in netfs_main(), so that /proc/fs/netfs is only created with CONFIG_PROC_FS.
--- fs/netfs/main.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/netfs/main.c +4 -0
@@ -125,11 +125,13 @@ static int __init netfs_init(void)if (mempool_init_slab_pool (&netfs_subrequest_pool,100 , netfs_subrequest_slab) <0 ) goto error_subreqpool; +#ifdef CONFIG_PROC_FS if (!proc_mkdir ("fs/netfs" ,NULL )) goto error_proc;if (!proc_create_seq ("fs/netfs/requests" ,S_IFREG |0444 ,NULL , &netfs_requests_seq_ops)) goto error_procfile; +#endif #ifdef CONFIG_FSCACHE_STATS if (!proc_create_single ("fs/netfs/stats" ,S_IFREG |0444 ,NULL , netfs_stats_show))
@@ -142,9 +144,11 @@ static int __init netfs_init(void)return 0 ; error_fscache: +#ifdef CONFIG_PROC_FS error_procfile:remove_proc_subtree ("fs/netfs" ,NULL ); error_proc: +#endif mempool_exit (&netfs_subrequest_pool); error_subreqpool:kmem_cache_destroy (netfs_subrequest_slab);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 237/280 iomap: skip unnecessary ifs_block_is_uptodate check
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gou Hao <[email protected]>
[ Upstream commit 8e3c15ee0d292c413c66fe10201d1b035a0bea72 ]
In iomap_adjust_read_range, i is either the first !uptodate block, or it is past last for the second loop looking for trailing uptodate blocks. Assuming there's no overflow (there's no combination of huge folios and tiny blksize) then yeah, there is no point in retesting that the same block pointed to by i is uptodate since we hold the folio lock so nobody else could have set it uptodate.
--- fs/iomap/buffered-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/iomap/buffered-io.c +1 -1
@@ -263,7 +263,7 @@ static void iomap_adjust_read_range(struct inode *inode, struct folio *folio, }/* truncate len if we find any trailing uptodate block(s) */ -for ( ; i <= last; i++) { +while (++i <= last) {if (ifs_block_is_uptodate (ifs, i)) { plen -= (last - i +1 ) * block_size; last = i -1 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 238/280 riscv: Provide all alternative macros all the time
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Jones <[email protected]>
[ Upstream commit fb53a9aa5f5b8bf302f3260a7f1f5a24345ce62a ]
We need to provide all six forms of the alternative macros (ALTERNATIVE, ALTERNATIVE_2, _ALTERNATIVE_CFG, _ALTERNATIVE_CFG_2, __ALTERNATIVE_CFG, __ALTERNATIVE_CFG_2) for all four cases derived from the two ifdefs (RISCV_ALTERNATIVE, __ASSEMBLY__) in order to ensure all configs can compile. Define this missing ones and ensure all are defined to consume all parameters passed.
--- arch/riscv/include/asm/alternative-macros.h | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
arch/riscv/include/asm/alternative-macros.h +7 -12
@@ -115,24 +115,19 @@ \old_c .endm -#define _ALTERNATIVE_CFG (old_c, ...) \ - ALTERNATIVE_CFG old_c - -#define _ALTERNATIVE_CFG_2 (old_c, ...) \ - ALTERNATIVE_CFG old_c +#define __ALTERNATIVE_CFG (old_c, ...) ALTERNATIVE_CFG old_c +#define __ALTERNATIVE_CFG_2 (old_c, ...) ALTERNATIVE_CFG old_c#else /* !__ASSEMBLY__ */ -#define __ALTERNATIVE_CFG (old_c) \ - old_c "\n" +#define __ALTERNATIVE_CFG (old_c, ...) old_c "\n" +#define __ALTERNATIVE_CFG_2 (old_c, ...) old_c "\n" -#define _ALTERNATIVE_CFG (old_c, ...) \ - __ALTERNATIVE_CFG(old_c) +#endif /* __ASSEMBLY__ */ -#define _ALTERNATIVE_CFG_2 (old_c, ...) \ - __ALTERNATIVE_CFG(old_c) +#define _ALTERNATIVE_CFG (old_c, ...) __ALTERNATIVE_CFG(old_c) +#define _ALTERNATIVE_CFG_2 (old_c, ...) __ALTERNATIVE_CFG_2(old_c) -#endif /* __ASSEMBLY__ */ #endif /* CONFIG_RISCV_ALTERNATIVE */ /*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 239/280 ksmbd: fix WARNING "do not call blocking ops when !TASK_RUNNING"
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 1df0d4c616138784e033ad337961b6e1a6bcd999 ]
wait_event_timeout() will set the state of the current
task to TASK_UNINTERRUPTIBLE, before doing the condition check. This means that ksmbd_durable_scavenger_alive() will try to acquire the mutex while already in a sleeping state. The scheduler warns us by giving the following warning:
do not call blocking ops when !TASK_RUNNING; state=2 set at
[<0000000061515a6f>] prepare_to_wait_event+0x9f/0x6c0 WARNING: CPU: 2 PID: 4147 at kernel/sched/core.c:10099 __might_sleep+0x12f/0x160
mutex lock is not needed in ksmbd_durable_scavenger_alive().
--- fs/smb/server/vfs_cache.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
fs/smb/server/vfs_cache.c +1 -7
@@ -713,12 +713,8 @@ static bool tree_conn_fd_check(struct ksmbd_tree_connect *tcon,static bool ksmbd_durable_scavenger_alive (void ) { -mutex_lock (&durable_scavenger_lock); -if (!durable_scavenger_running) { -mutex_unlock (&durable_scavenger_lock); +if (!durable_scavenger_running)return false; - } -mutex_unlock (&durable_scavenger_lock);if (kthread_should_stop ())return false;
@@ -799,9 +795,7 @@ static int ksmbd_durable_scavenger(void *dummy)break ; } -mutex_lock (&durable_scavenger_lock); durable_scavenger_running = false; -mutex_unlock (&durable_scavenger_lock);module_put (THIS_MODULE );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 240/280 spi: tegra210-quad: use WARN_ON_ONCE instead of WARN_ON for timeouts
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit 41c721fc093938745d116c3a21326a0ee03bb491 ]
Some machines with tegra_qspi_combined_seq_xfer hardware issues generate excessive kernel warnings, severely polluting the logs:
dmesg | grep -i "WARNING:.*tegra_qspi_transfer_one_message" | wc -l 94451
This patch replaces WARN_ON with WARN_ON_ONCE for timeout conditions to reduce log spam. The subsequent error message still prints on each occurrence, providing sufficient information about the failure, while the stack trace is only needed once for debugging purposes.
--- drivers/spi/spi-tegra210-quad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-tegra210-quad.c +1 -1
@@ -1117,7 +1117,7 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi, (&tqspi->xfer_completion,QSPI_DMA_TIMEOUT ); -if (WARN_ON (ret ==0 )) { +if (WARN_ON_ONCE (ret ==0 )) {dev_err (tqspi->dev,"QSPI Transfer failed with timeout: %d\n" , ret); if (tqspi->is_curr_dma_xfer &&
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 241/280 spi: tegra210-quad: add rate limiting and simplify timeout error message
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit 21f4314e66ed8d40b2ee24185d1a06a07a512eb1 ]
On malfunctioning hardware, timeout error messages can appear thousands of times, creating unnecessary system pressure and log bloat. This patch makes two improvements:
1. Replace dev_err() with dev_err_ratelimited() to prevent log flooding when hardware errors persist
2. Remove the redundant timeout value parameter from the error message, as 'ret' is always zero in this error path
These changes reduce logging overhead while maintaining necessary error reporting for debugging purposes.
--- drivers/spi/spi-tegra210-quad.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-tegra210-quad.c +2 -2
@@ -1118,8 +1118,8 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi, QSPI_DMA_TIMEOUT);if (WARN_ON_ONCE (ret ==0 )) { -dev_err (tqspi->dev,"QSPI Transfer failed with timeout: %d\n" , - ret); +dev_err_ratelimited (tqspi->dev, +"QSPI Transfer failed with timeout\n" );if (tqspi->is_curr_dma_xfer && (tqspi->cur_direction &DATA_DIR_TX )) dmaengine_terminate_all
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 242/280 ubsan: Fix panic from test_ubsan_out_of_bounds
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mostafa Saleh <[email protected]>
[ Upstream commit 9b044614be12d78d3a93767708b8d02fb7dfa9b0 ]
Running lib_ubsan.ko on arm64 (without CONFIG_UBSAN_TRAP) panics the kernel:
[ 31.616546] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: test_ubsan_out_of_bounds+0x158/0x158 [test_ubsan] [ 31.646817] CPU: 3 UID: 0 PID: 179 Comm: insmod Not tainted 6.15.0-rc2 #1 PREEMPT [ 31.648153] Hardware name: linux,dummy-virt (DT) [ 31.648970] Call trace: [ 31.649345] show_stack+0x18/0x24 (C) [ 31.650960] dump_stack_lvl+0x40/0x84 [ 31.651559] dump_stack+0x18/0x24 [ 31.652264] panic+0x138/0x3b4 [ 31.652812] __ktime_get_real_seconds+0x0/0x10 [ 31.653540] test_ubsan_load_invalid_value+0x0/0xa8 [test_ubsan] [ 31.654388] init_module+0x24/0xff4 [test_ubsan] [ 31.655077] do_one_initcall+0xd4/0x280 [ 31.655680] do_init_module+0x58/0x2b4
That happens because the test corrupts other data in the stack:
400: d5384108 mrs x8, sp_el0 404: f9426d08 ldr x8, [x8, #1240] 408: f85f83a9 ldur x9, [x29, #-8] 40c: eb09011f cmp x8, x9 410: 54000301 b.ne 470 <test_ubsan_out_of_bounds+0x154> // b.any
As there is no guarantee the compiler will order the local variables as declared in the module:
volatile char above[4] = { }; /* Protect surrounding memory. */ volatile int arr[4];
volatile char below[4] = { }; /* Protect surrounding memory. */
There is another problem where the out-of-bound index is 5 which is larger than the extra surrounding memory for protection.
So, use a struct to enforce the ordering, and fix the index to be 4. Also, remove some of the volatiles and rely on OPTIMIZER_HIDE_VAR()
--- lib/test_ubsan.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
lib/test_ubsan.c +11 -7
@@ -68,18 +68,22 @@ static void test_ubsan_shift_out_of_bounds(void)static void test_ubsan_out_of_bounds (void ) { -volatile int i =4 , j =5 , k =-1 ; -volatile char above[4 ] = { };/* Protect surrounding memory. */ -volatile int arr[4 ]; -volatile char below[4 ] = { };/* Protect surrounding memory. */ +int i =4 , j =4 , k =-1 ; +volatile struct { +char above[4 ];/* Protect surrounding memory. */ +int arr[4 ]; +char below[4 ];/* Protect surrounding memory. */ + } data; - above[0 ] = below[0 ]; +OPTIMIZER_HIDE_VAR (i); +OPTIMIZER_HIDE_VAR (j); +OPTIMIZER_HIDE_VAR (k);UBSAN_TEST (CONFIG_UBSAN_BOUNDS ,"above" ); - arr[j] = i; + data.arr[j] = i;UBSAN_TEST (CONFIG_UBSAN_BOUNDS ,"below" ); - arr[k] = i; + data.arr[k] = i; }enum ubsan_test_enum {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 243/280 x86/cpu: Add CPU model number for Bartlett Lake CPUs with Raptor Cove cores
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pi Xiange <[email protected]>
[ Upstream commit d466304c4322ad391797437cd84cca7ce1660de0 ]
Bartlett Lake has a P-core only product with Raptor Cove.
[ mingo: Switch around the define as pointed out by Christian Ludloff:
Ratpr Cove is the core, Bartlett Lake is the product.
--- arch/x86/include/asm/intel-family.h | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/include/asm/intel-family.h +2 -0
@@ -115,6 +115,8 @@#define INTEL_GRANITERAPIDS_X IFM(6, 0xAD)#define INTEL_GRANITERAPIDS_D IFM(6, 0xAE) +#define INTEL_BARTLETTLAKE IFM(6, 0xD7)/* Raptor Cove */ +/* "Hybrid" Processors (P-Core/E-Core) */ #define INTEL_LAKEFIELD IFM(6, 0x8A)/* Sunny Cove / Tremont */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 244/280 md/raid1: Add check for missing source disk in process_checks()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Meir Elisha <[email protected]>
[ Upstream commit b7c178d9e57c8fd4238ff77263b877f6f16182ba ]
During recovery/check operations, the process_checks function loops through available disks to find a 'primary' source with successfully read data.
If no suitable source disk is found after checking all possibilities, the 'primary' index will reach conf->raid_disks * 2. Add an explicit check for this condition after the loop. If no source disk was found, print an error message and return early to prevent further processing without a valid primary source.
--- drivers/md/raid1.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
drivers/md/raid1.c +16 -10
@@ -2156,14 +2156,9 @@ static int fix_sync_read_error(struct r1bio *r1_bio)if (!rdev_set_badblocks (rdev, sect, s,0 )) abort =1 ; } -if (abort) { - conf->recovery_disabled = - mddev->recovery_disabled; -set_bit (MD_RECOVERY_INTR , &mddev->recovery); -md_done_sync (mddev, r1_bio->sectors,0 ); -put_buf (r1_bio); +if (abort)return 0 ; - } +/* Try next page */ sectors -= s; sect += s;
@@ -2302,10 +2297,21 @@ static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio)int disks = conf->raid_disks *2 ;struct bio *wbio; -if (!test_bit (R1BIO_Uptodate, &r1_bio->state)) -/* ouch - failed to read all of that. */ -if (!fix_sync_read_error (r1_bio)) +if (!test_bit (R1BIO_Uptodate, &r1_bio->state)) { +/* +* ouch - failed to read all of that. +* No need to fix read error for check/repair +* because all member disks are read. +*/ +if (test_bit (MD_RECOVERY_REQUESTED , &mddev->recovery) || + !fix_sync_read_error (r1_bio)) { + conf->recovery_disabled = mddev->recovery_disabled; +set_bit (MD_RECOVERY_INTR , &mddev->recovery); +md_done_sync (mddev, r1_bio->sectors,0 ); +put_buf (r1_bio);return ; + } + }if (test_bit (MD_RECOVERY_REQUESTED , &mddev->recovery))process_checks (r1_bio);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 245/280 drm/amdgpu: use a dummy owner for sysfs triggered cleaner shaders v4
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian König <[email protected]>
[ Upstream commit 447fab30955cf7dba7dd563f42b67c02284860c8 ]
Otherwise triggering sysfs multiple times without other submissions in between only runs the shader once.
v2: add some comment
v3: re-add missing cast
v4: squash in semicolon fix
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +11 -3
@@ -1426,9 +1426,11 @@ static int amdgpu_gfx_run_cleaner_shader_job(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;struct drm_gpu_scheduler *sched = &ring->sched;struct drm_sched_entity entity; +static atomic_t counter;struct dma_fence *f;struct amdgpu_job *job;struct amdgpu_ib *ib; +void *owner;int i, r;/* Initialize the scheduler entity */
@@ -1439,9 +1441,15 @@ static int amdgpu_gfx_run_cleaner_shader_job(struct amdgpu_ring *ring) goto err; } - r =amdgpu_job_alloc_with_ib (ring->adev, &entity,NULL , -64 ,0 , - &job); +/* +* Use some unique dummy value as the owner to make sure we execute +* the cleaner shader on each submission. The value just need to change +* for each submission and is otherwise meaningless. +*/ + owner = (void *)(unsigned long )atomic_inc_return (&counter); + + r =amdgpu_job_alloc_with_ib (ring->adev, &entity, owner, +64 ,0 , &job);if (r) goto err;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 246/280 drm/amdgpu: Use the right function for hdp flush
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lijo Lazar <[email protected]>
[ Upstream commit c235a7132258ac30bd43d228222986022d21f5de ]
There are a few prechecks made before HDP flush like a flush is not required on APU bare metal. Using hdp callback directly bypasses those checks. Use amdgpu_device_flush_hdp which takes care of prechecks.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 12 ++++++------ drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/psp_v13_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/psp_v14_0.c | 2 +- 10 files changed, 23 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +4 -4
@@ -5998,7 +5998,7 @@ static int gfx_v10_0_cp_gfx_load_pfp_microcode(struct amdgpu_device *adev) }if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , mmCP_PFP_IC_BASE_CNTL); tmp =REG_SET_FIELD (tmp,CP_PFP_IC_BASE_CNTL ,VMID ,0 );
@@ -6076,7 +6076,7 @@ static int gfx_v10_0_cp_gfx_load_ce_microcode(struct amdgpu_device *adev) }if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , mmCP_CE_IC_BASE_CNTL); tmp =REG_SET_FIELD (tmp,CP_CE_IC_BASE_CNTL ,VMID ,0 );
@@ -6153,7 +6153,7 @@ static int gfx_v10_0_cp_gfx_load_me_microcode(struct amdgpu_device *adev) }if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , mmCP_ME_IC_BASE_CNTL); tmp =REG_SET_FIELD (tmp,CP_ME_IC_BASE_CNTL ,VMID ,0 );
@@ -6528,7 +6528,7 @@ static int gfx_v10_0_cp_compute_load_microcode(struct amdgpu_device *adev) }if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , mmCP_CPC_IC_BASE_CNTL); tmp =REG_SET_FIELD (tmp,CP_CPC_IC_BASE_CNTL ,CACHE_POLICY ,0 );
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +6 -6
@@ -2327,7 +2327,7 @@ static int gfx_v11_0_config_me_cache(struct amdgpu_device *adev, uint64_t addr) }if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , regCP_ME_IC_BASE_CNTL); tmp =REG_SET_FIELD (tmp,CP_ME_IC_BASE_CNTL ,VMID ,0 );
@@ -2371,7 +2371,7 @@ static int gfx_v11_0_config_pfp_cache(struct amdgpu_device *adev, uint64_t addr) }if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , regCP_PFP_IC_BASE_CNTL); tmp =REG_SET_FIELD (tmp,CP_PFP_IC_BASE_CNTL ,VMID ,0 );
@@ -2416,7 +2416,7 @@ static int gfx_v11_0_config_mec_cache(struct amdgpu_device *adev, uint64_t addr) }if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , regCP_CPC_IC_BASE_CNTL); tmp =REG_SET_FIELD (tmp,CP_CPC_IC_BASE_CNTL ,CACHE_POLICY ,0 );
@@ -3051,7 +3051,7 @@ static int gfx_v11_0_cp_gfx_load_pfp_microcode_rs64(struct amdgpu_device *adev)amdgpu_bo_unreserve (adev->gfx.pfp.pfp_fw_data_obj);if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );WREG32_SOC15 (GC ,0 , regCP_PFP_IC_BASE_LO,lower_32_bits (adev->gfx.pfp.pfp_fw_gpu_addr));
@@ -3269,7 +3269,7 @@ static int gfx_v11_0_cp_gfx_load_me_microcode_rs64(struct amdgpu_device *adev)amdgpu_bo_unreserve (adev->gfx.me.me_fw_data_obj);if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );WREG32_SOC15 (GC ,0 , regCP_ME_IC_BASE_LO,lower_32_bits (adev->gfx.me.me_fw_gpu_addr));
@@ -4487,7 +4487,7 @@ static int gfx_v11_0_gfxhub_enable(struct amdgpu_device *adev)if (r)return r; - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); value = (amdgpu_vm_fault_stop ==AMDGPU_VM_FAULT_STOP_ALWAYS ) ? false : true;
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +3 -3
@@ -2264,7 +2264,7 @@ static int gfx_v12_0_cp_gfx_load_pfp_microcode_rs64(struct amdgpu_device *adev)amdgpu_bo_unreserve (adev->gfx.pfp.pfp_fw_data_obj);if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );WREG32_SOC15 (GC ,0 , regCP_PFP_IC_BASE_LO,lower_32_bits (adev->gfx.pfp.pfp_fw_gpu_addr));
@@ -2408,7 +2408,7 @@ static int gfx_v12_0_cp_gfx_load_me_microcode_rs64(struct amdgpu_device *adev)amdgpu_bo_unreserve (adev->gfx.me.me_fw_data_obj);if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );WREG32_SOC15 (GC ,0 , regCP_ME_IC_BASE_LO,lower_32_bits (adev->gfx.me.me_fw_gpu_addr));
@@ -3429,7 +3429,7 @@ static int gfx_v12_0_gfxhub_enable(struct amdgpu_device *adev)if (r)return r; - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); value = (amdgpu_vm_fault_stop ==AMDGPU_VM_FAULT_STOP_ALWAYS ) ? false : true;
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +2 -2
@@ -265,7 +265,7 @@ static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, ack = hub->vm_inv_eng0_ack + hub->eng_distance * eng;/* flush hdp cache */ - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );/* This is necessary for SRIOV as well as for GFXOFF to function * properly under bare metal
@@ -966,7 +966,7 @@ static int gmc_v10_0_gart_enable(struct amdgpu_device *adev) adev->hdp.funcs->init_registers (adev);/* Flush HDP after it is initialized */ - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); value = (amdgpu_vm_fault_stop ==AMDGPU_VM_FAULT_STOP_ALWAYS ) ? false : true;
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +2 -2
@@ -226,7 +226,7 @@ static void gmc_v11_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, ack = hub->vm_inv_eng0_ack + hub->eng_distance * eng;/* flush hdp cache */ - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );/* This is necessary for SRIOV as well as for GFXOFF to function * properly under bare metal
@@ -893,7 +893,7 @@ static int gmc_v11_0_gart_enable(struct amdgpu_device *adev)return r;/* Flush HDP after it is initialized */ - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); value = (amdgpu_vm_fault_stop ==AMDGPU_VM_FAULT_STOP_ALWAYS ) ? false : true;
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +2 -2
@@ -294,7 +294,7 @@ static void gmc_v12_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,return ;/* flush hdp cache */ - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );/* This is necessary for SRIOV as well as for GFXOFF to function * properly under bare metal
@@ -862,7 +862,7 @@ static int gmc_v12_0_gart_enable(struct amdgpu_device *adev)return r;/* Flush HDP after it is initialized */ - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); value = (amdgpu_vm_fault_stop ==AMDGPU_VM_FAULT_STOP_ALWAYS ) ? false : true;
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -1
@@ -2351,7 +2351,7 @@ static int gmc_v9_0_hw_init(void *handle) adev->hdp.funcs->init_registers (adev);/* After HDP is initialized, flush HDP.*/ - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );if (amdgpu_vm_fault_stop ==AMDGPU_VM_FAULT_STOP_ALWAYS ) value = false;
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +1 -1
@@ -532,7 +532,7 @@ static int psp_v11_0_memory_training(struct psp_context *psp, uint32_t ops) }memcpy_toio (adev->mman.aper_base_kaddr, buf, sz); - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );vfree (buf);drm_dev_exit (idx); }else {
drivers/gpu/drm/amd/amdgpu/psp_v13_0.c +1 -1
@@ -600,7 +600,7 @@ static int psp_v13_0_memory_training(struct psp_context *psp, uint32_t ops) }memcpy_toio (adev->mman.aper_base_kaddr, buf, sz); - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );vfree (buf);drm_dev_exit (idx); }else {
drivers/gpu/drm/amd/amdgpu/psp_v14_0.c +1 -1
@@ -488,7 +488,7 @@ static int psp_v14_0_memory_training(struct psp_context *psp, uint32_t ops) }memcpy_toio (adev->mman.aper_base_kaddr, buf, sz); - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );vfree (buf);drm_dev_exit (idx); }else {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 247/280 spi: spi-imx: Add check for spi_imx_setupxfer()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tamura Dai <[email protected]>
[ Upstream commit 951a04ab3a2db4029debfa48d380ef834b93207e ]
Add check for the return value of spi_imx_setupxfer(). spi_imx->rx and spi_imx->tx function pointer can be NULL when spi_imx_setupxfer() return error, and make NULL pointer dereference.
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 Call trace: 0x0 spi_imx_pio_transfer+0x50/0xd8 spi_imx_transfer_one+0x18c/0x858 spi_transfer_one_message+0x43c/0x790 __spi_pump_transfer_message+0x238/0x5d4 __spi_sync+0x2b0/0x454 spi_write_then_read+0x11c/0x200
--- drivers/spi/spi-imx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/spi/spi-imx.c +4 -1
@@ -1614,10 +1614,13 @@ static int spi_imx_transfer_one(struct spi_controller *controller,struct spi_device *spi, struct spi_transfer *transfer) { + int ret;struct spi_imx_data *spi_imx =spi_controller_get_devdata (spi->controller);unsigned long hz_per_byte, byte_limit; -spi_imx_setupxfer (spi, transfer); + ret =spi_imx_setupxfer (spi, transfer); +if (ret <0 ) +return ret; transfer->effective_speed_hz = spi_imx->spi_bus_clk;/* flush rxfifo before transfer */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 248/280 Revert "drivers: core: synchronize really_probe() and dev_uevent()"
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
commit dc1771f718548f7d4b93991b174c6e7b5e1ba410 upstream.
This reverts commit c0a40097f0bc81deafc15f9195d1fb54595cd6d0.
Probing a device can take arbitrary long time. In the field we observed that, for example, probing a bad micro-SD cards in an external USB card reader (or maybe cards were good but cables were flaky) sometimes takes longer than 2 minutes due to multiple retries at various levels of the stack. We can not block uevent_show() method for that long because udev is reading that attribute very often and that blocks udev and interferes with booting of the system.
The change that introduced locking was concerned with dev_uevent() racing with unbinding the driver. However we can handle it without locking (which will be done in subsequent patch).
There was also claim that synchronization with probe() is needed to properly load USB drivers, however this is a red herring: the change adding the lock was introduced in May of last year and USB loading and probing worked properly for many years before that.
Revert the harmful locking.
--- drivers/base/core.c | 3 --- 1 file changed, 3 deletions(-)
drivers/base/core.c +0 -3
@@ -2726,11 +2726,8 @@ static ssize_t uevent_show(struct deviceif (!env)return -ENOMEM ; -/* Synchronize with really_probe() */ -device_lock (dev);/* let the kset specific function add its keys */ retval = kset->uevent_ops->uevent (&dev->kobj, env); -device_unlock (dev);if (retval) goto out;
Greg Kroah-Hartman
maintainerPATCH 249/280 driver core: introduce device_set_driver() helper
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
commit 04d3e5461c1f5cf8eec964ab64948ebed826e95e upstream.
In preparation to closing a race when reading driver pointer in dev_uevent() code, instead of setting device->driver pointer directly introduce device_set_driver() helper.
--- drivers/base/base.h | 6 ++++++ drivers/base/core.c | 2 +- drivers/base/dd.c | 7 +++---- 3 files changed, 10 insertions(+), 5 deletions(-)
drivers/base/base.h +6 -0
@@ -179,6 +179,12 @@ int driver_add_groups(const struct devicvoid driver_remove_groups (const struct device_driver *drv,const struct attribute_group **groups);void device_driver_detach (struct device *dev); +static inline void device_set_driver (struct device *dev,const struct device_driver *drv) +{ +// FIXME - this cast should not be needed "soon" + dev->driver = (struct device_driver *)drv; +} +int devres_release_all (struct device *dev);void device_block_probing (void );void device_unblock_probing (void );
drivers/base/core.c +1 -1
@@ -3697,7 +3697,7 @@ done:device_pm_remove (dev);dpm_sysfs_remove (dev); DPMError: - dev->driver =NULL ; +device_set_driver (dev,NULL );bus_remove_device (dev); BusError:device_remove_attrs (dev);
drivers/base/dd.c +3 -4
@@ -550,7 +550,7 @@ static void device_unbind_cleanup(structarch_teardown_dma_ops (dev);kfree (dev->dma_range_map); dev->dma_range_map =NULL ; - dev->driver =NULL ; +device_set_driver (dev,NULL );dev_set_drvdata (dev,NULL );if (dev->pm_domain && dev->pm_domain->dismiss) dev->pm_domain->dismiss (dev);
@@ -629,8 +629,7 @@ static int really_probe(struct device *d } re_probe: -// FIXME - this cast should not be needed "soon" - dev->driver = (struct device_driver *)drv; +device_set_driver (dev, drv);/* If using pinctrl, bind pins now before probing */ ret =pinctrl_bind_pins (dev);
@@ -1014,7 +1013,7 @@ static int __device_attach(struct deviceif (ret ==0 ) ret =1 ;else { - dev->driver =NULL ; +device_set_driver (dev,NULL ); ret =0 ; } }else {
Greg Kroah-Hartman
maintainerPATCH 250/280 driver core: fix potential NULL pointer dereference in dev_uevent()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
commit 18daa52418e7e4629ed1703b64777294209d2622 upstream.
If userspace reads "uevent" device attribute at the same time as another threads unbinds the device from its driver, change to dev->driver from a valid pointer to NULL may result in crash. Fix this by using READ_ONCE() when fetching the pointer, and take bus' drivers klist lock to make sure driver instance will not disappear while we access it.
Use WRITE_ONCE() when setting the driver pointer to ensure there is no tearing.
--- drivers/base/base.h | 13 ++++++++++++- drivers/base/bus.c | 2 +- drivers/base/core.c | 33 +++++++++++++++++++++++++++++++-- 3 files changed, 44 insertions(+), 4 deletions(-)
drivers/base/base.h +12 -1
@@ -73,6 +73,7 @@ static inline void subsys_put(struct subkset_put (&sp->subsys); } +struct subsys_private *bus_to_subsys (const struct bus_type *bus);struct subsys_private *class_to_subsys (const struct class *class);struct driver_private {
@@ -181,8 +182,18 @@ void device_driver_detach(struct devicestatic inline void device_set_driver (struct device *dev,const struct device_driver *drv) { +/* +* Majority (all?) read accesses to dev->driver happens either +* while holding device lock or in bus/driver code that is only +* invoked when the device is bound to a driver and there is no +* concern of the pointer being changed while it is being read. +* However when reading device's uevent file we read driver pointer +* without taking device lock (so we do not block there for +* arbitrary amount of time). We use WRITE_ONCE() here to prevent +* tearing so that READ_ONCE() can safely be used in uevent code. +*/ // FIXME - this cast should not be needed "soon" - dev->driver = (struct device_driver *)drv; +WRITE_ONCE (dev->driver, (struct device_driver *)drv); }int devres_release_all (struct device *dev);
drivers/base/bus.c +1 -1
@@ -57,7 +57,7 @@ static int __must_check bus_rescan_devic* NULL. A call to subsys_put() must be done when finished with the pointer in * order for it to be properly freed. */ -static struct subsys_private *bus_to_subsys (const struct bus_type *bus) +struct subsys_private *bus_to_subsys (const struct bus_type *bus) {struct subsys_private *sp =NULL ;struct kobject *kobj;
drivers/base/core.c +31 -2
@@ -2624,6 +2624,35 @@ static const char *dev_uevent_name(constreturn NULL ; } +/* +* Try filling "DRIVER=<name>" uevent variable for a device. Because this +* function may race with binding and unbinding the device from a driver, +* we need to be careful. Binding is generally safe, at worst we miss the +* fact that the device is already bound to a driver (but the driver +* information that is delivered through uevents is best-effort, it may +* become obsolete as soon as it is generated anyways). Unbinding is more +* risky as driver pointer is transitioning to NULL, so READ_ONCE() should +* be used to make sure we are dealing with the same pointer, and to +* ensure that driver structure is not going to disappear from under us +* we take bus' drivers klist lock. The assumption that only registered +* driver can be bound to a device, and to unregister a driver bus code +* will take the same lock. +*/ +static void dev_driver_uevent (const struct device *dev,struct kobj_uevent_env *env) +{ +struct subsys_private *sp =bus_to_subsys (dev->bus); + +if (sp) { + scoped_guard(spinlock, &sp->klist_drivers.k_lock) { +struct device_driver *drv =READ_ONCE (dev->driver); +if (drv) +add_uevent_var (env,"DRIVER=%s" , drv->name); + } + +subsys_put (sp); + } +} +static int dev_uevent (const struct kobject *kobj,struct kobj_uevent_env *env) {const struct device *dev =kobj_to_dev (kobj);
@@ -2655,8 +2684,8 @@ static int dev_uevent(const struct kobjeif (dev->type && dev->type->name)add_uevent_var (env,"DEVTYPE=%s" , dev->type->name); -if (dev->driver) -add_uevent_var (env,"DRIVER=%s" , dev->driver->name); +/* Add "DRIVER=%s" variable if the device is bound to a driver */ +dev_driver_uevent (dev, env);/* Add common DT information about the device */ of_device_uevent (dev, env);
Greg Kroah-Hartman
maintainerPATCH 251/280 xfs: do not check NEEDSREPAIR if ro,norecovery mount.
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Herbolt <[email protected]>
Commit 9e00163c31676c6b43d2334fdf5b406232f42dee upstream
If there is corrutpion on the filesystem andxfs_repair fails to repair it. The last resort of getting the data is to use norecovery,ro mount. But if the NEEDSREPAIR is set the filesystem cannot be mounted. The flag must be cleared out manually using xfs_db, to get access to what left over of the corrupted fs.
--- fs/xfs/xfs_super.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/xfs/xfs_super.c +6 -2
@@ -1619,8 +1619,12 @@ xfs_fs_fill_super(#endif } -/* Filesystem claims it needs repair, so refuse the mount. */ -if (xfs_has_needsrepair (mp)) { +/* +* Filesystem claims it needs repair, so refuse the mount unless +* norecovery is also specified, in which case the filesystem can +* be mounted with no risk of further damage. +*/ +if (xfs_has_needsrepair (mp) && !xfs_has_norecovery (mp)) {xfs_warn (mp,"Filesystem needs repair. Please run xfs_repair." ); error = -EFSCORRUPTED ; goto out_free_sb;
Greg Kroah-Hartman
maintainerPATCH 252/280 xfs: Do not allow norecovery mount with quotacheck
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carlos Maiolino <[email protected]>
Commit 9f0902091c332b2665951cfb970f60ae7cbdc0f3 upstream
Mounting a filesystem that requires quota state changing will generate a transaction.
We already check for a read-only device; we should do that for norecovery too.
A quotacheck on a norecovery mount, and with the right log size, will cause the mount process to hang on:
[<0>] xlog_grant_head_wait+0x5d/0x2a0 [xfs] [<0>] xlog_grant_head_check+0x112/0x180 [xfs] [<0>] xfs_log_reserve+0xe3/0x260 [xfs] [<0>] xfs_trans_reserve+0x179/0x250 [xfs] [<0>] xfs_trans_alloc+0x101/0x260 [xfs] [<0>] xfs_sync_sb+0x3f/0x80 [xfs] [<0>] xfs_qm_mount_quotas+0xe3/0x2f0 [xfs] [<0>] xfs_mountfs+0x7ad/0xc20 [xfs] [<0>] xfs_fs_fill_super+0x762/0xa50 [xfs] [<0>] get_tree_bdev_flags+0x131/0x1d0 [<0>] vfs_get_tree+0x26/0xd0 [<0>] vfs_cmd_create+0x59/0xe0 [<0>] __do_sys_fsconfig+0x4e3/0x6b0 [<0>] do_syscall_64+0x82/0x160 [<0>] entry_SYSCALL_64_after_hwframe+0x76/0x7e
This is caused by a transaction running with bogus initialized head/tail
I initially hit this while running generic/050, with random log sizes, but I managed to reproduce it reliably here with the steps below:
mkfs.xfs -f -lsize=1025M -f -b size=4096 -m crc=1,reflink=1,rmapbt=1, -i sparse=1 /dev/vdb2 > /dev/null
mount -o usrquota,grpquota,prjquota /dev/vdb2 /mntxfs_io -x -c 'shutdown -f' /mnt
umount /mnt
mount -o ro,norecovery,usrquota,grpquota,prjquota /dev/vdb2 /mnt
Last mount hangs up
As we add yet another validation if quota state is changing, this also add a new helper named xfs_qm_validate_state_change(), factoring the quota state changes out of xfs_qm_newmount() to reduce cluttering within it.
--- fs/xfs/xfs_qm_bhv.c | 49 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 15 deletions(-)
fs/xfs/xfs_qm_bhv.c +34 -15
@@ -79,6 +79,28 @@ xfs_qm_statvfs( } } +STATIC int +xfs_qm_validate_state_change ( +struct xfs_mount *mp, +uint uqd, +uint gqd, +uint pqd) +{ +int state; + +/* Is quota state changing? */ + state = ((uqd && !XFS_IS_UQUOTA_ON (mp)) || + (!uqd &&XFS_IS_UQUOTA_ON (mp)) || + (gqd && !XFS_IS_GQUOTA_ON (mp)) || + (!gqd &&XFS_IS_GQUOTA_ON (mp)) || + (pqd && !XFS_IS_PQUOTA_ON (mp)) || + (!pqd &&XFS_IS_PQUOTA_ON (mp))); + +return state && + (xfs_dev_is_read_only (mp,"changing quota state" ) || +xfs_has_norecovery (mp)); +} + int xfs_qm_newmount( xfs_mount_t *mp,
@@ -98,24 +120,21 @@ xfs_qm_newmount( }/* -* If the device itself is read-only, we can't allow -* the user to change the state of quota on the mount - -* this would generate a transaction on the ro device, -* which would lead to an I/O error and shutdown +* If the device itself is read-only and/or in norecovery +* mode, we can't allow the user to change the state of +* quota on the mount - this would generate a transaction +* on the ro device, which would lead to an I/O error and +* shutdown. */ -if (((uquotaondisk && !XFS_IS_UQUOTA_ON (mp)) || - (!uquotaondisk &&XFS_IS_UQUOTA_ON (mp)) || - (gquotaondisk && !XFS_IS_GQUOTA_ON (mp)) || - (!gquotaondisk &&XFS_IS_GQUOTA_ON (mp)) || - (pquotaondisk && !XFS_IS_PQUOTA_ON (mp)) || - (!pquotaondisk &&XFS_IS_PQUOTA_ON (mp))) && -xfs_dev_is_read_only (mp,"changing quota state" )) { +if (xfs_qm_validate_state_change (mp, uquotaondisk, + gquotaondisk, pquotaondisk)) { +xfs_warn (mp,"please mount with%s%s%s%s." , - (!quotaondisk ?"out quota" :"" ), - (uquotaondisk ?" usrquota" :"" ), - (gquotaondisk ?" grpquota" :"" ), - (pquotaondisk ?" prjquota" :"" )); + (!quotaondisk ?"out quota" :"" ), + (uquotaondisk ?" usrquota" :"" ), + (gquotaondisk ?" grpquota" :"" ), + (pquotaondisk ?" prjquota" :"" ));return -EPERM ; }
Greg Kroah-Hartman
maintainerPATCH 253/280 xfs: rename xfs_iomap_swapfile_activate to xfs_vm_swap_activate
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
Commit 3cd6a8056f5a2e794c42fc2114ee2611e358b357 upstream
Match the method name and the naming convention or address_space operations.
--- fs/xfs/xfs_aops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/xfs/xfs_aops.c +3 -3
@@ -528,7 +528,7 @@ xfs_vm_readahead( }static int -xfs_iomap_swapfile_activate ( +xfs_vm_swap_activate (struct swap_info_struct *sis,struct file *swap_file,sector_t *span)
@@ -549,11 +549,11 @@ const struct address_space_operations xf .migrate_folio = filemap_migrate_folio, .is_partially_uptodate = iomap_is_partially_uptodate, .error_remove_folio = generic_error_remove_folio, - .swap_activate = xfs_iomap_swapfile_activate, + .swap_activate = xfs_vm_swap_activate, };const struct address_space_operations xfs_dax_aops = { .writepages = xfs_dax_writepages, .dirty_folio = noop_dirty_folio, - .swap_activate = xfs_iomap_swapfile_activate, + .swap_activate = xfs_vm_swap_activate, };
Greg Kroah-Hartman
maintainerPATCH 254/280 xfs: flush inodegc before swapon
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
Commit 2d873efd174bae9005776937d5ac6a96050266db upstream
Fix the brand new xfstest that tries to swapon on a recently unshared file and use the chance to document the other bit of magic in this function.
The big comment is taken from a mailinglist post by Dave Chinner.
--- fs/xfs/xfs_aops.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
fs/xfs/xfs_aops.c +34 -1
@@ -19,6 +19,7 @@#include "xfs_reflink.h" #include "xfs_errortag.h" #include "xfs_error.h" +#include "xfs_icache.h" struct xfs_writepage_ctx {struct iomap_writepage_ctx ctx;
@@ -533,7 +534,39 @@ xfs_vm_swap_activate(struct file *swap_file, sector_t *span) { - sis->bdev = xfs_inode_buftarg(XFS_I(file_inode(swap_file)))->bt_bdev; + struct xfs_inode *ip = XFS_I(file_inode(swap_file)); + +/* +* Swap file activation can race against concurrent shared extent +* removal in files that have been cloned. If this happens, +* iomap_swapfile_iter() can fail because it encountered a shared +* extent even though an operation is in progress to remove those +* shared extents. +* +* This race becomes problematic when we defer extent removal +* operations beyond the end of a syscall (i.e. use async background +* processing algorithms). Users think the extents are no longer +* shared, but iomap_swapfile_iter() still sees them as shared +* because the refcountbt entries for the extents being removed have +* not yet been updated. Hence the swapon call fails unexpectedly. +* +* The race condition is currently most obvious from the unlink() +* operation as extent removal is deferred until after the last +* reference to the inode goes away. We then process the extent +* removal asynchronously, hence triggers the "syscall completed but +* work not done" condition mentioned above. To close this race +* window, we need to flush any pending inodegc operations to ensure +* they have updated the refcountbt records before we try to map the +* swapfile. +*/ +xfs_inodegc_flush (ip->i_mount); + +/* +* Direct the swap code to the correct block device when this file +* sits on the RT device. +*/ + sis->bdev =xfs_inode_buftarg (ip)->bt_bdev; +return iomap_swapfile_activate (sis, swap_file, span, &xfs_read_iomap_ops); }
Greg Kroah-Hartman
maintainerPATCH 255/280 selftests/bpf: fix bpf_map_redirect call for cpu map test
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexis Lothoré (eBPF Foundation) <[email protected]>
commit ac8d16b2d3772934f4cba44cb01bad05b4b2864c upstream.
xdp_redir_prog currently redirects packets based on the entry at index 1 in cpu_map, but the corresponding test only manipulates the entry at index 0. This does not really affect the test in its current form since the program is detached before having the opportunity to execute, but it needs to be fixed before being able improve the corresponding test (ie, not only test attach/detach but also the redirect feature)
Fix this XDP program by making it redirect packets based on entry 0 in cpu_map instead of entry 1.
--- tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c +1 -1
@@ -15,7 +15,7 @@ struct { SEC("xdp")int xdp_redir_prog (struct xdp_md *ctx) { -return bpf_redirect_map (&cpu_map,1 ,0 ); +return bpf_redirect_map (&cpu_map,0 ,0 ); }SEC ("xdp" )
Greg Kroah-Hartman
maintainerPATCH 256/280 selftests/bpf: make xdp_cpumap_attach keep redirect prog attached
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexis Lothoré (eBPF Foundation) <[email protected]>
commit d5fbcf46ee82574aee443423f3e4132d1154372b upstream.
Current test only checks attach/detach on cpu map type program, and so does not check that it can be properly executed, neither that it redirects correctly.
Update the existing test to extend its coverage:
- keep the redirected program loaded
- try to execute it through bpf_prog_test_run_opts with some dummy context
While at it, bring the following minor improvements:
- isolate test interface in its own namespace
Stable-dep-of: c7f2188d68c1 ("selftests/bpf: Adjust data size to have ETH_HLEN")
--- tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c | 41 ++++++++++--- 1 file changed, 33 insertions(+), 8 deletions(-)
tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c +33 -8
@@ -2,35 +2,41 @@#include <uapi/linux/bpf.h> #include <linux/if_link.h> #include <test_progs.h> +#include <network_helpers.h> #include "test_xdp_with_cpumap_frags_helpers.skel.h" #include "test_xdp_with_cpumap_helpers.skel.h" #define IFINDEX_LO 1 +#define TEST_NS "cpu_attach_ns"static void test_xdp_with_cpumap_helpers (void ) { -struct test_xdp_with_cpumap_helpers *skel; +struct test_xdp_with_cpumap_helpers *skel =NULL ;struct bpf_prog_info info = {};__u32 len =sizeof (info);struct bpf_cpumap_val val = { .qsize =192 , }; -int err, prog_fd, map_fd; +int err, prog_fd, prog_redir_fd, map_fd; +struct nstoken *nstoken =NULL ;__u32 idx =0 ; +SYS (out_close,"ip netns add %s" ,TEST_NS ); + nstoken =open_netns (TEST_NS ); +if (!ASSERT_OK_PTR (nstoken,"open_netns" )) + goto out_close; +SYS (out_close,"ip link set dev lo up" ); + skel =test_xdp_with_cpumap_helpers__open_and_load ();if (!ASSERT_OK_PTR (skel,"test_xdp_with_cpumap_helpers__open_and_load" ))return ; - prog_fd =bpf_program__fd (skel->progs.xdp_redir_prog); - err =bpf_xdp_attach (IFINDEX_LO , prog_fd,XDP_FLAGS_SKB_MODE ,NULL ); + prog_redir_fd =bpf_program__fd (skel->progs.xdp_redir_prog); + err =bpf_xdp_attach (IFINDEX_LO , prog_redir_fd,XDP_FLAGS_SKB_MODE ,NULL );if (!ASSERT_OK (err,"Generic attach of program with 8-byte CPUMAP" )) goto out_close; - err =bpf_xdp_detach (IFINDEX_LO ,XDP_FLAGS_SKB_MODE ,NULL ); -ASSERT_OK (err,"XDP program detach" ); - prog_fd =bpf_program__fd (skel->progs.xdp_dummy_cm); map_fd =bpf_map__fd (skel->maps.cpu_map); err =bpf_prog_get_info_by_fd (prog_fd, &info, &len);
@@ -45,6 +51,23 @@ static void test_xdp_with_cpumap_helpersASSERT_OK (err,"Read cpumap entry" );ASSERT_EQ (info.id, val.bpf_prog.id,"Match program id to cpumap entry prog_id" ); +/* send a packet to trigger any potential bugs in there */ +char data[10 ] = {}; +DECLARE_LIBBPF_OPTS (bpf_test_run_opts, opts, + .data_in = &data, + .data_size_in = 10, + .flags = BPF_F_TEST_XDP_LIVE_FRAMES, + .repeat = 1, + ); + err =bpf_prog_test_run_opts (prog_redir_fd, &opts); +ASSERT_OK (err,"XDP test run" ); + +/* wait for the packets to be flushed */ +kern_sync_rcu (); + + err =bpf_xdp_detach (IFINDEX_LO ,XDP_FLAGS_SKB_MODE ,NULL ); +ASSERT_OK (err,"XDP program detach" ); +/* can not attach BPF_XDP_CPUMAP program to a device */ err =bpf_xdp_attach (IFINDEX_LO , prog_fd,XDP_FLAGS_SKB_MODE ,NULL );if (!ASSERT_NEQ (err,0 ,"Attach of BPF_XDP_CPUMAP program" ))
@@ -65,6 +88,8 @@ static void test_xdp_with_cpumap_helpersASSERT_NEQ (err,0 ,"Add BPF_XDP program with frags to cpumap entry" ); out_close: +close_netns (nstoken); +SYS_NOFAIL ("ip netns del %s" ,TEST_NS );test_xdp_with_cpumap_helpers__destroy (skel); }
@@ -111,7 +136,7 @@ out_close:test_xdp_with_cpumap_frags_helpers__destroy (skel); } -void serial_test_xdp_cpumap_attach (void ) +void test_xdp_cpumap_attach (void ) {if (test__start_subtest ("CPUMAP with programs in entries" ))test_xdp_with_cpumap_helpers ();
Greg Kroah-Hartman
maintainerPATCH 257/280 selftests/bpf: check program redirect in xdp_cpumap_attach
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexis Lothoré (eBPF Foundation) <[email protected]>
commit d124d984c8a2d677e1cea6740a01ccdd0371a38d upstream.
xdp_cpumap_attach, in its current form, only checks that an xdp cpumap program can be executed, but not that it performs correctly the cpu redirect as configured by userspace (bpf_prog_test_run_opts will return success even if the redirect program returns an error)
Add a check to ensure that the program performs the configured redirect as well. The check is based on a global variable incremented by a chained program executed only if the redirect program properly executes.
--- tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c | 5 ++++- tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c +4 -1
@@ -62,8 +62,11 @@ static void test_xdp_with_cpumap_helpers err =bpf_prog_test_run_opts (prog_redir_fd, &opts);ASSERT_OK (err,"XDP test run" ); -/* wait for the packets to be flushed */ +/* wait for the packets to be flushed, then check that redirect has been +* performed +*/ kern_sync_rcu (); +ASSERT_NEQ (skel->bss->redirect_count,0 ,"redirected packets" ); err =bpf_xdp_detach (IFINDEX_LO ,XDP_FLAGS_SKB_MODE ,NULL );ASSERT_OK (err,"XDP program detach" );
tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c +5 -0
@@ -12,6 +12,8 @@ struct {__uint (max_entries,4 ); } cpu_map SEC(".maps"); +__u32 redirect_count =0 ; + SEC("xdp")int xdp_redir_prog (struct xdp_md *ctx) {
@@ -27,6 +29,9 @@ int xdp_dummy_prog(struct xdp_md *ctx) SEC("xdp/cpumap")int xdp_dummy_cm (struct xdp_md *ctx) { +if (bpf_get_smp_processor_id () ==0 ) + redirect_count++; +if (ctx->ingress_ifindex ==IFINDEX_LO )return XDP_DROP ;
Greg Kroah-Hartman
maintainerPATCH 258/280 selftests/bpf: Adjust data size to have ETH_HLEN
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shigeru Yoshida <[email protected]>
commit c7f2188d68c114095660a950b7e880a1e5a71c8f upstream.
The function bpf_test_init() now returns an error if user_size (.data_size_in) is less than ETH_HLEN, causing the tests to fail. Adjust the data size to ensure it meets the requirement of ETH_HLEN.
--- tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c | 4 ++-- tools/testing/selftests/bpf/prog_tests/xdp_devmap_attach.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c +2 -2
@@ -52,10 +52,10 @@ static void test_xdp_with_cpumap_helpersASSERT_EQ (info.id, val.bpf_prog.id,"Match program id to cpumap entry prog_id" );/* send a packet to trigger any potential bugs in there */ -char data[10 ] = {}; +char data[ETH_HLEN ] = {};DECLARE_LIBBPF_OPTS (bpf_test_run_opts, opts, .data_in = &data, - .data_size_in = 10, + .data_size_in = sizeof(data), .flags = BPF_F_TEST_XDP_LIVE_FRAMES, .repeat = 1, );
tools/testing/selftests/bpf/prog_tests/xdp_devmap_attach.c +4 -4
@@ -23,7 +23,7 @@ static void test_xdp_with_devmap_helpers__u32 len =sizeof (info);int err, dm_fd, dm_fd_redir, map_fd;struct nstoken *nstoken =NULL ; -char data[10 ] = {}; +char data[ETH_HLEN ] = {};__u32 idx =0 ;SYS (out_close,"ip netns add %s" ,TEST_NS );
@@ -58,7 +58,7 @@ static void test_xdp_with_devmap_helpers/* send a packet to trigger any potential bugs in there */ DECLARE_LIBBPF_OPTS (bpf_test_run_opts, opts, .data_in = &data, - .data_size_in = 10, + .data_size_in = sizeof(data), .flags = BPF_F_TEST_XDP_LIVE_FRAMES, .repeat = 1, );
@@ -158,7 +158,7 @@ static void test_xdp_with_devmap_helpersstruct nstoken *nstoken =NULL ;__u32 len =sizeof (info);int err, dm_fd, dm_fd_redir, map_fd, ifindex_dst; -char data[10 ] = {}; +char data[ETH_HLEN ] = {};__u32 idx =0 ;SYS (out_close,"ip netns add %s" ,TEST_NS );
@@ -208,7 +208,7 @@ static void test_xdp_with_devmap_helpers/* send a packet to trigger any potential bugs in there */ DECLARE_LIBBPF_OPTS (bpf_test_run_opts, opts, .data_in = &data, - .data_size_in = 10, + .data_size_in = sizeof(data), .flags = BPF_F_TEST_XDP_LIVE_FRAMES, .repeat = 1, );
Greg Kroah-Hartman
maintainerPATCH 259/280 usb: typec: class: Fix NULL pointer access
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrei Kuchynski <[email protected]>
commit ec27386de23a511008c53aa2f3434ad180a3ca9a upstream.
Concurrent calls to typec_partner_unlink_device can lead to a NULL pointer dereference. This patch adds a mutex to protect USB device pointers and prevent this issue. The same mutex protects both the device pointers and the partner device registration.
--- drivers/usb/typec/class.c | 15 +++++++++++++-- drivers/usb/typec/class.h | 1 + 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/usb/typec/class.c +13 -2
@@ -932,6 +932,7 @@ struct typec_partner *typec_register_par partner->dev.type = &typec_partner_dev_type;dev_set_name (&partner->dev,"%s-partner" ,dev_name (&port->dev)); +mutex_lock (&port->partner_link_lock); ret =device_register (&partner->dev);if (ret) {dev_err (&port->dev,"failed to register partner (%d)\n" , ret);
@@ -943,6 +944,7 @@ struct typec_partner *typec_register_partypec_partner_link_device (partner, port->usb2_dev);if (port->usb3_dev)typec_partner_link_device (partner, port->usb3_dev); +mutex_unlock (&port->partner_link_lock);return partner; }
@@ -963,12 +965,14 @@ void typec_unregister_partner(struct typ port =to_typec_port (partner->dev.parent); +mutex_lock (&port->partner_link_lock);if (port->usb2_dev)typec_partner_unlink_device (partner, port->usb2_dev);if (port->usb3_dev)typec_partner_unlink_device (partner, port->usb3_dev);device_unregister (&partner->dev); +mutex_unlock (&port->partner_link_lock); }EXPORT_SYMBOL_GPL (typec_unregister_partner);
@@ -1862,25 +1866,30 @@ static struct typec_partner *typec_get_pstatic void typec_partner_attach (struct typec_connector *con,struct device *dev) { struct typec_port *port = container_of(con, struct typec_port, con); -struct typec_partner *partner =typec_get_partner (port); +struct typec_partner *partner;struct usb_device *udev =to_usb_device (dev); +mutex_lock (&port->partner_link_lock);if (udev->speed <USB_SPEED_SUPER ) port->usb2_dev = dev;else port->usb3_dev = dev; + partner =typec_get_partner (port);if (partner) {typec_partner_link_device (partner, dev);put_device (&partner->dev); } +mutex_unlock (&port->partner_link_lock); }static void typec_partner_deattach (struct typec_connector *con,struct device *dev) { struct typec_port *port = container_of(con, struct typec_port, con); -struct typec_partner *partner =typec_get_partner (port); +struct typec_partner *partner; +mutex_lock (&port->partner_link_lock); + partner =typec_get_partner (port);if (partner) {typec_partner_unlink_device (partner, dev);put_device (&partner->dev);
@@ -1890,6 +1899,7 @@ static void typec_partner_deattach(struc port->usb2_dev =NULL ; else if (port->usb3_dev == dev) port->usb3_dev = NULL; +mutex_unlock (&port->partner_link_lock); }/**
@@ -2425,6 +2435,7 @@ struct typec_port *typec_register_port(sida_init (&port->mode_ids);mutex_init (&port->port_type_lock); +mutex_init (&port->partner_link_lock); port->id = id; port->ops = cap->ops;
drivers/usb/typec/class.h +1 -0
@@ -56,6 +56,7 @@ struct typec_port {enum typec_pwr_opmode pwr_opmode;enum typec_port_type port_type;struct mutex port_type_lock; +struct mutex partner_link_lock;enum typec_orientation orientation;struct typec_switch *sw;
Greg Kroah-Hartman
maintainerPATCH 260/280 vmxnet3: Fix malformed packet sizing in vmxnet3_process_xdp
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
commit 4c2227656d9003f4d77afc76f34dd81b95e4c2c4 upstream.
vmxnet3 driver's XDP handling is buggy for packet sizes using ring0 (that is, packet sizes between 128 - 3k bytes).
We noticed MTU-related connectivity issues with Cilium's service load- balancing in case of vmxnet3 as NIC underneath. A simple curl to a HTTP backend service where the XDP LB was doing IPIP encap led to overly large packet sizes but only for *some* of the packets (e.g. HTTP GET request) while others (e.g. the prior TCP 3WHS) looked completely fine on the wire.
In fact, the pcap recording on the backend node actually revealed that the node with the XDP LB was leaking uninitialized kernel data onto the wire for the affected packets, for example, while the packets should have been 152 bytes their actual size was 1482 bytes, so the remainder after 152 bytes was padded with whatever other data was in that page at the time (e.g. we saw user/payload data from prior processed packets).
We only noticed this through an MTU issue, e.g. when the XDP LB node and the backend node both had the same MTU (e.g. 1500) then the curl request got dropped on the backend node's NIC given the packet was too large even though the IPIP-encapped packet normally would never even come close to the MTU limit. Lowering the MTU on the XDP LB (e.g. 1480) allowed to let the curl request succeed (which also indicates that the kernel ignored the padding, and thus the issue wasn't very user-visible).
Commit e127ce7699c1 ("vmxnet3: Fix missing reserved tailroom") was too eager to also switch xdp_prepare_buff() from rcd->len to rbi->len. It really needs to stick to rcd->len which is the actual packet length from the descriptor. The latter we also feed into vmxnet3_process_xdp_small(), by the way, and it indicates the correct length needed to initialize the xdp->{data,data_end} parts. For e127ce7699c1 ("vmxnet3: Fix missing reserved tailroom") the relevant part was adapting xdp_init_buff() to address the warning given the xdp_data_hard_end() depends on xdp->frame_sz. With that fixed, traffic on the wire looks good again.
--- drivers/net/vmxnet3/vmxnet3_xdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/vmxnet3/vmxnet3_xdp.c +1 -1
@@ -397,7 +397,7 @@ vmxnet3_process_xdp(struct vmxnet3_adaptxdp_init_buff (&xdp,PAGE_SIZE , &rq->xdp_rxq);xdp_prepare_buff (&xdp,page_address (page), rq->page_pool->p.offset, - rbi->len, false); + rcd->len, false);xdp_buff_clear_frags_flag (&xdp); xdp_prog =rcu_dereference (rq->adapter->xdp_bpf_prog);
Greg Kroah-Hartman
maintainerPATCH 261/280 comedi: jr3_pci: Fix synchronous deletion of timer
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit 44d9b3f584c59a606b521e7274e658d5b866c699 upstream.
When jr3_pci_detach() is called during device removal, it calls timer_delete_sync() to stop the timer, but the timer expiry function always reschedules the timer, so the synchronization is ineffective.
Call timer_shutdown_sync() instead. It does not matter that the timer expiry function pointer is cleared, because the device is being removed.
--- drivers/comedi/drivers/jr3_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/comedi/drivers/jr3_pci.c +1 -1
@@ -758,7 +758,7 @@ static void jr3_pci_detach(struct comedistruct jr3_pci_dev_private *devpriv = dev->private;if (devpriv) -del_timer_sync (&devpriv->timer); +timer_shutdown_sync (&devpriv->timer);comedi_pci_detach (dev); }
Greg Kroah-Hartman
maintainerPATCH 262/280 ext4: goto right label out_mmap_sem in ext4_setattr()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
commit 7e91ae31e2d264155dfd102101afc2de7bd74a64 upstream.
Otherwise, if ext4_inode_attach_jinode() fails, a hung task will happen because filemap_invalidate_unlock() isn't called to unlock mapping->invalidate_lock. Like this:
EXT4-fs error (device sda) in ext4_setattr:5557: Out of memory
INFO: task fsstress:374 blocked for more than 122 seconds.
Not tainted 6.14.0-rc1-next-20250206-xfstests-dirty #726
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:fsstress state:D stack:0 pid:374 tgid:374 ppid:373
task_flags:0x440140 flags:0x00000000
Call Trace:
<TASK>
__schedule+0x2c9/0x7f0
schedule+0x27/0xa0
schedule_preempt_disabled+0x15/0x30
rwsem_down_read_slowpath+0x278/0x4c0
down_read+0x59/0xb0
page_cache_ra_unbounded+0x65/0x1b0
filemap_get_pages+0x124/0x3e0
filemap_read+0x114/0x3d0
vfs_read+0x297/0x360
ksys_read+0x6c/0xe0
do_syscall_64+0x4b/0x110
entry_SYSCALL_64_after_hwframe+0x76/0x7e--- fs/ext4/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/inode.c +1 -1
@@ -5468,7 +5468,7 @@ int ext4_setattr(struct mnt_idmap *idmap oldsize & (inode->i_sb->s_blocksize - 1)) { error =ext4_inode_attach_jinode (inode);if (error) - goto err_out; + goto out_mmap_sem; } handle =ext4_journal_start (inode,EXT4_HT_INODE ,3 );
Greg Kroah-Hartman
maintainerPATCH 263/280 usb: typec: class: Invalidate USB device pointers on partner unregistration
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrei Kuchynski <[email protected]>
commit 66e1a887273c6b89f09bc11a40d0a71d5a081a8e upstream.
To avoid using invalid USB device pointers after a Type-C partner disconnects, this patch clears the pointers upon partner unregistration. This ensures a clean state for future connections.
--- drivers/usb/typec/class.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/usb/typec/class.c +6 -2
@@ -966,10 +966,14 @@ void typec_unregister_partner(struct typ port =to_typec_port (partner->dev.parent);mutex_lock (&port->partner_link_lock); -if (port->usb2_dev) +if (port->usb2_dev) {typec_partner_unlink_device (partner, port->usb2_dev); -if (port->usb3_dev) + port->usb2_dev =NULL ; + } +if (port->usb3_dev) {typec_partner_unlink_device (partner, port->usb3_dev); + port->usb3_dev =NULL ; + }device_unregister (&partner->dev);mutex_unlock (&port->partner_link_lock);
Greg Kroah-Hartman
maintainerPATCH 264/280 Revert "net: dsa: mv88e6xxx: fix internal PHYs for 6320 family"
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Marek Beh�n" <[email protected]>
This reverts commit 2b27df6852444b76724f5d425826a38581d63407.
For stable 6.12 it was misapplied to wrong entries of the mv88e6xxx_table array: instead of the MV88E6320 and MV88E6321 entries it was applied to the MV88E6240 and MV88E6352 entries.
--- drivers/net/dsa/mv88e6xxx/chip.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.c +2 -4
@@ -6182,8 +6182,7 @@ static const struct mv88e6xxx_info mv88e .num_databases = 4096, .num_macs = 8192, .num_ports = 7, - .num_internal_phys = 2, - .internal_phys_offset = 3, + .num_internal_phys = 5, .num_gpio = 15, .max_vid = 4095, .max_sid = 63,
@@ -6377,8 +6376,7 @@ static const struct mv88e6xxx_info mv88e .num_databases = 4096, .num_macs = 8192, .num_ports = 7, - .num_internal_phys = 2, - .internal_phys_offset = 3, + .num_internal_phys = 5, .num_gpio = 15, .max_vid = 4095, .max_sid = 63,
Greg Kroah-Hartman
maintainerPATCH 265/280 net: dsa: mv88e6xxx: fix atu_move_port_mask for 6341 family
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Marek Beh�n" <[email protected]>
commit 4ae01ec007716986e1a20f1285eb013cbf188830 upstream.
The atu_move_port_mask for 6341 family (Topaz) is 0xf, not 0x1f. The PortVec field is 8 bits wide, not 11 as in 6390 family. Fix this.
--- drivers/net/dsa/mv88e6xxx/chip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.c +2 -2
@@ -5852,7 +5852,7 @@ static const struct mv88e6xxx_info mv88e .global1_addr = 0x1b, .global2_addr = 0x1c, .age_time_coeff = 3750, - .atu_move_port_mask = 0x1f, + .atu_move_port_mask = 0xf, .g1_irqs = 9, .g2_irqs = 10, .pvt = true,
@@ -6311,7 +6311,7 @@ static const struct mv88e6xxx_info mv88e .global1_addr = 0x1b, .global2_addr = 0x1c, .age_time_coeff = 3750, - .atu_move_port_mask = 0x1f, + .atu_move_port_mask = 0xf, .g1_irqs = 9, .g2_irqs = 10, .pvt = true,
Greg Kroah-Hartman
maintainerPATCH 266/280 net: dsa: mv88e6xxx: enable PVT for 6321 switch
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Marek Beh�n" <[email protected]>
commit f85c69369854a43af2c5d3b3896da0908d713133 upstream.
Commit f36456522168 ("net: dsa: mv88e6xxx: move PVT description in info") did not enable PVT for 6321 switch. Fix it.
--- drivers/net/dsa/mv88e6xxx/chip.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/dsa/mv88e6xxx/chip.c +1 -0
@@ -6289,6 +6289,7 @@ static const struct mv88e6xxx_info mv88e .g1_irqs = 8, .g2_irqs = 10, .atu_move_port_mask = 0xf, + .pvt = true, .multi_chip = true, .edsa_support = MV88E6XXX_EDSA_SUPPORTED, .ptp_support = true,
Greg Kroah-Hartman
maintainerPATCH 267/280 net: dsa: mv88e6xxx: enable .port_set_policy() for 6320 family
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Marek Beh�n" <[email protected]>
commit a2ef58e2c4aea4de166fc9832eb2b621e88c98d5 upstream.
Commit f3a2cd326e44 ("net: dsa: mv88e6xxx: introduce .port_set_policy") did not add the .port_set_policy() method for the 6320 family. Fix it.
--- drivers/net/dsa/mv88e6xxx/chip.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/dsa/mv88e6xxx/chip.c +2 -0
@@ -5186,6 +5186,7 @@ static const struct mv88e6xxx_ops mv88e6 .port_set_rgmii_delay = mv88e6320_port_set_rgmii_delay, .port_set_speed_duplex = mv88e6185_port_set_speed_duplex, .port_tag_remap = mv88e6095_port_tag_remap, + .port_set_policy = mv88e6352_port_set_policy, .port_set_frame_mode = mv88e6351_port_set_frame_mode, .port_set_ucast_flood = mv88e6352_port_set_ucast_flood, .port_set_mcast_flood = mv88e6352_port_set_mcast_flood,
@@ -5236,6 +5237,7 @@ static const struct mv88e6xxx_ops mv88e6 .port_set_rgmii_delay = mv88e6320_port_set_rgmii_delay, .port_set_speed_duplex = mv88e6185_port_set_speed_duplex, .port_tag_remap = mv88e6095_port_tag_remap, + .port_set_policy = mv88e6352_port_set_policy, .port_set_frame_mode = mv88e6351_port_set_frame_mode, .port_set_ucast_flood = mv88e6352_port_set_ucast_flood, .port_set_mcast_flood = mv88e6352_port_set_mcast_flood,
Greg Kroah-Hartman
maintainerPATCH 268/280 net: dsa: mv88e6xxx: enable STU methods for 6320 family
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Marek Beh�n" <[email protected]>
commit 1428a6109b20e356188c3fb027bdb7998cc2fb98 upstream.
Commit c050f5e91b47 ("net: dsa: mv88e6xxx: Fill in STU support for all supported chips") introduced STU methods, but did not add them to the 6320 family. Fix it.
--- drivers/net/dsa/mv88e6xxx/chip.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/dsa/mv88e6xxx/chip.c +6 -0
@@ -5213,6 +5213,8 @@ static const struct mv88e6xxx_ops mv88e6 .reset = mv88e6352_g1_reset, .vtu_getnext = mv88e6352_g1_vtu_getnext, .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, + .stu_getnext = mv88e6352_g1_stu_getnext, + .stu_loadpurge = mv88e6352_g1_stu_loadpurge, .gpio_ops = &mv88e6352_gpio_ops, .avb_ops = &mv88e6352_avb_ops, .ptp_ops = &mv88e6352_ptp_ops,
@@ -5263,6 +5265,8 @@ static const struct mv88e6xxx_ops mv88e6 .reset = mv88e6352_g1_reset, .vtu_getnext = mv88e6352_g1_vtu_getnext, .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, + .stu_getnext = mv88e6352_g1_stu_getnext, + .stu_loadpurge = mv88e6352_g1_stu_loadpurge, .gpio_ops = &mv88e6352_gpio_ops, .avb_ops = &mv88e6352_avb_ops, .ptp_ops = &mv88e6352_ptp_ops,
@@ -6258,6 +6262,7 @@ static const struct mv88e6xxx_info mv88e .num_internal_phys = 5, .num_gpio = 15, .max_vid = 4095, + .max_sid = 63, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b,
@@ -6283,6 +6288,7 @@ static const struct mv88e6xxx_info mv88e .num_internal_phys = 5, .num_gpio = 15, .max_vid = 4095, + .max_sid = 63, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b,
Greg Kroah-Hartman
maintainerPATCH 269/280 iommu: Handle race with default domain setup
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robin Murphy <[email protected]>
commit b46064a18810bad3aea089a79993ca5ea7a3d2b2 upstream.
It turns out that deferred default domain creation leaves a subtle race window during iommu_device_register() wherein a client driver may asynchronously probe in parallel and get as far as performing DMA API operations with dma-direct, only to be switched to iommu-dma underfoot once the default domain attachment finally happens, with obviously disastrous consequences. Even the wonky of_iommu_configure() path is at risk, since iommu_fwspec_init() will no longer defer client probe as the instance ops are (necessarily) already registered, and the "replay" iommu_probe_device() call can see dev->iommu_group already set and so think there's nothing to do either.
Fortunately we already have the right tool in the right place in the form of iommu_device_use_default_domain(), which just needs to ensure that said default domain is actually ready to *be* used. Deferring the client probe shouldn't have too much impact, given that this only happens while the IOMMU driver is probing, and thus due to kick the deferred probe list again once it finishes.
--- drivers/iommu/iommu.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/iommu/iommu.c +5 -0
@@ -3115,6 +3115,11 @@ int iommu_device_use_default_domain(strureturn 0 ;mutex_lock (&group->mutex); +/* We may race against bus_iommu_probe() finalising groups here */ +if (!group->default_domain) { + ret = -EPROBE_DEFER ; + goto unlock_out; + }if (group->owner_cnt) {if (group->domain != group->default_domain || group->owner || !xa_empty (&group->pasid_array)) {
Greg Kroah-Hartman
maintainerPATCH 270/280 crypto: lib/Kconfig - Hide arch options from user
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
commit 17ec3e71ba797cdb62164fea9532c81b60f47167 upstream.
The ARCH_MAY_HAVE patch missed arm64, mips and s390. But it may also lead to arch options being enabled but ineffective because of modular/built-in conflicts.
As the primary user of all these options wireguard is selecting the arch options anyway, make the same selections at the lib/crypto option level and hide the arch options from the user.
Instead of selecting them centrally from lib/crypto, simply set the default of each arch option as suggested by Eric Biggers.
Change the Crypto API generic algorithms to select the top-level lib/crypto options instead of the generic one as otherwise there is no way to enable the arch options (Eric Biggers). Introduce a set of INTERNAL options to work around dependency cycles on the CONFIG_CRYPTO symbol.
--- arch/arm/crypto/Kconfig | 16 ++++++++++------ arch/arm64/crypto/Kconfig | 6 ++++-- arch/mips/crypto/Kconfig | 7 +++++-- arch/powerpc/crypto/Kconfig | 11 +++++++---- arch/riscv/crypto/Kconfig | 1 - arch/s390/crypto/Kconfig | 3 ++- arch/x86/crypto/Kconfig | 17 +++++++++++------ crypto/Kconfig | 6 +++--- lib/crypto/Kconfig | 41 +++++++++++++++++++++-------------------- 9 files changed, 63 insertions(+), 45 deletions(-)
arch/arm/crypto/Kconfig +10 -6
@@ -3,10 +3,12 @@ menu "Accelerated Cryptographic Algorithms for CPU (arm)" config CRYPTO_CURVE25519_NEON - tristate "Public key crypto: Curve25519 (NEON)" + tristate depends on KERNEL_MODE_NEON + select CRYPTO_KPP select CRYPTO_LIB_CURVE25519_GENERIC - select CRYPTO_ARCH_MAY_HAVE_LIB_CURVE25519 + select CRYPTO_ARCH_HAVE_LIB_CURVE25519 + default CRYPTO_LIB_CURVE25519_INTERNAL help Curve25519 algorithm
@@ -45,9 +47,10 @@ config CRYPTO_NHPOLY1305_NEON - NEON (Advanced SIMD) extensions config CRYPTO_POLY1305_ARM - tristate "Hash functions: Poly1305 (NEON)" + tristate select CRYPTO_HASH - select CRYPTO_ARCH_MAY_HAVE_LIB_POLY1305 + select CRYPTO_ARCH_HAVE_LIB_POLY1305 + default CRYPTO_LIB_POLY1305_INTERNAL help Poly1305 authenticator algorithm (RFC7539)
@@ -212,9 +215,10 @@ config CRYPTO_AES_ARM_CE - ARMv8 Crypto Extensions config CRYPTO_CHACHA20_NEON - tristate "Ciphers: ChaCha20, XChaCha20, XChaCha12 (NEON)" + tristate select CRYPTO_SKCIPHER - select CRYPTO_ARCH_MAY_HAVE_LIB_CHACHA + select CRYPTO_ARCH_HAVE_LIB_CHACHA + default CRYPTO_LIB_CHACHA_INTERNAL help Length-preserving ciphers: ChaCha20, XChaCha20, and XChaCha12 stream cipher algorithms
arch/arm64/crypto/Kconfig +4 -2
@@ -26,10 +26,11 @@ config CRYPTO_NHPOLY1305_NEON - NEON (Advanced SIMD) extensions config CRYPTO_POLY1305_NEON - tristate "Hash functions: Poly1305 (NEON)" + tristate depends on KERNEL_MODE_NEON select CRYPTO_HASH select CRYPTO_ARCH_HAVE_LIB_POLY1305 + default CRYPTO_LIB_POLY1305_INTERNAL help Poly1305 authenticator algorithm (RFC7539)
@@ -186,11 +187,12 @@ config CRYPTO_AES_ARM64_NEON_BLK - NEON (Advanced SIMD) extensions config CRYPTO_CHACHA20_NEON - tristate "Ciphers: ChaCha (NEON)" + tristate depends on KERNEL_MODE_NEON select CRYPTO_SKCIPHER select CRYPTO_LIB_CHACHA_GENERIC select CRYPTO_ARCH_HAVE_LIB_CHACHA + default CRYPTO_LIB_CHACHA_INTERNAL help Length-preserving ciphers: ChaCha20, XChaCha20, and XChaCha12 stream cipher algorithms
arch/mips/crypto/Kconfig +5 -2
@@ -12,9 +12,11 @@ config CRYPTO_CRC32_MIPS Architecture: mips config CRYPTO_POLY1305_MIPS - tristate "Hash functions: Poly1305" + tristate depends on MIPS + select CRYPTO_HASH select CRYPTO_ARCH_HAVE_LIB_POLY1305 + default CRYPTO_LIB_POLY1305_INTERNAL help Poly1305 authenticator algorithm (RFC7539)
@@ -61,10 +63,11 @@ config CRYPTO_SHA512_OCTEON Architecture: mips OCTEON using crypto instructions, when available config CRYPTO_CHACHA_MIPS - tristate "Ciphers: ChaCha20, XChaCha20, XChaCha12 (MIPS32r2)" + tristate depends on CPU_MIPS32_R2 select CRYPTO_SKCIPHER select CRYPTO_ARCH_HAVE_LIB_CHACHA + default CRYPTO_LIB_CHACHA_INTERNAL help Length-preserving ciphers: ChaCha20, XChaCha20, and XChaCha12 stream cipher algorithms
arch/powerpc/crypto/Kconfig +7 -4
@@ -3,10 +3,12 @@ menu "Accelerated Cryptographic Algorithms for CPU (powerpc)" config CRYPTO_CURVE25519_PPC64 - tristate "Public key crypto: Curve25519 (PowerPC64)" + tristate depends on PPC64 && CPU_LITTLE_ENDIAN + select CRYPTO_KPP select CRYPTO_LIB_CURVE25519_GENERIC - select CRYPTO_ARCH_MAY_HAVE_LIB_CURVE25519 + select CRYPTO_ARCH_HAVE_LIB_CURVE25519 + default CRYPTO_LIB_CURVE25519_INTERNAL help Curve25519 algorithm
@@ -124,11 +126,12 @@ config CRYPTO_AES_GCM_P10 later CPU. This module supports stitched acceleration for AES/GCM. config CRYPTO_CHACHA20_P10 - tristate "Ciphers: ChaCha20, XChacha20, XChacha12 (P10 or later)" + tristate depends on PPC64 && CPU_LITTLE_ENDIAN && VSX select CRYPTO_SKCIPHER select CRYPTO_LIB_CHACHA_GENERIC - select CRYPTO_ARCH_MAY_HAVE_LIB_CHACHA + select CRYPTO_ARCH_HAVE_LIB_CHACHA + default CRYPTO_LIB_CHACHA_INTERNAL help Length-preserving ciphers: ChaCha20, XChaCha20, and XChaCha12 stream cipher algorithms
arch/riscv/crypto/Kconfig +0 -1
@@ -22,7 +22,6 @@ config CRYPTO_CHACHA_RISCV64 tristate "Ciphers: ChaCha" depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO select CRYPTO_SKCIPHER - select CRYPTO_LIB_CHACHA_GENERIC help Length-preserving ciphers: ChaCha20 stream cipher algorithm
arch/s390/crypto/Kconfig +2 -1
@@ -120,11 +120,12 @@ config CRYPTO_DES_S390 As of z196 the CTR mode is hardware accelerated. config CRYPTO_CHACHA_S390 - tristate "Ciphers: ChaCha20" + tristate depends on S390 select CRYPTO_SKCIPHER select CRYPTO_LIB_CHACHA_GENERIC select CRYPTO_ARCH_HAVE_LIB_CHACHA + default CRYPTO_LIB_CHACHA_INTERNAL help Length-preserving cipher: ChaCha20 stream cipher (RFC 7539)
arch/x86/crypto/Kconfig +11 -6
@@ -3,10 +3,12 @@ menu "Accelerated Cryptographic Algorithms for CPU (x86)" config CRYPTO_CURVE25519_X86 - tristate "Public key crypto: Curve25519 (ADX)" + tristate depends on X86 && 64BIT + select CRYPTO_KPP select CRYPTO_LIB_CURVE25519_GENERIC - select CRYPTO_ARCH_MAY_HAVE_LIB_CURVE25519 + select CRYPTO_ARCH_HAVE_LIB_CURVE25519 + default CRYPTO_LIB_CURVE25519_INTERNAL help Curve25519 algorithm
@@ -348,11 +350,12 @@ config CRYPTO_ARIA_GFNI_AVX512_X86_64 Processes 64 blocks in parallel. config CRYPTO_CHACHA20_X86_64 - tristate "Ciphers: ChaCha20, XChaCha20, XChaCha12 (SSSE3/AVX2/AVX-512VL)" + tristate depends on X86 && 64BIT select CRYPTO_SKCIPHER select CRYPTO_LIB_CHACHA_GENERIC - select CRYPTO_ARCH_MAY_HAVE_LIB_CHACHA + select CRYPTO_ARCH_HAVE_LIB_CHACHA + default CRYPTO_LIB_CHACHA_INTERNAL help Length-preserving ciphers: ChaCha20, XChaCha20, and XChaCha12 stream cipher algorithms
@@ -417,10 +420,12 @@ config CRYPTO_POLYVAL_CLMUL_NI - CLMUL-NI (carry-less multiplication new instructions) config CRYPTO_POLY1305_X86_64 - tristate "Hash functions: Poly1305 (SSE2/AVX2)" + tristate depends on X86 && 64BIT + select CRYPTO_HASH select CRYPTO_LIB_POLY1305_GENERIC - select CRYPTO_ARCH_MAY_HAVE_LIB_POLY1305 + select CRYPTO_ARCH_HAVE_LIB_POLY1305 + default CRYPTO_LIB_POLY1305_INTERNAL help Poly1305 authenticator algorithm (RFC7539)
crypto/Kconfig +3 -3
@@ -316,7 +316,7 @@ config CRYPTO_ECRDSA config CRYPTO_CURVE25519 tristate "Curve25519" select CRYPTO_KPP - select CRYPTO_LIB_CURVE25519_GENERIC + select CRYPTO_LIB_CURVE25519_INTERNAL help Curve25519 elliptic curve (RFC7748)
@@ -614,7 +614,7 @@ config CRYPTO_ARC4 config CRYPTO_CHACHA20 tristate "ChaCha" - select CRYPTO_LIB_CHACHA_GENERIC + select CRYPTO_LIB_CHACHA_INTERNAL select CRYPTO_SKCIPHER help The ChaCha20, XChaCha20, and XChaCha12 stream cipher algorithms
@@ -943,7 +943,7 @@ config CRYPTO_POLYVAL config CRYPTO_POLY1305 tristate "Poly1305" select CRYPTO_HASH - select CRYPTO_LIB_POLY1305_GENERIC + select CRYPTO_LIB_POLY1305_INTERNAL help Poly1305 authenticator algorithm (RFC7539)
lib/crypto/Kconfig +21 -20
93 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 271/280 media: i2c: imx214: Fix uninitialized variable in imx214_set_ctrl()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 38985a25682c66d1a7599b0e95ceeb9c7ba89f84 upstream.
You can't pass uninitialized "ret" variables to cci_write(). It has to start as zero.
--- drivers/media/i2c/imx214.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/imx214.c +1 -1
@@ -840,7 +840,7 @@ static int imx214_s_stream(struct v4l2_s {struct imx214 *imx214 =to_imx214 (subdev);struct v4l2_subdev_state *state; -int ret; +int ret =0 ;if (enable) { ret =pm_runtime_resume_and_get (imx214->dev);
Greg Kroah-Hartman
maintainerPATCH 272/280 MIPS: cm: Fix warning if MIPS_CM is disabled
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Bogendoerfer <[email protected]>
commit b73c3ccdca95c237750c981054997c71d33e09d7 upstream.
Commit e27fbe16af5c ("MIPS: cm: Detect CM quirks from device tree") introduced
arch/mips/include/asm/mips-cm.h:119:13: error: ‘mips_cm_update_property’
defined but not used [-Werror=unused-function]
Fix this by making empty function implementation inline
--- arch/mips/include/asm/mips-cm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/mips-cm.h +1 -1
@@ -116,7 +116,7 @@ static inline bool mips_cm_present(void)#ifdef CONFIG_MIPS_CM extern void mips_cm_update_property (void );#else -static void mips_cm_update_property (void ) {} +static inline void mips_cm_update_property (void ) {}#endif /**
Greg Kroah-Hartman
maintainerPATCH 273/280 nvme: fixup scan failure for non-ANA multipath controllers
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Reinecke <[email protected]>
commit 26d7fb4fd4ca1180e2fa96587dea544563b4962a upstream.
Commit 62baf70c3274 caused the ANA log page to be re-read, even on controllers that do not support ANA. While this should generally harmless, some controllers hang on the unsupported log page and never finish probing.
--- drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
@@ -4278,7 +4278,7 @@ static void nvme_scan_work(struct work_sif (test_bit (NVME_AER_NOTICE_NS_CHANGED , &ctrl->events))nvme_queue_scan (ctrl);#ifdef CONFIG_NVME_MULTIPATH - else + else if (ctrl->ana_log_buf) /* Re-read the ANA log page to not miss updates */ queue_work(nvme_wq, &ctrl->ana_work);#endif
Greg Kroah-Hartman
maintainerPATCH 274/280 usb: xhci: Fix Short Packet handling rework ignoring errors
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pecio <[email protected]>
commit 9e3a28793d2fde7a709e814d2504652eaba6ae98 upstream.
A Short Packet event before the last TRB of a TD is followed by another event on the final TRB on spec-compliant HCs, which is most of them.
A 'last_td_was_short' flag was added to know if a TD has just completed as Short Packet and another event is to come. The flag was cleared after seeing the event (unless no TDs are pending, but that's a separate bug) or seeing a new TD complete as something other than Short Packet.
A rework replaced the flag with an 'old_trb_comp_code' variable. When an event doesn't match the pending TD and the previous event was Short Packet, the new event is silently ignored.
To preserve old behavior, 'old_trb_comp_code' should be cleared at this point, but instead it is being set to current comp code, which is often Short Packet again. This can cause more events to be silently ignored, even though they are no longer connected with the old TD that completed short and indicate a serious problem with the driver or the xHC.
Common device classes like UAC in async mode, UVC, serial or the UAS status pipe complete as Short Packet routinely and could be affected.
Clear 'old_trb_comp_code' to zero, which is an invalid completion code and the same value the variable starts with. This restores original behavior on Short Packet and also works for illegal Etron events, which the code has been extended to cover too.
--- drivers/usb/host/xhci-ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-ring.c +1 -1
@@ -2927,7 +2927,7 @@ static int handle_tx_event(struct xhci_hif (xhci_spurious_success_tx_event (xhci, ep_ring)) {xhci_dbg (xhci,"Spurious event dma %pad, comp_code %u after %u\n" , &ep_trb_dma, trb_comp_code, ep_ring->old_trb_comp_code); - ep_ring->old_trb_comp_code = trb_comp_code; + ep_ring->old_trb_comp_code =0 ;return 0 ; }