wifi: ath9k: use unsigned long for activity check timestamp
Subsystems (17)
Sasha Levin
maintainerPATCH 1/54 wifi: ath9k: use unsigned long for activity check timestamp
From: Dmitry Antipov <[email protected]>
[ Upstream commit 8fe64b0fedcb7348080529c46c71ae23f60c9d3e ]
Since 'rx_active_check_time' of 'struct ath_softc' is in jiffies, prefer 'unsigned long' over 'u32' to avoid possible truncation in 'ath_hw_rx_inactive_check()'. Found with clang's -Wshorten-64-to-32, compile tested only.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -1
@@ -1018,7 +1018,7 @@ struct ath_softc {u8 gtt_cnt;u32 intrstatus; -u32 rx_active_check_time; +unsigned long rx_active_check_time;u32 rx_active_count;u16 ps_flags;/* PS_* */ bool ps_enabled;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 2/54 wifi: ath11k: Fix DMA buffer allocation to resolve SWIOTLB issues
From: P Praneesh <[email protected]>
[ Upstream commit 1bcd20981834928ccc5d981aacb806bb523d8b29 ]
Currently, the driver allocates cacheable DMA buffers for rings like HAL_REO_DST and HAL_WBM2SW_RELEASE. The buffers for HAL_WBM2SW_RELEASE are large (1024 KiB), exceeding the SWIOTLB slot size of 256 KiB. This leads to "swiotlb buffer is full" error messages on systems without an IOMMU that use SWIOTLB, causing driver initialization failures. The driver calls dma_map_single() with these large buffers obtained from kzalloc(), resulting in ring initialization errors on systems without an IOMMU that use SWIOTLB.
To address these issues, replace the flawed buffer allocation mechanism with the appropriate DMA API. Specifically, use dma_alloc_noncoherent() for cacheable DMA buffers, ensuring proper freeing of buffers with dma_free_noncoherent().
Error log:
[ 10.194343] ath11k_pci 0000:04:00.0: swiotlb buffer is full (sz:1048583 bytes), total 32768 (slots), used 2529 (slots) [ 10.194406] ath11k_pci 0000:04:00.0: failed to set up tcl_comp ring (0) :-12 [ 10.194781] ath11k_pci 0000:04:00.0: failed to init DP: -12
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3
--- drivers/net/wireless/ath/ath11k/dp.c | 35 +++++++++------------------- 1 file changed, 11 insertions(+), 24 deletions(-)
drivers/net/wireless/ath/ath11k/dp.c +11 -24
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <crypto/hash.h>
@@ -104,14 +104,12 @@ void ath11k_dp_srng_cleanup(struct ath11k_base *ab, struct dp_srng *ring)if (!ring->vaddr_unaligned)return ; -if (ring->cached) { -dma_unmap_single (ab->dev, ring->paddr_unaligned, ring->size, -DMA_FROM_DEVICE ); -kfree (ring->vaddr_unaligned); - }else { +if (ring->cached) +dma_free_noncoherent (ab->dev, ring->size, ring->vaddr_unaligned, + ring->paddr_unaligned,DMA_FROM_DEVICE ); +else dma_free_coherent (ab->dev, ring->size, ring->vaddr_unaligned, ring->paddr_unaligned); - } ring->vaddr_unaligned =NULL ; }
@@ -249,25 +247,14 @@ int ath11k_dp_srng_setup(struct ath11k_base *ab, struct dp_srng *ring,default : cached = false; } - -if (cached) { - ring->vaddr_unaligned =kzalloc (ring->size,GFP_KERNEL ); -if (!ring->vaddr_unaligned) -return -ENOMEM ; - - ring->paddr_unaligned =dma_map_single (ab->dev, - ring->vaddr_unaligned, - ring->size, -DMA_FROM_DEVICE ); -if (dma_mapping_error (ab->dev, ring->paddr_unaligned)) { -kfree (ring->vaddr_unaligned); - ring->vaddr_unaligned =NULL ; -return -ENOMEM ; - } - } } -if (!cached) +if (cached) + ring->vaddr_unaligned =dma_alloc_noncoherent (ab->dev, ring->size, + &ring->paddr_unaligned, +DMA_FROM_DEVICE , +GFP_KERNEL ); +else ring->vaddr_unaligned =dma_alloc_coherent (ab->dev, ring->size, &ring->paddr_unaligned,GFP_KERNEL );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 3/54 wifi: ath11k: fix memory leak in ath11k_xxx_remove()
In reply to Sasha LevinFrom: Miaoqing Pan <[email protected]>
[ Upstream commit efb24b1f0d29537714dd3cc46fb335ac27855251 ]
The firmware memory was allocated in ath11k_pci_probe() or ath11k_ahb_probe(), but not freed in ath11k_xxx_remove() in case ATH11K_FLAG_QMI_FAIL bit is set. So call ath11k_fw_destroy() to free the memory.
Found while fixing the same problem in ath12k:
https://lore.kernel.org/linux-wireless/[email protected]
Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-04546-QCAHSPSWPL_V1_V2_SILICONZ_IOE-1
--- drivers/net/wireless/ath/ath11k/ahb.c | 4 +++- drivers/net/wireless/ath/ath11k/core.c | 3 +-- drivers/net/wireless/ath/ath11k/fw.c | 3 ++- drivers/net/wireless/ath/ath11k/pci.c | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath11k/ahb.c +3 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2022-2025 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/module.h>
@@ -1290,6 +1290,7 @@ static void ath11k_ahb_remove(struct platform_device *pdev)ath11k_core_deinit (ab); qmi_fail: +ath11k_fw_destroy (ab);ath11k_ahb_free_resources (ab); }
@@ -1309,6 +1310,7 @@ static void ath11k_ahb_shutdown(struct platform_device *pdev)ath11k_core_deinit (ab); free_resources: +ath11k_fw_destroy (ab);ath11k_ahb_free_resources (ab); }
drivers/net/wireless/ath/ath11k/core.c +1 -2
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/module.h>
@@ -2346,7 +2346,6 @@ void ath11k_core_deinit(struct ath11k_base *ab)ath11k_hif_power_down (ab);ath11k_mac_destroy (ab);ath11k_core_soc_destroy (ab); -ath11k_fw_destroy (ab); }EXPORT_SYMBOL (ath11k_core_deinit);
drivers/net/wireless/ath/ath11k/fw.c +2 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* -* Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2022-2025 Qualcomm Innovation Center, Inc. All rights reserved. */ #include "core.h"
@@ -166,3 +166,4 @@ void ath11k_fw_destroy(struct ath11k_base *ab) {release_firmware (ab->fw.fw); } +EXPORT_SYMBOL (ath11k_fw_destroy);
drivers/net/wireless/ath/ath11k/pci.c +2 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/module.h>
@@ -984,6 +984,7 @@ static void ath11k_pci_remove(struct pci_dev *pdev)ath11k_core_deinit (ab); qmi_fail: +ath11k_fw_destroy (ab);ath11k_mhi_unregister (ab_pci);ath11k_pcic_free_irq (ab);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 4/54 wifi: ath12k: fix memory leak in ath12k_pci_remove()
In reply to Sasha LevinFrom: Miaoqing Pan <[email protected]>
[ Upstream commit 1b24394ed5c8a8d8f7b9e3aa9044c31495d46f2e ]
Kmemleak reported this error:
unreferenced object 0xffff1c165cec3060 (size 32):
comm "insmod", pid 560, jiffies 4296964570 (age 235.596s)
backtrace:
[<000000005434db68>] __kmem_cache_alloc_node+0x1f4/0x2c0
[<000000001203b155>] kmalloc_trace+0x40/0x88
[<0000000028adc9c8>] _request_firmware+0xb8/0x608
[<00000000cad1aef7>] firmware_request_nowarn+0x50/0x80
[<000000005011a682>] local_pci_probe+0x48/0xd0
[<00000000077cd295>] pci_device_probe+0xb4/0x200
[<0000000087184c94>] really_probe+0x150/0x2c0The firmware memory was allocated in ath12k_pci_probe(), but not freed in ath12k_pci_remove() in case ATH12K_FLAG_QMI_FAIL bit is set. So call ath12k_fw_unmap() to free the memory.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.2.0-02280-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath12k/pci.c +1 -1
@@ -1734,9 +1734,9 @@ static void ath12k_pci_remove(struct pci_dev *pdev)cancel_work_sync (&ab->reset_work);cancel_work_sync (&ab->dump_work);ath12k_core_deinit (ab); -ath12k_fw_unmap (ab); qmi_fail: +ath12k_fw_unmap (ab);ath12k_mhi_unregister (ab_pci);ath12k_pci_free_irq (ab);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 5/54 wifi: ath12k: Fix invalid entry fetch in ath12k_dp_mon_srng_process
In reply to Sasha LevinFrom: P Praneesh <[email protected]>
[ Upstream commit 63fdc4509bcf483e79548de6bc08bf3c8e504bb3 ]
Currently, ath12k_dp_mon_srng_process uses ath12k_hal_srng_src_get_next_entry to fetch the next entry from the destination ring. This is incorrect because ath12k_hal_srng_src_get_next_entry is intended for source rings, not destination rings. This leads to invalid entry fetches, causing potential data corruption or crashes due to accessing incorrect memory locations. This happens because the source ring and destination ring have different handling mechanisms and using the wrong function results in incorrect pointer arithmetic and ring management.
To fix this issue, replace the call to ath12k_hal_srng_src_get_next_entry with ath12k_hal_srng_dst_get_next_entry in ath12k_dp_mon_srng_process. This ensures that the correct function is used for fetching entries from the destination ring, preventing invalid memory accesses.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
--- drivers/net/wireless/ath/ath12k/dp_mon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath12k/dp_mon.c +1 -1
@@ -2519,7 +2519,7 @@ int ath12k_dp_mon_rx_process_stats(struct ath12k *ar, int mac_id, dest_idx =0 ; move_next:ath12k_dp_mon_buf_replenish (ab, buf_ring,1 ); -ath12k_hal_srng_src_get_next_entry (ab, srng); +ath12k_hal_srng_dst_get_next_entry (ab, srng); num_buffs_reaped++; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 6/54 wifi: ath12k: Avoid memory leak while enabling statistics
In reply to Sasha LevinFrom: P Praneesh <[email protected]>
[ Upstream commit ecfc131389923405be8e7a6f4408fd9321e4d19b ]
Driver uses monitor destination rings for extended statistics mode and standalone monitor mode. In extended statistics mode, TLVs are parsed from the buffer received from the monitor destination ring and assigned to the ppdu_info structure to update per-packet statistics. In standalone monitor mode, along with per-packet statistics, the packet data (payload) is captured, and the driver updates per MSDU to mac80211.
When the AP interface is enabled, only extended statistics mode is activated. As part of enabling monitor rings for collecting statistics, the driver subscribes to HAL_RX_MPDU_START TLV in the filter configuration. This TLV is received from the monitor destination ring, and kzalloc for the mon_mpdu object occurs, which is not freed, leading to a memory leak. The kzalloc for the mon_mpdu object is only required while enabling the standalone monitor interface. This causes a memory leak while enabling extended statistics mode in the driver.
Fix this memory leak by removing the kzalloc for the mon_mpdu object in the HAL_RX_MPDU_START TLV handling. Additionally, remove the standalone monitor mode handlings in the HAL_MON_BUF_ADDR and HAL_RX_MSDU_END TLVs. These TLV tags will be handled properly when enabling standalone monitor mode in the future.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
--- drivers/net/wireless/ath/ath12k/dp_mon.c | 64 ++++-------------------- drivers/net/wireless/ath/ath12k/hal_rx.h | 3 ++ 2 files changed, 12 insertions(+), 55 deletions(-)
drivers/net/wireless/ath/ath12k/dp_mon.c +9 -55
@@ -743,7 +743,6 @@ ath12k_dp_mon_rx_parse_status_tlv(struct ath12k_base *ab, }case HAL_RX_MPDU_START : {const struct hal_rx_mpdu_start *mpdu_start = tlv_data; -struct dp_mon_mpdu *mon_mpdu = pmon->mon_mpdu;u16 peer_id; info[1 ] =__le32_to_cpu (mpdu_start->info1);
@@ -760,65 +759,17 @@ ath12k_dp_mon_rx_parse_status_tlv(struct ath12k_base *ab,u32_get_bits (info[0 ],HAL_RX_MPDU_START_INFO1_PEERID ); } - mon_mpdu =kzalloc (sizeof (*mon_mpdu),GFP_ATOMIC ); -if (!mon_mpdu) -return HAL_RX_MON_STATUS_PPDU_NOT_DONE ; -break ; }case HAL_RX_MSDU_START :/* TODO: add msdu start parsing logic */ break ; -case HAL_MON_BUF_ADDR : { -struct dp_rxdma_mon_ring *buf_ring = &ab->dp.rxdma_mon_buf_ring; -const struct dp_mon_packet_info *packet_info = tlv_data; -int buf_id =u32_get_bits (packet_info->cookie, -DP_RXDMA_BUF_COOKIE_BUF_ID ); -struct sk_buff *msdu; -struct dp_mon_mpdu *mon_mpdu = pmon->mon_mpdu; -struct ath12k_skb_rxcb *rxcb; - -spin_lock_bh (&buf_ring->idr_lock); - msdu =idr_remove (&buf_ring->bufs_idr, buf_id); -spin_unlock_bh (&buf_ring->idr_lock); - -if (unlikely (!msdu)) { -ath12k_warn (ab,"monitor destination with invalid buf_id %d\n" , - buf_id); -return HAL_RX_MON_STATUS_PPDU_NOT_DONE ; - } - - rxcb =ATH12K_SKB_RXCB (msdu); -dma_unmap_single (ab->dev, rxcb->paddr, - msdu->len +skb_tailroom (msdu), -DMA_FROM_DEVICE ); - -if (mon_mpdu->tail) - mon_mpdu->tail->next = msdu; -else - mon_mpdu->tail = msdu; - -ath12k_dp_mon_buf_replenish (ab, buf_ring,1 ); - -break ; - } -case HAL_RX_MSDU_END : { -const struct rx_msdu_end_qcn9274 *msdu_end = tlv_data; -bool is_first_msdu_in_mpdu; -u16 msdu_end_info; - - msdu_end_info =__le16_to_cpu (msdu_end->info5); - is_first_msdu_in_mpdu =u32_get_bits (msdu_end_info, -RX_MSDU_END_INFO5_FIRST_MSDU ); -if (is_first_msdu_in_mpdu) { - pmon->mon_mpdu->head = pmon->mon_mpdu->tail; - pmon->mon_mpdu->tail =NULL ; - } -break ; - } +case HAL_MON_BUF_ADDR : +return HAL_RX_MON_STATUS_BUF_ADDR ; +case HAL_RX_MSDU_END : +return HAL_RX_MON_STATUS_MSDU_END ;case HAL_RX_MPDU_END : -list_add_tail (&pmon->mon_mpdu->list, &pmon->dp_rx_mon_mpdu_list); -break ; +return HAL_RX_MON_STATUS_MPDU_END ;case HAL_DUMMY :return HAL_RX_MON_STATUS_BUF_DONE ;case HAL_RX_PPDU_END_STATUS_DONE :
@@ -1216,7 +1167,10 @@ ath12k_dp_mon_parse_rx_dest(struct ath12k_base *ab, struct ath12k_mon_data *pmonif ((ptr - skb->data) >=DP_RX_BUFFER_SIZE )break ; - }while (hal_status ==HAL_RX_MON_STATUS_PPDU_NOT_DONE ); + }while ((hal_status ==HAL_RX_MON_STATUS_PPDU_NOT_DONE ) || + (hal_status ==HAL_RX_MON_STATUS_BUF_ADDR ) || + (hal_status ==HAL_RX_MON_STATUS_MPDU_END ) || + (hal_status ==HAL_RX_MON_STATUS_MSDU_END ));return hal_status; }
drivers/net/wireless/ath/ath12k/hal_rx.h +3 -0
@@ -108,6 +108,9 @@ enum hal_rx_mon_status {HAL_RX_MON_STATUS_PPDU_NOT_DONE ,HAL_RX_MON_STATUS_PPDU_DONE ,HAL_RX_MON_STATUS_BUF_DONE , +HAL_RX_MON_STATUS_BUF_ADDR , +HAL_RX_MON_STATUS_MPDU_END , + HAL_RX_MON_STATUS_MSDU_END, };#define HAL_RX_MAX_MPDU 256
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 7/54 ata: libata-core: Add 'external' to the libata.force kernel parameter
In reply to Sasha LevinFrom: Niklas Cassel <[email protected]>
[ Upstream commit deca423213cb33feda15e261e7b5b992077a6a08 ]
Commit ae1f3db006b7 ("ata: ahci: do not enable LPM on external ports") changed so that LPM is not enabled on external ports (hotplug-capable or eSATA ports).
This is because hotplug and LPM are mutually exclusive, see 7.3.1 Hot Plug Removal Detection and Power Management Interaction in AHCI 1.3.1.
This does require that firmware has set the appropate bits (HPCP or ESP) in PxCMD (which is a per port register in the AHCI controller).
If the firmware has failed to mark a port as hotplug-capable or eSATA in PxCMD, then there is currently not much a user can do.
If LPM is enabled on the port, hotplug insertions and removals will not be detected on that port.
In order to allow a user to fix up broken firmware, add 'external' to the libata.force kernel parameter.
libata.force can be specified either on the kernel command line, or as a kernel module parameter.
For more information, see Documentation/admin-guide/kernel-parameters.txt.
--- .../admin-guide/kernel-parameters.txt | 2 + drivers/ata/libata-core.c | 38 +++++++++++++++++++ 2 files changed, 40 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +2 -0
@@ -3116,6 +3116,8 @@ * max_sec_lba48: Set or clear transfer size limit to 65535 sectors. + * external: Mark port as external (hotplug-capable). + * [no]lpm: Enable or disable link power management. * [no]setxfer: Indicate if transfer speed mode setting
drivers/ata/libata-core.c +38 -0
@@ -88,6 +88,7 @@ struct ata_force_param {unsigned int xfer_mask;unsigned int quirk_on;unsigned int quirk_off; +unsigned int pflags_on;u16 lflags_on;u16 lflags_off; };
@@ -331,6 +332,35 @@ void ata_force_cbl(struct ata_port *ap) } } +/** +* ata_force_pflags - force port flags according to libata.force +* @ap: ATA port of interest +* +* Force port flags according to libata.force and whine about it. +* +* LOCKING: +* EH context. +*/ +static void ata_force_pflags (struct ata_port *ap) +{ +int i; + +for (i = ata_force_tbl_size -1 ; i >=0 ; i--) { +const struct ata_force_ent *fe = &ata_force_tbl[i]; + +if (fe->port !=-1 && fe->port != ap->print_id) +continue ; + +/* let pflags stack */ +if (fe->param.pflags_on) { + ap->pflags |= fe->param.pflags_on; +ata_port_notice (ap, +"FORCE: port flag 0x%x forced -> 0x%x\n" , + fe->param.pflags_on, ap->pflags); + } + } +} +/** * ata_force_link_limits - force link limits according to libata.force * @link: ATA link of interest
@@ -486,6 +516,7 @@ static void ata_force_quirks(struct ata_device *dev) } }#else +static inline void ata_force_pflags (struct ata_port *ap) { }static inline void ata_force_link_limits (struct ata_link *link) { }static inline void ata_force_xfermask (struct ata_device *dev) { }static inline void ata_force_quirks (struct ata_device *dev) { }
@@ -5460,6 +5491,8 @@ struct ata_port *ata_port_alloc(struct ata_host *host)#endif ata_sff_port_init (ap); +ata_force_pflags (ap); +return ap; }EXPORT_SYMBOL_GPL (ata_port_alloc);
@@ -6272,6 +6305,9 @@ EXPORT_SYMBOL_GPL(ata_platform_remove_one); { "no" #name, .lflags_on = (flags) }, \ { #name, .lflags_off = (flags) } +#define force_pflag_on (name, flags) \ + { #name, .pflags_on = (flags) } +#define force_quirk_on (name, flag) \ { #name, .quirk_on = (flag) }
@@ -6331,6 +6367,8 @@ static const struct ata_force_param force_tbl[] __initconst = {force_lflag_on (rstonce,ATA_LFLAG_RST_ONCE ),force_lflag_onoff (dbdelay,ATA_LFLAG_NO_DEBOUNCE_DELAY ), +force_pflag_on (external,ATA_PFLAG_EXTERNAL ), +force_quirk_onoff (ncq,ATA_QUIRK_NONCQ ),force_quirk_onoff (ncqtrim,ATA_QUIRK_NO_NCQ_TRIM ), force_quirk_onoff(ncqati, ATA_QUIRK_NO_NCQ_ON_ATI),
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 8/54 scsi: mpi3mr: Avoid reply queue full condition
In reply to Sasha LevinFrom: Ranjan Kumar <[email protected]>
[ Upstream commit f08b24d82749117ce779cc66689e8594341130d3 ]
To avoid reply queue full condition, update the driver to check IOCFacts capabilities for qfull.
Update the operational reply queue's Consumer Index after processing 100 replies. If pending I/Os on a reply queue exceeds a threshold (reply_queue_depth - 200), then return I/O back to OS to retry.
Also increase default admin reply queue size to 2K.
--- drivers/scsi/mpi3mr/mpi3mr.h | 12 +++++++++++- drivers/scsi/mpi3mr/mpi3mr_app.c | 24 ++++++++++++++++++++++++ drivers/scsi/mpi3mr/mpi3mr_fw.c | 32 ++++++++++++++++++++++++++++---- 3 files changed, 63 insertions(+), 5 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +11 -1
@@ -80,13 +80,14 @@ extern atomic64_t event_counter;/* Admin queue management definitions */ #define MPI3MR_ADMIN_REQ_Q_SIZE (2 * MPI3MR_PAGE_SIZE_4K) -#define MPI3MR_ADMIN_REPLY_Q_SIZE (4 * MPI3MR_PAGE_SIZE_4K) +#define MPI3MR_ADMIN_REPLY_Q_SIZE (8 * MPI3MR_PAGE_SIZE_4K)#define MPI3MR_ADMIN_REQ_FRAME_SZ 128#define MPI3MR_ADMIN_REPLY_FRAME_SZ 16/* Operational queue management definitions */ #define MPI3MR_OP_REQ_Q_QD 512#define MPI3MR_OP_REP_Q_QD 1024 +#define MPI3MR_OP_REP_Q_QD2K 2048#define MPI3MR_OP_REP_Q_QD4K 4096#define MPI3MR_OP_REQ_Q_SEG_SIZE 4096#define MPI3MR_OP_REP_Q_SEG_SIZE 4096
@@ -328,6 +329,7 @@ enum mpi3mr_reset_reason {#define MPI3MR_RESET_REASON_OSTYPE_SHIFT 28#define MPI3MR_RESET_REASON_IOCNUM_SHIFT 20 +/* Queue type definitions */ enum queue_type {MPI3MR_DEFAULT_QUEUE =0 ,
@@ -387,6 +389,7 @@ struct mpi3mr_ioc_facts {u16 max_msix_vectors;u8 personality;u8 dma_mask; +bool max_req_limit;u8 protocol_flags;u8 sge_mod_mask;u8 sge_mod_value;
@@ -456,6 +459,8 @@ struct op_req_qinfo {* @enable_irq_poll: Flag to indicate polling is enabled * @in_use: Queue is handled by poll/ISR * @qtype: Type of queue (types defined in enum queue_type) +* @qfull_watermark: Watermark defined in reply queue to avoid +* reply queue full */ struct op_reply_qinfo {u16 ci;
@@ -471,6 +476,7 @@ struct op_reply_qinfo {bool enable_irq_poll;atomic_t in_use;enum queue_type qtype; +u16 qfull_watermark; };/**
@@ -1153,6 +1159,8 @@ struct scmd_priv {* @snapdump_trigger_active: Snapdump trigger active flag * @pci_err_recovery: PCI error recovery in progress * @block_on_pci_err: Block IO during PCI error recovery +* @reply_qfull_count: Occurences of reply queue full avoidance kicking-in +* @prevent_reply_qfull: Enable reply queue prevention */ struct mpi3mr_ioc {struct list_head list;
@@ -1351,6 +1359,8 @@ struct mpi3mr_ioc {bool fw_release_trigger_active;bool pci_err_recovery;bool block_on_pci_err; +atomic_t reply_qfull_count; +bool prevent_reply_qfull; };/**
drivers/scsi/mpi3mr/mpi3mr_app.c +24 -0
@@ -3060,6 +3060,29 @@ reply_queue_count_show(struct device *dev, struct device_attribute *attr,static DEVICE_ATTR_RO (reply_queue_count); +/** +* reply_qfull_count_show - Show reply qfull count +* @dev: class device +* @attr: Device attributes +* @buf: Buffer to copy +* +* Retrieves the current value of the reply_qfull_count from the mrioc structure and +* formats it as a string for display. +* +* Return: sysfs_emit() return +*/ +static ssize_t +reply_qfull_count_show (struct device *dev,struct device_attribute *attr, +char *buf) +{ +struct Scsi_Host *shost =class_to_shost (dev); +struct mpi3mr_ioc *mrioc =shost_priv (shost); + +return sysfs_emit (buf,"%u\n" ,atomic_read (&mrioc->reply_qfull_count)); +} + +static DEVICE_ATTR_RO (reply_qfull_count); +/** * logging_level_show - Show controller debug level * @dev: class device
@@ -3152,6 +3175,7 @@ static struct attribute *mpi3mr_host_attrs[] = { &dev_attr_fw_queue_depth.attr, &dev_attr_op_req_q_count.attr, &dev_attr_reply_queue_count.attr, + &dev_attr_reply_qfull_count.attr, &dev_attr_logging_level.attr, &dev_attr_adp_state.attr, NULL,
drivers/scsi/mpi3mr/mpi3mr_fw.c +28 -4
@@ -2104,15 +2104,22 @@ static int mpi3mr_create_op_reply_q(struct mpi3mr_ioc *mrioc, u16 qidx) } reply_qid = qidx +1 ; - op_reply_q->num_replies =MPI3MR_OP_REP_Q_QD ; -if ((mrioc->pdev->device ==MPI3_MFGPAGE_DEVID_SAS4116 ) && - !mrioc->pdev->revision) - op_reply_q->num_replies =MPI3MR_OP_REP_Q_QD4K ; + +if (mrioc->pdev->device ==MPI3_MFGPAGE_DEVID_SAS4116 ) { +if (mrioc->pdev->revision) + op_reply_q->num_replies =MPI3MR_OP_REP_Q_QD ; +else + op_reply_q->num_replies =MPI3MR_OP_REP_Q_QD4K ; + }else + op_reply_q->num_replies =MPI3MR_OP_REP_Q_QD2K ; + op_reply_q->ci =0 ; op_reply_q->ephase =1 ;atomic_set (&op_reply_q->pend_ios,0 );atomic_set (&op_reply_q->in_use,0 ); op_reply_q->enable_irq_poll = false; + op_reply_q->qfull_watermark = + op_reply_q->num_replies - (MPI3MR_THRESHOLD_REPLY_COUNT *2 );if (!op_reply_q->q_segments) { retval =mpi3mr_alloc_op_reply_q_segments (mrioc, qidx);
@@ -2416,8 +2423,10 @@ int mpi3mr_op_request_post(struct mpi3mr_ioc *mrioc,void *segment_base_addr;u16 req_sz = mrioc->facts.op_req_sz;struct segments *segments = op_req_q->q_segments; +struct op_reply_qinfo *op_reply_q =NULL ; reply_qidx = op_req_q->reply_qid -1 ; + op_reply_q = mrioc->op_reply_qinfo + reply_qidx;if (mrioc->unrecoverable)return -EFAULT ;
@@ -2448,6 +2457,15 @@ int mpi3mr_op_request_post(struct mpi3mr_ioc *mrioc, goto out; } +/* Reply queue is nearing to get full, push back IOs to SML */ +if ((mrioc->prevent_reply_qfull == true) && + (atomic_read (&op_reply_q->pend_ios) > + (op_reply_q->qfull_watermark))) { +atomic_inc (&mrioc->reply_qfull_count); + retval = -EAGAIN ; + goto out; + } + segment_base_addr = segments[pi / op_req_q->segment_qd].segment; req_entry = (u8 *)segment_base_addr + ((pi % op_req_q->segment_qd) * req_sz);
@@ -3091,6 +3109,9 @@ static void mpi3mr_process_factsdata(struct mpi3mr_ioc *mrioc, mrioc->facts.dma_mask = (facts_flags &MPI3_IOCFACTS_FLAGS_DMA_ADDRESS_WIDTH_MASK ) >>MPI3_IOCFACTS_FLAGS_DMA_ADDRESS_WIDTH_SHIFT ; + mrioc->facts.dma_mask = (facts_flags & +MPI3_IOCFACTS_FLAGS_DMA_ADDRESS_WIDTH_MASK ) >> +MPI3_IOCFACTS_FLAGS_DMA_ADDRESS_WIDTH_SHIFT ; mrioc->facts.protocol_flags = facts_data->protocol_flags; mrioc->facts.mpi_version =le32_to_cpu (facts_data->mpi_version.word); mrioc->facts.max_reqs =le16_to_cpu (facts_data->max_outstanding_requests);
@@ -4214,6 +4235,9 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc) mrioc->shost->transportt = mpi3mr_transport_template; } +if (mrioc->facts.max_req_limit) + mrioc->prevent_reply_qfull = true; + mrioc->reply_sz = mrioc->facts.reply_sz; retval =mpi3mr_check_reset_dma_mask (mrioc);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 9/54 scsi: mpi3mr: Synchronous access b/w reset and tm thread for reply queue
In reply to Sasha LevinFrom: Ranjan Kumar <[email protected]>
[ Upstream commit f195fc060c738d303a21fae146dbf85e1595fb4c ]
When the task management thread processes reply queues while the reset thread resets them, the task management thread accesses an invalid queue ID (0xFFFF), set by the reset thread, which points to unallocated memory, causing a crash.
Add flag 'io_admin_reset_sync' to synchronize access between the reset, I/O, and admin threads. Before a reset, the reset handler sets this flag to block I/O and admin processing threads. If any thread bypasses the initial check, the reset thread waits up to 10 seconds for processing to finish. If the wait exceeds 10 seconds, the controller is marked as unrecoverable.
--- drivers/scsi/mpi3mr/mpi3mr.h | 2 + drivers/scsi/mpi3mr/mpi3mr_fw.c | 67 +++++++++++++++++++++++++++++++-- 2 files changed, 66 insertions(+), 3 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +2 -0
@@ -1096,6 +1096,7 @@ struct scmd_priv {* @ts_update_interval: Timestamp update interval * @reset_in_progress: Reset in progress flag * @unrecoverable: Controller unrecoverable flag +* @io_admin_reset_sync: Manage state of I/O ops during an admin reset process * @prev_reset_result: Result of previous reset * @reset_mutex: Controller reset mutex * @reset_waitq: Controller reset wait queue
@@ -1284,6 +1285,7 @@ struct mpi3mr_ioc {u16 ts_update_interval;u8 reset_in_progress;u8 unrecoverable; +u8 io_admin_reset_sync;int prev_reset_result;struct mutex reset_mutex;wait_queue_head_t reset_waitq;
drivers/scsi/mpi3mr/mpi3mr_fw.c +64 -3
109 lines not on this page · raw message
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 10/54 net: page_pool: don't cast mp param to devmem
In reply to Sasha LevinFrom: Pavel Begunkov <[email protected]>
[ Upstream commit 8d522566ae9cb3f0609ddb2a6ce3f4f39988043c ]
page_pool_check_memory_provider() is a generic path and shouldn't assume anything about the actual type of the memory provider argument. It's fine while devmem is the only provider, but cast away the devmem specific binding types to avoid confusion.
--- net/core/page_pool_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/page_pool_user.c +1 -1
@@ -356,7 +356,7 @@ void page_pool_unlist(struct page_pool *pool)int page_pool_check_memory_provider (struct net_device *dev,struct netdev_rx_queue *rxq) { -struct net_devmem_dmabuf_binding *binding = rxq->mp_params.mp_priv; +void *binding = rxq->mp_params.mp_priv;struct page_pool *pool;struct hlist_node *n;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 11/54 f2fs: don't retry IO for corrupted data scenario
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 1534747d3170646ddeb9ea5f7caaac90359707cf ]
F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942]
If node block is loaded successfully, but its content is inconsistent, it doesn't need to retry IO.
--- fs/f2fs/inode.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/f2fs/inode.c +4 -0
@@ -765,8 +765,12 @@ void f2fs_update_inode_page(struct inode *inode)if (err == -ENOENT )return ; +if (err == -EFSCORRUPTED ) + goto stop_checkpoint; +if (err == -ENOMEM || ++count <=DEFAULT_RETRY_IO_COUNT ) goto retry; +stop_checkpoint:f2fs_stop_checkpoint (sbi, false,STOP_CP_REASON_UPDATE_INODE );return ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 12/54 wifi: mac80211: add strict mode disabling workarounds
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 3ad4fce66e4f9d82abfc366707757e29cc14a9d2 ]
Add a strict mode where we disable certain workarounds and have additional checks such as, for now, that VHT capabilities from association response match those from beacon/probe response. We can extend the checks in the future.
Make it an opt-in setting by the driver so it can be set there in some driver-specific way, for example. Also allow setting this one hw flag through the hwflags debugfs, by writing a new strict=0 or strict=1 value.
--- include/net/mac80211.h | 6 ++++++ net/mac80211/debugfs.c | 44 +++++++++++++++++++++++++++++++++++++++-- net/mac80211/mlme.c | 45 +++++++++++++++++++++++++++++------------- 3 files changed, 79 insertions(+), 16 deletions(-)
include/net/mac80211.h +6 -0
@@ -2851,6 +2851,11 @@ struct ieee80211_txq {* implements MLO, so operation can continue on other links when one * link is switching. * +* @IEEE80211_HW_STRICT: strictly enforce certain things mandated by the spec +* but otherwise ignored/worked around for interoperability. This is a +* HW flag so drivers can opt in according to their own control, e.g. in +* testing. +* * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays */ enum ieee80211_hw_flags {
@@ -2911,6 +2916,7 @@ enum ieee80211_hw_flags {IEEE80211_HW_DISALLOW_PUNCTURING ,IEEE80211_HW_DISALLOW_PUNCTURING_5GHZ ,IEEE80211_HW_HANDLES_QUIET_CSA , +IEEE80211_HW_STRICT ,/* keep last, obviously */ NUM_IEEE80211_HW_FLAGS
net/mac80211/debugfs.c +42 -2
68 lines not on this page · raw message
net/mac80211/mlme.c +31 -14
105 lines not on this page · raw message
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 13/54 wifi: mac80211: ensure sdata->work is canceled before initialized.
In reply to Sasha LevinFrom: Miri Korenblit <[email protected]>
[ Upstream commit 6c93fd502023dd919b5987ccbe990735410edd49 ]
This wiphy work is canceled when the iface is stopped,
and shouldn't be queued for a non-running iface.
If it happens to be queued for a non-running iface (due to a bug) it can cause a corruption of wiphy_work_list when ieee80211_setup_sdata is called. Make sure to cancel it in this case and warn on.
--- net/mac80211/iface.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/mac80211/iface.c +4 -1
@@ -8,7 +8,7 @@* Copyright 2008, Johannes Berg <[email protected]> * Copyright 2013-2014 Intel Mobile Communications GmbH * Copyright (c) 2016 Intel Deutschland GmbH -* Copyright (C) 2018-2024 Intel Corporation +* Copyright (C) 2018-2025 Intel Corporation */ #include <linux/slab.h> #include <linux/kernel.h>
@@ -807,6 +807,9 @@ static void ieee80211_set_multicast_list(struct net_device *dev)*/ static void ieee80211_teardown_sdata (struct ieee80211_sub_if_data *sdata) { +if (WARN_ON (!list_empty (&sdata->work.entry))) +wiphy_work_cancel (sdata->local->hw.wiphy, &sdata->work); +/* free extra data */ ieee80211_free_keys (sdata, false);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 14/54 scsi: target: spc: Fix RSOC parameter data header size
In reply to Sasha LevinFrom: Chaohai Chen <[email protected]>
[ Upstream commit b50532318793d28a7628c1ffc129a2226e83e495 ]
The SPC document states that "The COMMAND DATA LENGTH field indicates the length in bytes of the command descriptor list".
The length should be subtracted by 4 to represent the length of the description list, not 3.
--- drivers/target/target_core_spc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/target_core_spc.c +1 -1
@@ -2243,7 +2243,7 @@ spc_emulate_report_supp_op_codes(struct se_cmd *cmd) response_length +=spc_rsoc_encode_command_descriptor ( &buf[response_length], rctd, descr); } -put_unaligned_be32 (response_length -3 , buf); +put_unaligned_be32 (response_length -4 , buf); }else { response_length = spc_rsoc_encode_one_command_descriptor( &buf[response_length], rctd, descr,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 15/54 net: usb: asix_devices: add FiberGecko DeviceID
In reply to Sasha LevinFrom: Max Schulze <[email protected]>
[ Upstream commit 4079918ae720e842ed7dff65fedeb9980b374995 ]
The FiberGecko is a small USB module that connects a 100 Mbit/s SFP
--- drivers/net/usb/asix_devices.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/net/usb/asix_devices.c +17 -0
@@ -1421,6 +1421,19 @@ static const struct driver_info hg20f9_info = { .data = FLAG_EEPROM_MAC, }; +static const struct driver_info lyconsys_fibergecko100_info = { + .description ="LyconSys FiberGecko 100 USB 2.0 to SFP Adapter" , + .bind = ax88178_bind, + .status = asix_status, + .link_reset = ax88178_link_reset, + .reset = ax88178_link_reset, + .flags =FLAG_ETHER |FLAG_FRAMING_AX |FLAG_LINK_INTR | +FLAG_MULTI_PACKET , + .rx_fixup = asix_rx_fixup_common, + .tx_fixup = asix_tx_fixup, + .data =0x20061201 , +}; +static const struct usb_device_id products [] = { {// Linksys USB200M
@@ -1578,6 +1591,10 @@ static const struct usb_device_id products [] = {// Linux Automation GmbH USB 10Base-T1L USB_DEVICE(0x33f7, 0x0004), .driver_info = (unsigned long) &lxausb_t1l_info, +}, { +/* LyconSys FiberGecko 100 */ + USB_DEVICE(0x1d2a, 0x0801), + .driver_info = (unsigned long) &lyconsys_fibergecko100_info, }, { }, // END };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 16/54 page_pool: avoid infinite loop to schedule delayed worker
In reply to Sasha LevinFrom: Jason Xing <[email protected]>
[ Upstream commit 43130d02baa137033c25297aaae95fd0edc41654 ]
We noticed the kworker in page_pool_release_retry() was waken up repeatedly and infinitely in production because of the buggy driver causing the inflight less than 0 and warning us in page_pool_inflight()[1].
Since the inflight value goes negative, it means we should not expect the whole page_pool to get back to work normally.
This patch mitigates the adverse effect by not rescheduling the kworker when detecting the inflight negative in page_pool_release_retry().
[1]
[Mon Feb 10 20:36:11 2025] ------------[ cut here ]------------ [Mon Feb 10 20:36:11 2025] Negative(-51446) inflight packet-pages ... [Mon Feb 10 20:36:11 2025] Call Trace: [Mon Feb 10 20:36:11 2025] page_pool_release_retry+0x23/0x70 [Mon Feb 10 20:36:11 2025] process_one_work+0x1b1/0x370 [Mon Feb 10 20:36:11 2025] worker_thread+0x37/0x3a0 [Mon Feb 10 20:36:11 2025] kthread+0x11a/0x140 [Mon Feb 10 20:36:11 2025] ? process_one_work+0x370/0x370 [Mon Feb 10 20:36:11 2025] ? __kthread_cancel_work+0x40/0x40 [Mon Feb 10 20:36:11 2025] ret_from_fork+0x35/0x40 [Mon Feb 10 20:36:11 2025] ---[ end trace ebffe800f33e7e34 ]---
Note: before this patch, the above calltrace would flood the dmesg due to repeated reschedule of release_dw kworker.
--- net/core/page_pool.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/core/page_pool.c +7 -1
@@ -1104,7 +1104,13 @@ static void page_pool_release_retry(struct work_struct *wq)int inflight; inflight =page_pool_release (pool); -if (!inflight) +/* In rare cases, a driver bug may cause inflight to go negative. +* Don't reschedule release if inflight is 0 or negative. +* - If 0, the page_pool has been destroyed +* - if negative, we will never recover +* in both cases no reschedule is necessary. +*/ +if (inflight <=0 )return ;/* Periodic warning for page pools the user can't see */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 17/54 can: flexcan: Add quirk to handle separate interrupt lines for mailboxes
In reply to Sasha LevinFrom: Ciprian Marian Costea <[email protected]>
[ Upstream commit 8c652cf030a769fbfc73cfc280ed3f1656343c35 ]
Introduce 'FLEXCAN_QUIRK_SECONDARY_MB_IRQ' quirk to handle a FlexCAN hardware module integration particularity where two ranges of mailboxes are controlled by separate hardware interrupt lines.
The same 'flexcan_irq' handler is used for both separate mailbox interrupt lines, with no other changes.
--- drivers/net/can/flexcan/flexcan-core.c | 24 +++++++++++++++++++++++- drivers/net/can/flexcan/flexcan.h | 5 +++++ 2 files changed, 28 insertions(+), 1 deletion(-)
drivers/net/can/flexcan/flexcan-core.c +23 -1
@@ -1762,14 +1762,25 @@ static int flexcan_open(struct net_device *dev) goto out_free_irq_boff; } +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_SECONDARY_MB_IRQ ) { + err =request_irq (priv->irq_secondary_mb, + flexcan_irq,IRQF_SHARED , dev->name, dev); +if (err) + goto out_free_irq_err; + } +flexcan_chip_interrupts_enable (dev);netif_start_queue (dev);return 0 ; + out_free_irq_err: +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_NR_IRQ_3 ) +free_irq (priv->irq_err, dev); out_free_irq_boff: -free_irq (priv->irq_boff, dev); +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_NR_IRQ_3 ) +free_irq (priv->irq_boff, dev); out_free_irq:free_irq (dev->irq, dev); out_can_rx_offload_disable:
@@ -1794,6 +1805,9 @@ static int flexcan_close(struct net_device *dev)netif_stop_queue (dev);flexcan_chip_interrupts_disable (dev); +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_SECONDARY_MB_IRQ ) +free_irq (priv->irq_secondary_mb, dev); +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_NR_IRQ_3 ) {free_irq (priv->irq_err, dev);free_irq (priv->irq_boff, dev);
@@ -2187,6 +2201,14 @@ static int flexcan_probe(struct platform_device *pdev) } } +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_SECONDARY_MB_IRQ ) { + priv->irq_secondary_mb =platform_get_irq_byname (pdev,"mb-1" ); +if (priv->irq_secondary_mb <0 ) { + err = priv->irq_secondary_mb; + goto failed_platform_get_irq; + } + } +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_SUPPORT_FD ) { priv->can.ctrlmode_supported |=CAN_CTRLMODE_FD |CAN_CTRLMODE_FD_NON_ISO ;
drivers/net/can/flexcan/flexcan.h +5 -0
@@ -70,6 +70,10 @@#define FLEXCAN_QUIRK_SUPPORT_RX_FIFO BIT(16)/* Setup stop mode with ATF SCMI protocol to support wakeup */ #define FLEXCAN_QUIRK_SETUP_STOP_MODE_SCMI BIT(17) +/* Device has two separate interrupt lines for two mailbox ranges, which +* both need to have an interrupt handler registered. +*/ +#define FLEXCAN_QUIRK_SECONDARY_MB_IRQ BIT(18)struct flexcan_devtype_data {u32 quirks;/* quirks needed for different IP cores */
@@ -107,6 +111,7 @@ struct flexcan_priv {int irq_boff;int irq_err; +int irq_secondary_mb;/* IPC handle when setup stop mode by System Controller firmware(scfw) */ struct imx_sc_ipc *sc_ipc_handle;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 18/54 can: flexcan: add NXP S32G2/S32G3 SoC support
In reply to Sasha LevinFrom: Ciprian Marian Costea <[email protected]>
[ Upstream commit 8503a4b1a24d32e95f3a233062e8f1dc0b2052bd ]
Add device type data for S32G2/S32G3 SoC.
FlexCAN module from S32G2/S32G3 is similar with i.MX SoCs, but interrupt management is different.
On S32G2/S32G3 SoC, there are separate interrupts for state change, bus errors, Mailboxes 0-7 and Mailboxes 8-127 respectively.
In order to handle this FlexCAN hardware particularity, first reuse the 'FLEXCAN_QUIRK_NR_IRQ_3' quirk provided by mcf5441x's irq handling support. Secondly, use the newly introduced 'FLEXCAN_QUIRK_SECONDARY_MB_IRQ' quirk which handles the case where two separate mailbox ranges are controlled by independent hardware interrupt lines.
--- drivers/net/can/flexcan/flexcan-core.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/can/flexcan/flexcan-core.c +11 -0
@@ -386,6 +386,16 @@ static const struct flexcan_devtype_data fsl_lx2160a_r1_devtype_data = { FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX_RTR, }; +static const struct flexcan_devtype_data nxp_s32g2_devtype_data = { + .quirks =FLEXCAN_QUIRK_DISABLE_RXFG |FLEXCAN_QUIRK_ENABLE_EACEN_RRS | +FLEXCAN_QUIRK_DISABLE_MECR |FLEXCAN_QUIRK_BROKEN_PERR_STATE | +FLEXCAN_QUIRK_USE_RX_MAILBOX |FLEXCAN_QUIRK_SUPPORT_FD | +FLEXCAN_QUIRK_SUPPORT_ECC |FLEXCAN_QUIRK_NR_IRQ_3 | +FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX | +FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX_RTR | +FLEXCAN_QUIRK_SECONDARY_MB_IRQ , +}; +static const struct can_bittiming_const flexcan_bittiming_const = { .name =DRV_NAME , .tseg1_min =4 ,
@@ -2055,6 +2065,7 @@ static const struct of_device_id flexcan_of_match[] = { { .compatible = "fsl,vf610-flexcan", .data = &fsl_vf610_devtype_data, }, { .compatible = "fsl,ls1021ar2-flexcan", .data = &fsl_ls1021a_r2_devtype_data, }, { .compatible = "fsl,lx2160ar1-flexcan", .data = &fsl_lx2160a_r1_devtype_data, }, + { .compatible = "nxp,s32g2-flexcan", .data = &nxp_s32g2_devtype_data, }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, flexcan_of_match);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 19/54 jfs: Fix uninit-value access of imap allocated in the diMount() function
In reply to Sasha LevinFrom: Zhongqiu Han <[email protected]>
[ Upstream commit 9629d7d66c621671d9a47afe27ca9336bfc8a9ea ]
syzbot reports that hex_dump_to_buffer is using uninit-value:
=====================================================
BUG: KMSAN: uninit-value in hex_dump_to_buffer+0x888/0x1100 lib/hexdump.c:171 hex_dump_to_buffer+0x888/0x1100 lib/hexdump.c:171 print_hex_dump+0x13d/0x3e0 lib/hexdump.c:276 diFree+0x5ba/0x4350 fs/jfs/jfs_imap.c:876 jfs_evict_inode+0x510/0x550 fs/jfs/inode.c:156 evict+0x723/0xd10 fs/inode.c:796 iput_final fs/inode.c:1946 [inline] iput+0x97b/0xdb0 fs/inode.c:1972 txUpdateMap+0xf3e/0x1150 fs/jfs/jfs_txnmgr.c:2367 txLazyCommit fs/jfs/jfs_txnmgr.c:2664 [inline] jfs_lazycommit+0x627/0x11d0 fs/jfs/jfs_txnmgr.c:2733 kthread+0x6b9/0xef0 kernel/kthread.c:464 ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
Uninit was created at:
slab_post_alloc_hook mm/slub.c:4121 [inline] slab_alloc_node mm/slub.c:4164 [inline] __kmalloc_cache_noprof+0x8e3/0xdf0 mm/slub.c:4320 kmalloc_noprof include/linux/slab.h:901 [inline] diMount+0x61/0x7f0 fs/jfs/jfs_imap.c:105 jfs_mount+0xa8e/0x11d0 fs/jfs/jfs_mount.c:176 jfs_fill_super+0xa47/0x17c0 fs/jfs/super.c:523 get_tree_bdev_flags+0x6ec/0x910 fs/super.c:1636 get_tree_bdev+0x37/0x50 fs/super.c:1659 jfs_get_tree+0x34/0x40 fs/jfs/super.c:635 vfs_get_tree+0xb1/0x5a0 fs/super.c:1814 do_new_mount+0x71f/0x15e0 fs/namespace.c:3560 path_mount+0x742/0x1f10 fs/namespace.c:3887 do_mount fs/namespace.c:3900 [inline] __do_sys_mount fs/namespace.c:4111 [inline] __se_sys_mount+0x71f/0x800 fs/namespace.c:4088 __x64_sys_mount+0xe4/0x150 fs/namespace.c:4088 x64_sys_call+0x39bf/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:166 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f =====================================================
The reason is that imap is not properly initialized after memory allocation. It will cause the snprintf() function to write uninitialized data into linebuf within hex_dump_to_buffer().
Fix this by using kzalloc instead of kmalloc to clear its content at the beginning in diMount().
--- fs/jfs/jfs_imap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jfs/jfs_imap.c +1 -1
@@ -102,7 +102,7 @@ int diMount(struct inode *ipimap)* allocate/initialize the in-memory inode map control structure */ /* allocate the in-memory inode map control structure. */ - imap =kmalloc (sizeof (struct inomap ),GFP_KERNEL ); + imap =kzalloc (sizeof (struct inomap ),GFP_KERNEL );if (imap ==NULL )return -ENOMEM ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 20/54 mptcp: move the whole rx path under msk socket lock protection
In reply to Sasha LevinFrom: Paolo Abeni <[email protected]>
[ Upstream commit bc68b0efa1bf923cef1294a631d8e7416c7e06e4 ]
After commit c2e6048fa1cf ("mptcp: fix race in release_cb") we can move the whole MPTCP rx path under the socket lock leveraging the release_cb.
We can drop a bunch of spin_lock pairs in the receive functions, use a single receive queue and invoke __mptcp_move_skbs only when subflows ask for it.
This will allow more cleanup in the next patch.
Some changes are worth specific mention:
The msk rcvbuf update now always happens under both the msk and the subflow socket lock: we can drop a bunch of ONCE annotation and consolidate the checks.
When the skbs move is delayed at msk release callback time, even the msk rcvbuf update is delayed; additionally take care of such action in __mptcp_move_skbs().
--- net/mptcp/fastopen.c | 1 + net/mptcp/protocol.c | 123 ++++++++++++++++++++----------------------- net/mptcp/protocol.h | 2 +- 3 files changed, 60 insertions(+), 66 deletions(-)
net/mptcp/fastopen.c +1 -0
@@ -49,6 +49,7 @@ void mptcp_fastopen_subflow_synack_set_params(struct mptcp_subflow_context *subfMPTCP_SKB_CB (skb)->has_rxtstamp =TCP_SKB_CB (skb)->has_rxtstamp;mptcp_data_lock (sk); +DEBUG_NET_WARN_ON_ONCE (sock_owned_by_user_nocheck (sk));mptcp_set_owner_r (skb, sk);__skb_queue_tail (&sk->sk_receive_queue, skb);
net/mptcp/protocol.c +58 -65
266 lines not on this page · raw message
net/mptcp/protocol.h +1 -1
@@ -124,6 +124,7 @@#define MPTCP_FLUSH_JOIN_LIST 5#define MPTCP_SYNC_STATE 6#define MPTCP_SYNC_SNDBUF 7 +#define MPTCP_DEQUEUE 8struct mptcp_skb_cb {u64 map_seq;
@@ -324,7 +325,6 @@ struct mptcp_sock {struct work_struct work;struct sk_buff *ooo_last_skb;struct rb_root out_of_order_queue; -struct sk_buff_head receive_queue;struct list_head conn_list;struct list_head rtx_queue;struct mptcp_data_frag *first_pending;
Signature · 1 line
2.39.5
Matthieu Baerts
maintainerRe: [PATCH AUTOSEL 6.14 20/54] mptcp: move the whole rx path under msk socket lock protection
Hi Paolo,
(MPTCP list only)
Quoted 24 lines · Sasha Levin
From: Paolo Abeni <[email protected]>
[ Upstream commit
bc68b0efa1bf923cef1294a631d8e7416c7e06e4]After commit
c2e6048fa1cf("mptcp: fix race inrelease_cb") we can move the whole MPTCP rx path under the socket lock leveraging therelease_cb.We can drop a bunch of
spin_lockpairs in the receive functions, use a single receive queue and invoke__mptcp_move_skbsonly when subflows ask for it.This will allow more cleanup in the next patch.
Some changes are worth specific mention:
The msk rcvbuf update now always happens under both the msk and the subflow socket lock: we can drop a bunch of ONCE annotation and consolidate the checks.
When the skbs move is delayed at msk release callback time, even the msk rcvbuf update is delayed; additionally take care of such action in
__mptcp_move_skbs().
Quoted 6 lines
Signed-off-by Paolo Abeni <[email protected]>Reviewed-by Mat Martineau <[email protected]>Signed-off-by Matthieu Baerts (NGI0) <[email protected]>Link https://patch.msgid.link/20250218-net-next-mptcp-rx-path-refactor-v1-3-4a47d90d7998@kernel.org open hereSigned-off-by Jakub Kicinski <[email protected]>Signed-off-by Sasha Levin <[email protected]>
It is not clear to me why this patch has been selected by AUTOSEL for up to 6.6, this is clearly not a fix. Do you think we should ask the stable team to drop this patch?
Having this patch in stable might help for future backports, but I don't know if it depends on others.
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Matthieu Baerts
maintainerRe: [PATCH AUTOSEL 6.14 20/54] mptcp: move the whole rx path under msk socket lock protection
Hi Paolo,
Quoted 36 lines · Matthieu Baerts
Hi Paolo,
(MPTCP list only)
Quoted 24 lines · Sasha Levin
From: Paolo Abeni <[email protected]>
[ Upstream commit
bc68b0efa1bf923cef1294a631d8e7416c7e06e4]After commit
c2e6048fa1cf("mptcp: fix race inrelease_cb") we can move the whole MPTCP rx path under the socket lock leveraging therelease_cb.We can drop a bunch of
spin_lockpairs in the receive functions, use a single receive queue and invoke__mptcp_move_skbsonly when subflows ask for it.This will allow more cleanup in the next patch.
Some changes are worth specific mention:
The msk rcvbuf update now always happens under both the msk and the subflow socket lock: we can drop a bunch of ONCE annotation and consolidate the checks.
When the skbs move is delayed at msk release callback time, even the msk rcvbuf update is delayed; additionally take care of such action in
__mptcp_move_skbs().Quoted 6 lines
Signed-off-by Paolo Abeni <[email protected]>Reviewed-by Mat Martineau <[email protected]>Signed-off-by Matthieu Baerts (NGI0) <[email protected]>Link https://patch.msgid.link/20250218-net-next-mptcp-rx-path-refactor-v1-3-4a47d90d7998@kernel.org open hereSigned-off-by Jakub Kicinski <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 6 lines
It is not clear to me why this patch has been selected by AUTOSEL for up to 6.6, this is clearly not a fix. Do you think we should ask the stable team to drop this patch?
Having this patch in stable might help for future backports, but I don't know if it depends on others.
After discussing this patch with Mat yesterday, we think it would be safer to ask to drop it from stable. If later we see it is really needed, this patch can be backported (and probably others from the series) and properly tested.
I hope there are no objections on that :)
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Matthieu Baerts
maintainerRe: [PATCH AUTOSEL 6.14 20/54] mptcp: move the whole rx path under msk socket lock protection
In reply to Sasha LevinHi Sasha,
Thank you for having suggested this patch.
Quoted 24 lines · Sasha Levin
From: Paolo Abeni <[email protected]>
[ Upstream commit
bc68b0efa1bf923cef1294a631d8e7416c7e06e4]After commit
c2e6048fa1cf("mptcp: fix race inrelease_cb") we can move the whole MPTCP rx path under the socket lock leveraging therelease_cb.We can drop a bunch of
spin_lockpairs in the receive functions, use a single receive queue and invoke__mptcp_move_skbsonly when subflows ask for it.This will allow more cleanup in the next patch.
Some changes are worth specific mention:
The msk rcvbuf update now always happens under both the msk and the subflow socket lock: we can drop a bunch of ONCE annotation and consolidate the checks.
When the skbs move is delayed at msk release callback time, even the msk rcvbuf update is delayed; additionally take care of such action in
__mptcp_move_skbs().
Quoted 6 lines
Signed-off-by Paolo Abeni <[email protected]>Reviewed-by Mat Martineau <[email protected]>Signed-off-by Matthieu Baerts (NGI0) <[email protected]>Link https://patch.msgid.link/20250218-net-next-mptcp-rx-path-refactor-v1-3-4a47d90d7998@kernel.org open hereSigned-off-by Jakub Kicinski <[email protected]>Signed-off-by Sasha Levin <[email protected]>
With Mat, we are unsure why this patch has been selected to be backported up to v6.6. An AUTOSEL patch has been sent for v6.6, v6.12, v6.13 and v6.14. We think it would be better not to backport this patch:
this is linked to a new feature, and it changes the way the MPTCP socket locks are handled.
Could it then please be possible not to queue this patch to the stable queues?
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Sasha Levin
maintainerRe: [PATCH AUTOSEL 6.14 20/54] mptcp: move the whole rx path under msk socket lock protection
Quoted 36 lines · Matthieu Baerts
Hi Sasha,
Thank you for having suggested this patch.
Quoted 24 lines · Sasha Levin
From: Paolo Abeni <[email protected]>
[ Upstream commit
bc68b0efa1bf923cef1294a631d8e7416c7e06e4]After commit
c2e6048fa1cf("mptcp: fix race inrelease_cb") we can move the whole MPTCP rx path under the socket lock leveraging therelease_cb.We can drop a bunch of
spin_lockpairs in the receive functions, use a single receive queue and invoke__mptcp_move_skbsonly when subflows ask for it.This will allow more cleanup in the next patch.
Some changes are worth specific mention:
The msk rcvbuf update now always happens under both the msk and the subflow socket lock: we can drop a bunch of ONCE annotation and consolidate the checks.
When the skbs move is delayed at msk release callback time, even the msk rcvbuf update is delayed; additionally take care of such action in
__mptcp_move_skbs().Quoted 6 lines
Signed-off-by Paolo Abeni <[email protected]>Reviewed-by Mat Martineau <[email protected]>Signed-off-by Matthieu Baerts (NGI0) <[email protected]>Link https://patch.msgid.link/20250218-net-next-mptcp-rx-path-refactor-v1-3-4a47d90d7998@kernel.org open hereSigned-off-by Jakub Kicinski <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 8 lines
With Mat, we are unsure why this patch has been selected to be backported up to v6.6. An AUTOSEL patch has been sent for v6.6, v6.12, v6.13 and v6.14. We think it would be better not to backport this patch:
this is linked to a new feature, and it changes the way the MPTCP socket locks are handled.Could it then please be possible not to queue this patch to the stable queues?
I'll drop it, thanks!
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 21/54 fs/jfs: cast inactags to s64 to prevent potential overflow
In reply to Sasha LevinFrom: Rand Deeb <[email protected]>
[ Upstream commit 70ca3246ad201b53a9f09380b3f29d8bac320383 ]
The expression "inactags << bmp->db_agl2size" in the function dbFinalizeBmap() is computed using int operands. Although the values (inactags and db_agl2size) are derived from filesystem parameters and are usually small, there is a theoretical risk that the shift could overflow a 32-bit int if extreme values occur.
According to the C standard, shifting a signed 32-bit int can lead to undefined behavior if the result exceeds its range. In our case, an overflow could miscalculate free blocks, potentially leading to erroneous filesystem accounting.
To ensure the arithmetic is performed in 64-bit space, we cast "inactags" to s64 before shifting. This defensive fix prevents any risk of overflow and complies with kernel coding best practices.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- fs/jfs/jfs_dmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/jfs/jfs_dmap.c +2 -2
@@ -3666,8 +3666,8 @@ void dbFinalizeBmap(struct inode *ipbmap)* system size is not a multiple of the group size). */ inactfree = (inactags && ag_rem) ? - ((inactags -1 ) << bmp->db_agl2size) + ag_rem - : inactags << bmp->db_agl2size; + (((s64 )inactags -1 ) << bmp->db_agl2size) + ag_rem + : ((s64 )inactags << bmp->db_agl2size);/* determine how many free blocks are in the active * allocation groups plus the average number of free blocks
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 22/54 fs/jfs: Prevent integer overflow in AG size calculation
In reply to Sasha LevinFrom: Rand Deeb <[email protected]>
[ Upstream commit 7fcbf789629cdb9fbf4e2172ce31136cfed11e5e ]
The JFS filesystem calculates allocation group (AG) size using 1 << l2agsize in dbExtendFS(). When l2agsize exceeds 31 (possible with >2TB aggregates on 32-bit systems), this 32-bit shift operation causes undefined behavior and improper AG sizing.
On 32-bit architectures:
- Left-shifting 1 by 32+ bits results in 0 due to integer overflow
- This creates invalid AG sizes (0 or garbage values) in sbi->bmap->db_agsize
- Subsequent block allocations would reference invalid AG structures
- Could lead to:
- Filesystem corruption during extend operations
- Kernel crashes due to invalid memory accesses
- Security vulnerabilities via malformed on-disk structures
Fix by casting to s64 before shifting:bmp->db_agsize = (s64)1 << l2agsize;
This ensures 64-bit arithmetic even on 32-bit architectures. The cast matches the data type of db_agsize (s64) and follows similar patterns in JFS block calculation code.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- fs/jfs/jfs_dmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jfs/jfs_dmap.c +1 -1
@@ -3403,7 +3403,7 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks) oldl2agsize = bmp->db_agl2size; bmp->db_agl2size = l2agsize; - bmp->db_agsize =1 << l2agsize; + bmp->db_agsize = (s64 )1 << l2agsize;/* compute new number of AG */ agno = bmp->db_numag;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 23/54 jfs: Prevent copying of nlink with value 0 from disk inode
In reply to Sasha LevinFrom: Edward Adam Davis <[email protected]>
[ Upstream commit b61e69bb1c049cf507e3c654fa3dc1568231bd07 ]
syzbot report a deadlock in diFree. [1]
When calling "ioctl$LOOP_SET_STATUS64", the offset value passed in is 4, which does not match the mounted loop device, causing the mapping of the mounted loop device to be invalidated.
When creating the directory and creating the inode of iag in diReadSpecial(), read the page of fixed disk inode (AIT) in raw mode in read_metapage(), the metapage data it returns is corrupted, which causes the nlink value of 0 to be assigned to the iag inode when executing copy_from_dinode(), which ultimately causes a deadlock when entering diFree().
To avoid this, first check the nlink value of dinode before setting iag inode.
[1]
WARNING: possible recursive locking detected
6.12.0-rc7-syzkaller-00212-g4a5df3796467 #0 Not tainted
--------------------------------------------
syz-executor301/5309 is trying to acquire lock:ffff888044548920 (&(imap->im_aglock[index])){+.+.}-{3:3}, at: diFree+0x37c/0x2fb0 fs/jfs/jfs_imap.c:889
but task is already holding lock:ffff888044548920 (&(imap->im_aglock[index])){+.+.}-{3:3}, at: diAlloc+0x1b6/0x1630
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
---- lock(&(imap->im_aglock[index]));
lock(&(imap->im_aglock[index]));
*** DEADLOCK ***
May be due to missing lock nesting notation
5 locks held by syz-executor301/5309:
#0: ffff8880422a4420 (sb_writers#9){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:515 #1: ffff88804755b390 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:850 [inline] #1: ffff88804755b390 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: filename_create+0x260/0x540 fs/namei.c:4026 #2: ffff888044548920 (&(imap->im_aglock[index])){+.+.}-{3:3}, at: diAlloc+0x1b6/0x1630
#3: ffff888044548890 (&imap->im_freelock){+.+.}-{3:3}, at: diNewIAG fs/jfs/jfs_imap.c:2460 [inline] #3: ffff888044548890 (&imap->im_freelock){+.+.}-{3:3}, at: diAllocExt fs/jfs/jfs_imap.c:1905 [inline] #3: ffff888044548890 (&imap->im_freelock){+.+.}-{3:3}, at: diAllocAG+0x4b7/0x1e50 fs/jfs/jfs_imap.c:1669 #4: ffff88804755a618 (&jfs_ip->rdwrlock/1){++++}-{3:3}, at: diNewIAG fs/jfs/jfs_imap.c:2477 [inline] #4: ffff88804755a618 (&jfs_ip->rdwrlock/1){++++}-{3:3}, at: diAllocExt fs/jfs/jfs_imap.c:1905 [inline] #4: ffff88804755a618 (&jfs_ip->rdwrlock/1){++++}-{3:3}, at: diAllocAG+0x869/0x1e50 fs/jfs/jfs_imap.c:1669
stack backtrace: CPU: 0 UID: 0 PID: 5309 Comm: syz-executor301 Not tainted 6.12.0-rc7-syzkaller-00212-g4a5df3796467 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_deadlock_bug+0x483/0x620 kernel/locking/lockdep.c:3037 check_deadlock kernel/locking/lockdep.c:3089 [inline] validate_chain+0x15e2/0x5920 kernel/locking/lockdep.c:3891 __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 diFree+0x37c/0x2fb0 fs/jfs/jfs_imap.c:889 jfs_evict_inode+0x32d/0x440 fs/jfs/inode.c:156 evict+0x4e8/0x9b0 fs/inode.c:725 diFreeSpecial fs/jfs/jfs_imap.c:552 [inline] duplicateIXtree+0x3c6/0x550 fs/jfs/jfs_imap.c:3022 diNewIAG fs/jfs/jfs_imap.c:2597 [inline] diAllocExt fs/jfs/jfs_imap.c:1905 [inline] diAllocAG+0x17dc/0x1e50 fs/jfs/jfs_imap.c:1669 diAlloc+0x1d2/0x1630 fs/jfs/jfs_imap.c:1590 ialloc+0x8f/0x900 fs/jfs/jfs_inode.c:56 jfs_mkdir+0x1c5/0xba0 fs/jfs/namei.c:225 vfs_mkdir+0x2f9/0x4f0 fs/namei.c:4257 do_mkdirat+0x264/0x3a0 fs/namei.c:4280 __do_sys_mkdirat fs/namei.c:4295 [inline] __se_sys_mkdirat fs/namei.c:4293 [inline] __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:4293 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- fs/jfs/jfs_imap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jfs/jfs_imap.c +1 -1
@@ -456,7 +456,7 @@ struct inode *diReadSpecial(struct super_block *sb, ino_t inum, int secondary) dp += inum %8 ;/* 8 inodes per 4K page */ /* copy on-disk inode to in-memory inode */ -if ((copy_from_dinode (dp, ip)) !=0 ) { +if ((copy_from_dinode (dp, ip) !=0 ) || (ip->i_nlink ==0 )) {/* handle bad return by returning NULL for ip */ set_nlink (ip,1 );/* Don't want iput() deleting it */ iput (ip);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 24/54 jfs: add sanity check for agwidth in dbMount
In reply to Sasha LevinFrom: Edward Adam Davis <[email protected]>
[ Upstream commit ddf2846f22e8575d6b4b6a66f2100f168b8cd73d ]
The width in dmapctl of the AG is zero, it trigger a divide error when calculating the control page level in dbAllocAG.
To avoid this issue, add a check for agwidth in dbAllocAG.
--- fs/jfs/jfs_dmap.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/jfs/jfs_dmap.c +4 -0
@@ -204,6 +204,10 @@ int dbMount(struct inode *ipbmap) bmp->db_aglevel =le32_to_cpu (dbmp_le->dn_aglevel); bmp->db_agheight =le32_to_cpu (dbmp_le->dn_agheight); bmp->db_agwidth =le32_to_cpu (dbmp_le->dn_agwidth); +if (!bmp->db_agwidth) { + err = -EINVAL ; + goto err_release_metapage; + } bmp->db_agstart =le32_to_cpu (dbmp_le->dn_agstart); bmp->db_agl2size =le32_to_cpu (dbmp_le->dn_agl2size); if (bmp->db_agl2size > L2MAXL2SIZE - L2MAXAG ||
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 25/54 wifi: rtw88: Add support for Mercusys MA30N and D-Link DWA-T185 rev. A1
In reply to Sasha LevinFrom: Zenm Chen <[email protected]>
[ Upstream commit 80c4668d024ff7b5427d90b5fad655ce9461c7b1 ]
Add two more USB IDs found in
https://github.com/RinCat/RTL88x2BU-Linux-Driver
to support Mercusys MA30N and D-Link DWA-T185 rev. A1.
--- drivers/net/wireless/realtek/rtw88/rtw8822bu.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/realtek/rtw88/rtw8822bu.c +4 -0
@@ -73,6 +73,10 @@ static const struct usb_device_id rtw_8822bu_id_table[] = { .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, /* ELECOM WDB-867DU3S */ { USB_DEVICE_AND_INTERFACE_INFO(0x2c4e, 0x0107, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, /* Mercusys MA30H */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2c4e, 0x010a, 0xff, 0xff, 0xff), + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, /* Mercusys MA30N */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x3322, 0xff, 0xff, 0xff), + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, /* D-Link DWA-T185 rev. A1 */ {}, };MODULE_DEVICE_TABLE (usb, rtw_8822bu_id_table);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 26/54 ata: libata-eh: Do not use ATAPI DMA for a device limited to PIO mode
In reply to Sasha LevinFrom: Niklas Cassel <[email protected]>
[ Upstream commit 91ec84f8eaddbc93d7c62e363d68aeb7b89879c7 ]
atapi_eh_request_sense() currently uses ATAPI DMA if the SATA controller has ATA_FLAG_PIO_DMA (PIO cmds via DMA) set.
However, ATA_FLAG_PIO_DMA is a flag that can be set by a low-level driver on a port at initialization time, before any devices are scanned.
If a controller detects a connected device that only supports PIO, we set the flag ATA_DFLAG_PIO.
Modify atapi_eh_request_sense() to not use ATAPI DMA if the connected device only supports PIO.
--- drivers/ata/libata-eh.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/ata/libata-eh.c +9 -2
@@ -1542,8 +1542,15 @@ unsigned int atapi_eh_request_sense(struct ata_device *dev, tf.flags |=ATA_TFLAG_ISADDR |ATA_TFLAG_DEVICE ; tf.command =ATA_CMD_PACKET ; -/* is it pointless to prefer PIO for "safety reasons"? */ -if (ap->flags &ATA_FLAG_PIO_DMA ) { +/* +* Do not use DMA if the connected device only supports PIO, even if the +* port prefers PIO commands via DMA. +* +* Ideally, we should call atapi_check_dma() to check if it is safe for +* the LLD to use DMA for REQUEST_SENSE, but we don't have a qc. +* Since we can't check the command, perhaps we should only use pio? +*/ +if ((ap->flags &ATA_FLAG_PIO_DMA ) && !(dev->flags &ATA_DFLAG_PIO )) { tf.protocol =ATAPI_PROT_DMA ; tf.feature |=ATAPI_PKT_DMA ; }else {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 27/54 net: sfp: add quirk for 2.5G OEM BX SFP
In reply to Sasha LevinFrom: Birger Koblitz <[email protected]>
[ Upstream commit a85035561025063125f81090e4f2bd65da368c83 ]
The OEM SFP-2.5G-BX10-D/U SFP module pair is meant to operate with 2500Base-X. However, in their EEPROM they incorrectly specify:
Transceiver codes : 0x00 0x12 0x00 0x00 0x12 0x00 0x01 0x05 0x00
BR, Nominal : 2500MBd
Use sfp_quirk_2500basex for this module to allow 2500Base-X mode anyway. Tested on BananaPi R3.
--- drivers/net/phy/sfp.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/phy/sfp.c +2 -0
@@ -515,6 +515,8 @@ static const struct sfp_quirk sfp_quirks[] = {SFP_QUIRK_F ("OEM" ,"SFP-10G-T" , sfp_fixup_rollball_cc),SFP_QUIRK_M ("OEM" ,"SFP-2.5G-T" , sfp_quirk_oem_2_5g), +SFP_QUIRK_M ("OEM" ,"SFP-2.5G-BX10-D" , sfp_quirk_2500basex), +SFP_QUIRK_M ("OEM" ,"SFP-2.5G-BX10-U" , sfp_quirk_2500basex),SFP_QUIRK_F ("OEM" ,"RTSFP-10" , sfp_fixup_rollball_cc),SFP_QUIRK_F ("OEM" ,"RTSFP-10G" , sfp_fixup_rollball_cc), SFP_QUIRK_F("Turris", "RTSFP-2.5G", sfp_fixup_rollball),
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 28/54 wifi: ath12k: Fix invalid data access in ath12k_dp_rx_h_undecap_nwifi
In reply to Sasha LevinFrom: Manish Dharanenthiran <[email protected]>
[ Upstream commit 9a0dddfb30f120db3851627935851d262e4e7acb ]
In certain cases, hardware might provide packets with a length greater than the maximum native Wi-Fi header length. This can lead to accessing and modifying fields in the header within the ath12k_dp_rx_h_undecap_nwifi function for DP_RX_DECAP_TYPE_NATIVE_WIFI decap type and
potentially resulting in invalid data access and memory corruption.
Add a sanity check before processing the SKB to prevent invalid data access in the undecap native Wi-Fi function for the DP_RX_DECAP_TYPE_NATIVE_WIFI decap type.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/dp_rx.c | 42 +++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath12k/dp_rx.c +40 -2
@@ -2530,6 +2530,29 @@ static void ath12k_dp_rx_deliver_msdu(struct ath12k *ar, struct napi_struct *napieee80211_rx_napi (ath12k_ar_to_hw (ar), pubsta, msdu, napi); } +static bool ath12k_dp_rx_check_nwifi_hdr_len_valid (struct ath12k_base *ab, +struct hal_rx_desc *rx_desc, +struct sk_buff *msdu) +{ +struct ieee80211_hdr *hdr; +u8 decap_type; +u32 hdr_len; + + decap_type =ath12k_dp_rx_h_decap_type (ab, rx_desc); +if (decap_type !=DP_RX_DECAP_TYPE_NATIVE_WIFI ) +return true; + + hdr = (struct ieee80211_hdr *)msdu->data; + hdr_len =ieee80211_hdrlen (hdr->frame_control); + +if ((likely (hdr_len <=DP_MAX_NWIFI_HDR_LEN ))) +return true; + + ab->soc_stats.invalid_rbm++; +WARN_ON_ONCE (1 ); +return false; +} + static int ath12k_dp_rx_process_msdu(struct ath12k *ar, struct sk_buff *msdu, struct sk_buff_head *msdu_list,
@@ -2588,6 +2611,11 @@ static int ath12k_dp_rx_process_msdu(struct ath12k *ar, } } +if (unlikely (!ath12k_dp_rx_check_nwifi_hdr_len_valid (ab, rx_desc, msdu))) { + ret = -EINVAL ; + goto free_out; + } +ath12k_dp_rx_h_ppdu (ar, rx_desc, rx_status);ath12k_dp_rx_h_mpdu (ar, msdu, rx_desc, rx_status);
@@ -2978,6 +3006,9 @@ static int ath12k_dp_rx_h_verify_tkip_mic(struct ath12k *ar, struct ath12k_peerRX_FLAG_IV_STRIPPED |RX_FLAG_DECRYPTED ;skb_pull (msdu, hal_rx_desc_sz); +if (unlikely (!ath12k_dp_rx_check_nwifi_hdr_len_valid (ab, rx_desc, msdu))) +return -EINVAL ; +ath12k_dp_rx_h_ppdu (ar, rx_desc, rxs);ath12k_dp_rx_h_undecap (ar, msdu, rx_desc,HAL_ENCRYPT_TYPE_TKIP_MIC , rxs, true);
@@ -3720,6 +3751,9 @@ static int ath12k_dp_rx_h_null_q_desc(struct ath12k *ar, struct sk_buff *msdu,skb_put (msdu, hal_rx_desc_sz + l3pad_bytes + msdu_len);skb_pull (msdu, hal_rx_desc_sz + l3pad_bytes); } +if (unlikely (!ath12k_dp_rx_check_nwifi_hdr_len_valid (ab, desc, msdu))) +return -EINVAL ; +ath12k_dp_rx_h_ppdu (ar, desc, status);ath12k_dp_rx_h_mpdu (ar, msdu, desc, status);
@@ -3764,7 +3798,7 @@ static bool ath12k_dp_rx_h_reo_err(struct ath12k *ar, struct sk_buff *msdu,return drop; } -static void ath12k_dp_rx_h_tkip_mic_err (struct ath12k *ar,struct sk_buff *msdu, +static bool ath12k_dp_rx_h_tkip_mic_err (struct ath12k *ar,struct sk_buff *msdu,struct ieee80211_rx_status *status) {struct ath12k_base *ab = ar->ab;
@@ -3782,6 +3816,9 @@ static void ath12k_dp_rx_h_tkip_mic_err(struct ath12k *ar, struct sk_buff *msdu,skb_put (msdu, hal_rx_desc_sz + l3pad_bytes + msdu_len);skb_pull (msdu, hal_rx_desc_sz + l3pad_bytes); +if (unlikely (!ath12k_dp_rx_check_nwifi_hdr_len_valid (ab, desc, msdu))) +return true; +ath12k_dp_rx_h_ppdu (ar, desc, status); status->flag |= (RX_FLAG_MMIC_STRIPPED | RX_FLAG_MMIC_ERROR |
@@ -3789,6 +3826,7 @@ static void ath12k_dp_rx_h_tkip_mic_err(struct ath12k *ar, struct sk_buff *msdu,ath12k_dp_rx_h_undecap (ar, msdu, desc,HAL_ENCRYPT_TYPE_TKIP_MIC , status, false); +return false; } static bool ath12k_dp_rx_h_rxdma_err(struct ath12k *ar, struct sk_buff *msdu,
@@ -3807,7 +3845,7 @@ static bool ath12k_dp_rx_h_rxdma_err(struct ath12k *ar, struct sk_buff *msdu,case HAL_REO_ENTR_RING_RXDMA_ECODE_TKIP_MIC_ERR : err_bitmap =ath12k_dp_rx_h_mpdu_err (ab, rx_desc);if (err_bitmap &HAL_RX_MPDU_ERR_TKIP_MIC ) { -ath12k_dp_rx_h_tkip_mic_err (ar, msdu, status); + drop =ath12k_dp_rx_h_tkip_mic_err (ar, msdu, status);break ; } fallthrough;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 29/54 null_blk: replace null_process_cmd() call in null_zone_write()
In reply to Sasha LevinFrom: Shin'ichiro Kawasaki <[email protected]>
[ Upstream commit 4f235000b1e88934d1e6117dc43ed814710ef4e2 ]
As a preparation to support partial data transfer due to badblocks, replace the null_process_cmd() call in null_zone_write() with equivalent calls to null_handle_badblocks() and null_handle_memory_backed(). This commit does not change behavior. It will enable null_handle_badblocks() to return the size of partial data transfer in the following commit, allowing null_zone_write() to move write pointers appropriately.
--- drivers/block/null_blk/main.c | 11 ++++------- drivers/block/null_blk/null_blk.h | 5 +++++ drivers/block/null_blk/zoned.c | 15 ++++++++++++--- 3 files changed, 21 insertions(+), 10 deletions(-)
drivers/block/null_blk/main.c +4 -7
@@ -1295,9 +1295,8 @@ static inline blk_status_t null_handle_throttled(struct nullb_cmd *cmd)return sts; } -static inline blk_status_t null_handle_badblocks (struct nullb_cmd *cmd, -sector_t sector, -sector_t nr_sectors) +blk_status_t null_handle_badblocks (struct nullb_cmd *cmd,sector_t sector, +sector_t nr_sectors) {struct badblocks *bb = &cmd->nq->dev->badblocks;sector_t first_bad;
@@ -1309,10 +1308,8 @@ static inline blk_status_t null_handle_badblocks(struct nullb_cmd *cmd,return BLK_STS_OK ; } -static inline blk_status_t null_handle_memory_backed (struct nullb_cmd *cmd, -enum req_op op, -sector_t sector, -sector_t nr_sectors) +blk_status_t null_handle_memory_backed (struct nullb_cmd *cmd,enum req_op op, +sector_t sector,sector_t nr_sectors) {struct nullb_device *dev = cmd->nq->dev;
drivers/block/null_blk/null_blk.h +5 -0
@@ -131,6 +131,11 @@ blk_status_t null_handle_discard(struct nullb_device *dev, sector_t sector, sector_t nr_sectors);blk_status_t null_process_cmd (struct nullb_cmd *cmd,enum req_op op,sector_t sector,unsigned int nr_sectors); +blk_status_t null_handle_badblocks (struct nullb_cmd *cmd,sector_t sector, +sector_t nr_sectors); +blk_status_t null_handle_memory_backed (struct nullb_cmd *cmd,enum req_op op, +sector_t sector,sector_t nr_sectors); +#ifdef CONFIG_BLK_DEV_ZONED int null_init_zoned_dev (struct nullb_device *dev,struct queue_limits *lim);
drivers/block/null_blk/zoned.c +12 -3
@@ -412,9 +412,18 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector, zone->cond =BLK_ZONE_COND_IMP_OPEN ; } - ret =null_process_cmd (cmd,REQ_OP_WRITE , sector, nr_sectors); -if (ret !=BLK_STS_OK ) - goto unlock_zone; +if (dev->badblocks.shift !=-1 ) { + ret =null_handle_badblocks (cmd, sector, nr_sectors); +if (ret !=BLK_STS_OK ) + goto unlock_zone; + } + +if (dev->memory_backed) { + ret =null_handle_memory_backed (cmd,REQ_OP_WRITE , sector, + nr_sectors); +if (ret !=BLK_STS_OK ) + goto unlock_zone; + } zone->wp += nr_sectors;if (zone->wp == zone->start + zone->capacity) {
Signature · 1 line
2.39.5
Re: [PATCH AUTOSEL 6.14 29/54] null_blk: replace null_process_cmd() call in null_zone_write()
Quoted 10 lines · Sasha Levin
From: Shin'ichiro Kawasaki <[email protected]>
[ Upstream commit
4f235000b1e88934d1e6117dc43ed814710ef4e2]As a preparation to support partial data transfer due to badblocks, replace the
null_process_cmd()call innull_zone_write()with equivalent calls tonull_handle_badblocks()andnull_handle_memory_backed(). This commit does not change behavior. It will enablenull_handle_badblocks()to return the size of partial data transfer in the following commit, allowingnull_zone_write()to move write pointers appropriately.
Hello Sasha, I don't think this patch should be in stable kernels, since it just refactors code as a preparation for another patch. I suggest to drop it for all stable kernels.
Sasha Levin
maintainerRe: [PATCH AUTOSEL 6.14 29/54] null_blk: replace null_process_cmd() call in null_zone_write()
Quoted 12 lines · Shinichiro Kawasaki
Quoted 10 lines · Sasha Levin
From: Shin'ichiro Kawasaki <[email protected]>
[ Upstream commit
4f235000b1e88934d1e6117dc43ed814710ef4e2]As a preparation to support partial data transfer due to badblocks, replace the
null_process_cmd()call innull_zone_write()with equivalent calls tonull_handle_badblocks()andnull_handle_memory_backed(). This commit does not change behavior. It will enablenull_handle_badblocks()to return the size of partial data transfer in the following commit, allowingnull_zone_write()to move write pointers appropriately.
Quoted 3 lines
Hello Sasha, I don't think this patch should be in stable kernels, since it just refactors code as a preparation for another patch. I suggest to drop it for all stable kernels.
I'll drop it, thanks!
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 30/54 f2fs: fix to avoid out-of-bounds access in f2fs_truncate_inode_blocks()
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit e6494977bd4a83862118a05f57a8df40256951c0 ]
syzbot reports an UBSAN issue as below:
------------[ cut here ]------------ UBSAN: array-index-out-of-bounds in fs/f2fs/node.h:381:10 index 18446744073709550692 is out of range for type '__le32[5]' (aka 'unsigned int[5]') CPU: 0 UID: 0 PID: 5318 Comm: syz.0.0 Not tainted 6.14.0-rc3-syzkaller-00060-g6537cfb395f3 #0 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 ubsan_epilogue lib/ubsan.c:231 [inline] __ubsan_handle_out_of_bounds+0x121/0x150 lib/ubsan.c:429 get_nid fs/f2fs/node.h:381 [inline] f2fs_truncate_inode_blocks+0xa5e/0xf60 fs/f2fs/node.c:1181 f2fs_do_truncate_blocks+0x782/0x1030 fs/f2fs/file.c:808 f2fs_truncate_blocks+0x10d/0x300 fs/f2fs/file.c:836 f2fs_truncate+0x417/0x720 fs/f2fs/file.c:886 f2fs_file_write_iter+0x1bdb/0x2550 fs/f2fs/file.c:5093 aio_write+0x56b/0x7c0 fs/aio.c:1633 io_submit_one+0x8a7/0x18a0 fs/aio.c:2052 __do_sys_io_submit fs/aio.c:2111 [inline] __se_sys_io_submit+0x171/0x2e0 fs/aio.c:2081 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f238798cde9
index 18446744073709550692 (decimal, unsigned long long) = 0xfffffffffffffc64 (hexadecimal, unsigned long long) = -924 (decimal, long long)
In f2fs_truncate_inode_blocks(), UBSAN detects that get_nid() tries to access .i_nid[-924], it means both offset[0] and level should zero.
The possible case should be in f2fs_do_truncate_blocks(), we try to truncate inode size to zero, however, dn.ofs_in_node is zero and dn.node_page is not an inode page, so it fails to truncate inode page, and then pass zeroed free_from to f2fs_truncate_inode_blocks(), result in this issue.
if (dn.ofs_in_node || IS_INODE(dn.node_page)) {
f2fs_truncate_data_blocks_range(&dn, count);
free_from += count;
}I guess the reason why dn.node_page is not an inode page could be: there are multiple nat entries share the same node block address, once the node block address was reused, f2fs_get_node_page() may load a non-inode block.
Let's add a sanity check for such condition to avoid out-of-bounds access issue.
--- fs/f2fs/node.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
fs/f2fs/node.c +8 -1
@@ -1135,7 +1135,14 @@ int f2fs_truncate_inode_blocks(struct inode *inode, pgoff_t from)trace_f2fs_truncate_inode_blocks_enter (inode, from); level =get_node_path (inode, from, offset, noffset); -if (level <0 ) { +if (level <=0 ) { +if (!level) { + level = -EFSCORRUPTED ; +f2fs_err (sbi,"%s: inode ino=%lx has corrupted node block, from:%lu addrs:%u" , + __func__, inode->i_ino, + from,ADDRS_PER_INODE (inode)); +set_sbi_flag (sbi,SBI_NEED_FSCK ); + }trace_f2fs_truncate_inode_blocks_exit (inode, level);return level; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 31/54 net: sfp: add quirk for FS SFP-10GM-T copper SFP+ module
In reply to Sasha LevinFrom: Martin Schiller <[email protected]>
[ Upstream commit 05ec5c085eb7ae044d49e04a3cff194a0b2a3251 ]
Add quirk for a copper SFP that identifies itself as "FS" "SFP-10GM-T". It uses RollBall protocol to talk to the PHY and needs 4 sec wait before probing the PHY.
--- drivers/net/phy/sfp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/phy/sfp.c +6 -5
@@ -385,7 +385,7 @@ static void sfp_fixup_rollball(struct sfp *sfp) sfp->phy_t_retry =msecs_to_jiffies (1000 ); } -static void sfp_fixup_fs_2_5gt (struct sfp *sfp) +static void sfp_fixup_rollball_wait4s (struct sfp *sfp) {sfp_fixup_rollball (sfp);
@@ -399,7 +399,7 @@ static void sfp_fixup_fs_2_5gt(struct sfp *sfp)static void sfp_fixup_fs_10gt (struct sfp *sfp) {sfp_fixup_10gbaset_30m (sfp); -sfp_fixup_fs_2_5gt (sfp); +sfp_fixup_rollball_wait4s (sfp); }static void sfp_fixup_halny_gsfp (struct sfp *sfp)
@@ -479,9 +479,10 @@ static const struct sfp_quirk sfp_quirks[] = {// PHY. SFP_QUIRK_F ("FS" ,"SFP-10G-T" , sfp_fixup_fs_10gt), -// Fiberstore SFP-2.5G-T uses Rollball protocol to talk to the PHY and -// needs 4 sec wait before probing the PHY. - SFP_QUIRK_F("FS", "SFP-2.5G-T", sfp_fixup_fs_2_5gt), +// Fiberstore SFP-2.5G-T and SFP-10GM-T uses Rollball protocol to talk +// to the PHY and needs 4 sec wait before probing the PHY. +SFP_QUIRK_F ("FS" ,"SFP-2.5G-T" , sfp_fixup_rollball_wait4s), + SFP_QUIRK_F("FS", "SFP-10GM-T", sfp_fixup_rollball_wait4s),// Fiberstore GPON-ONU-34-20BI can operate at 2500base-X, but report 1.2GBd // NRZ in their EEPROM
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 32/54 ahci: add PCI ID for Marvell 88SE9215 SATA Controller
In reply to Sasha LevinFrom: Daniel Kral <[email protected]>
[ Upstream commit 885251dc35767b1c992f6909532ca366c830814a ]
Add support for Marvell Technology Group Ltd. 88SE9215 SATA 6 Gb/s controller, which is e.g. used in the DAWICONTROL DC-614e RAID bus controller and was not automatically recognized before.
Tested with a DAWICONTROL DC-614e RAID bus controller.
--- drivers/ata/ahci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/ata/ahci.c +2 -0
@@ -589,6 +589,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { .driver_data = board_ahci_yes_fbs }, { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x91a3), .driver_data = board_ahci_yes_fbs }, + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9215), + .driver_data = board_ahci_yes_fbs }, { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230), .driver_data = board_ahci_yes_fbs }, { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9235),
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 33/54 ext4: protect ext4_release_dquot against freezing
In reply to Sasha LevinFrom: Ojaswin Mujoo <[email protected]>
[ Upstream commit 530fea29ef82e169cd7fe048c2b7baaeb85a0028 ]
Protect ext4_release_dquot against freezing so that we don't try to start a transaction when FS is frozen, leading to warnings.
Further, avoid taking the freeze protection if a transaction is already running so that we don't need end up in a deadlock as described in
46e294efc355 ext4: fix deadlock with fs freezing and EA inodes
--- fs/ext4/super.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
fs/ext4/super.c +17 -0
@@ -6935,12 +6935,25 @@ static int ext4_release_dquot(struct dquot *dquot) {int ret, err;handle_t *handle; +bool freeze_protected = false; + +/* +* Trying to sb_start_intwrite() in a running transaction +* can result in a deadlock. Further, running transactions +* are already protected from freezing. +*/ +if (!ext4_journal_current_handle ()) { +sb_start_intwrite (dquot->dq_sb); + freeze_protected = true; + } handle =ext4_journal_start (dquot_to_inode (dquot),EXT4_HT_QUOTA ,EXT4_QUOTA_DEL_BLOCKS (dquot->dq_sb));if (IS_ERR (handle)) {/* Release dquot anyway to avoid endless cycle in dqput() */ dquot_release (dquot); +if (freeze_protected) +sb_end_intwrite (dquot->dq_sb);return PTR_ERR (handle); } ret =dquot_release (dquot);
@@ -6951,6 +6964,10 @@ static int ext4_release_dquot(struct dquot *dquot) err =ext4_journal_stop (handle);if (!ret) ret = err; + +if (freeze_protected) +sb_end_intwrite (dquot->dq_sb); +return ret; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 34/54 Revert "f2fs: rebuild nat_bits during umount"
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 19426c4988aa85298c1b4caf2889d37ec5c80fea ]
This reverts commit 94c821fb286b545d37549ff30a0c341e066f0d6c.
It reports that there is potential corruption in node footer, the most suspious feature is nat_bits, let's revert recovery related code.
--- fs/f2fs/checkpoint.c | 21 +++------ fs/f2fs/f2fs.h | 32 +++++++++++++- fs/f2fs/node.c | 101 ++++++++++--------------------------------- 3 files changed, 59 insertions(+), 95 deletions(-)
fs/f2fs/checkpoint.c +6 -15
@@ -1344,21 +1344,13 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)struct f2fs_checkpoint *ckpt =F2FS_CKPT (sbi);unsigned long flags; -if (cpc->reason &CP_UMOUNT ) { -if (le32_to_cpu (ckpt->cp_pack_total_block_count) + -NM_I (sbi)->nat_bits_blocks >BLKS_PER_SEG (sbi)) { -clear_ckpt_flags (sbi,CP_NAT_BITS_FLAG ); -f2fs_notice (sbi,"Disable nat_bits due to no space" ); - }else if (!is_set_ckpt_flags (sbi,CP_NAT_BITS_FLAG ) && -f2fs_nat_bitmap_enabled (sbi)) { -f2fs_enable_nat_bits (sbi); -set_ckpt_flags (sbi,CP_NAT_BITS_FLAG ); -f2fs_notice (sbi,"Rebuild and enable nat_bits" ); - } - } -spin_lock_irqsave (&sbi->cp_lock, flags); +if ((cpc->reason &CP_UMOUNT ) && +le32_to_cpu (ckpt->cp_pack_total_block_count) > + sbi->blocks_per_seg -NM_I (sbi)->nat_bits_blocks) +disable_nat_bits (sbi, false); +if (cpc->reason &CP_TRIMMED )__set_ckpt_flags (ckpt,CP_TRIMMED_FLAG );else
@@ -1541,8 +1533,7 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) start_blk =__start_cp_next_addr (sbi);/* write nat bits */ -if ((cpc->reason &CP_UMOUNT ) && -is_set_ckpt_flags (sbi,CP_NAT_BITS_FLAG )) { +if (enabled_nat_bits (sbi, cpc)) {__u64 cp_ver =cur_cp_version (ckpt);block_t blk;
fs/f2fs/f2fs.h +30 -2
@@ -2219,6 +2219,36 @@ static inline void f2fs_up_write(struct f2fs_rwsem *sem)#endif } +static inline void disable_nat_bits (struct f2fs_sb_info *sbi,bool lock) +{ +unsigned long flags; +unsigned char *nat_bits; + +/* +* In order to re-enable nat_bits we need to call fsck.f2fs by +* set_sbi_flag(sbi, SBI_NEED_FSCK). But it may give huge cost, +* so let's rely on regular fsck or unclean shutdown. +*/ + +if (lock) +spin_lock_irqsave (&sbi->cp_lock, flags); +__clear_ckpt_flags (F2FS_CKPT (sbi),CP_NAT_BITS_FLAG ); + nat_bits =NM_I (sbi)->nat_bits; +NM_I (sbi)->nat_bits =NULL ; +if (lock) +spin_unlock_irqrestore (&sbi->cp_lock, flags); + +kvfree (nat_bits); +} + +static inline bool enabled_nat_bits (struct f2fs_sb_info *sbi, +struct cp_control *cpc) +{ +bool set =is_set_ckpt_flags (sbi,CP_NAT_BITS_FLAG ); + +return (cpc) ? (cpc->reason &CP_UMOUNT ) && set : set; +} +static inline void f2fs_lock_op (struct f2fs_sb_info *sbi) {f2fs_down_read (&sbi->cp_rwsem);
@@ -3662,7 +3692,6 @@ int f2fs_truncate_inode_blocks(struct inode *inode, pgoff_t from);int f2fs_truncate_xattr_node (struct inode *inode);int f2fs_wait_on_node_pages_writeback (struct f2fs_sb_info *sbi,unsigned int seq_id); -bool f2fs_nat_bitmap_enabled (struct f2fs_sb_info *sbi);int f2fs_remove_inode_page (struct inode *inode);struct page *f2fs_new_inode_page (struct inode *inode);struct page *f2fs_new_node_page (struct dnode_of_data *dn,unsigned int ofs);
@@ -3687,7 +3716,6 @@ int f2fs_recover_xattr_data(struct inode *inode, struct page *page);int f2fs_recover_inode_page (struct f2fs_sb_info *sbi,struct page *page);int f2fs_restore_node_summary (struct f2fs_sb_info *sbi,unsigned int segno,struct f2fs_summary_block *sum); -void f2fs_enable_nat_bits (struct f2fs_sb_info *sbi);int f2fs_flush_nat_entries (struct f2fs_sb_info *sbi,struct cp_control *cpc);int f2fs_build_node_manager (struct f2fs_sb_info *sbi);void f2fs_destroy_node_manager (struct f2fs_sb_info *sbi);
fs/f2fs/node.c +23 -78
178 lines not on this page · raw message
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 35/54 wifi: mac80211: fix userspace_selectors corruption
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 700014d3ad1fd6e55c8f9ffa817514d3fbb5286e ]
Spotted during code review, the selectors need to be large enough for a 128-bit bitmap, not a single unsigned long, otherwise we have stack corruption.
We should also allow passing selectors from userspace, but that should be a separate change.
--- net/mac80211/mlme.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
net/mac80211/mlme.c +6 -8
@@ -9648,8 +9648,6 @@ EXPORT_SYMBOL(ieee80211_disable_rssi_reports);static void ieee80211_ml_reconf_selectors (unsigned long *userspace_selectors) { - *userspace_selectors =0 ; -/* these selectors are mandatory for ML reconfiguration */ set_bit (BSS_MEMBERSHIP_SELECTOR_SAE_H2E , userspace_selectors);set_bit (BSS_MEMBERSHIP_SELECTOR_HE_PHY , userspace_selectors);
@@ -9669,7 +9667,7 @@ void ieee80211_process_ml_reconf_resp(struct ieee80211_sub_if_data *sdata, sdata->u.mgd.reconf.removed_links;u16 link_mask, valid_links;unsigned int link_id; -unsigned long userspace_selectors; +unsigned long userspace_selectors[BITS_TO_LONGS (128 )] = {};size_t orig_len = len;u8 i, group_key_data_len;u8 *pos;
@@ -9777,7 +9775,7 @@ void ieee80211_process_ml_reconf_resp(struct ieee80211_sub_if_data *sdata, }ieee80211_vif_set_links (sdata, valid_links, sdata->vif.dormant_links); -ieee80211_ml_reconf_selectors (&userspace_selectors); +ieee80211_ml_reconf_selectors (userspace_selectors); link_mask =0 ;for (link_id =0 ; link_id <IEEE80211_MLD_MAX_NUM_LINKS ; link_id++) {struct cfg80211_bss *cbss = add_links_data->link[link_id].bss;
@@ -9823,7 +9821,7 @@ void ieee80211_process_ml_reconf_resp(struct ieee80211_sub_if_data *sdata, link->u.mgd.conn = add_links_data->link[link_id].conn;if (ieee80211_prep_channel (sdata, link, link_id, cbss, true, &link->u.mgd.conn, - &userspace_selectors)) { + userspace_selectors)) {link_info (link,"mlo: reconf: prep_channel failed\n" ); goto disconnect; }
@@ -10157,14 +10155,14 @@ int ieee80211_mgd_assoc_ml_reconf(struct ieee80211_sub_if_data *sdata,*/ if (added_links) {bool uapsd_supported; -unsigned long userspace_selectors; +unsigned long userspace_selectors[BITS_TO_LONGS (128 )] = {}; data =kzalloc (sizeof (*data),GFP_KERNEL );if (!data)return -ENOMEM ; uapsd_supported = true; -ieee80211_ml_reconf_selectors (&userspace_selectors); +ieee80211_ml_reconf_selectors (userspace_selectors);for (link_id =0 ; link_id <IEEE80211_MLD_MAX_NUM_LINKS ; link_id++) {struct ieee80211_supported_band *sband;
@@ -10240,7 +10238,7 @@ int ieee80211_mgd_assoc_ml_reconf(struct ieee80211_sub_if_data *sdata, data->link[link_id].bss, true, &data->link[link_id].conn, - &userspace_selectors); + userspace_selectors);if (err) goto err_free; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 36/54 ext4: ignore xattrs past end
In reply to Sasha LevinFrom: Bhupesh <[email protected]>
[ Upstream commit c8e008b60492cf6fd31ef127aea6d02fd3d314cd ]
Once inside 'ext4_xattr_inode_dec_ref_all' we should ignore xattrs entries past the 'end' entry.
This fixes the following KASAN reported issue:
==================================================================
BUG: KASAN: slab-use-after-free in ext4_xattr_inode_dec_ref_all+0xb8c/0xe90 Read of size 4 at addr ffff888012c120c4 by task repro/2065 CPU: 1 UID: 0 PID: 2065 Comm: repro Not tainted 6.13.0-rc2+ #11 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x1fd/0x300 ? tcp_gro_dev_warn+0x260/0x260 ? _printk+0xc0/0x100 ? read_lock_is_recursive+0x10/0x10 ? irq_work_queue+0x72/0xf0 ? __virt_addr_valid+0x17b/0x4b0 print_address_description+0x78/0x390 print_report+0x107/0x1f0 ? __virt_addr_valid+0x17b/0x4b0 ? __virt_addr_valid+0x3ff/0x4b0 ? __phys_addr+0xb5/0x160 ? ext4_xattr_inode_dec_ref_all+0xb8c/0xe90 kasan_report+0xcc/0x100 ? ext4_xattr_inode_dec_ref_all+0xb8c/0xe90 ext4_xattr_inode_dec_ref_all+0xb8c/0xe90 ? ext4_xattr_delete_inode+0xd30/0xd30 ? __ext4_journal_ensure_credits+0x5f0/0x5f0 ? __ext4_journal_ensure_credits+0x2b/0x5f0 ? inode_update_timestamps+0x410/0x410 ext4_xattr_delete_inode+0xb64/0xd30 ? ext4_truncate+0xb70/0xdc0 ? ext4_expand_extra_isize_ea+0x1d20/0x1d20 ? __ext4_mark_inode_dirty+0x670/0x670 ? ext4_journal_check_start+0x16f/0x240 ? ext4_inode_is_fast_symlink+0x2f2/0x3a0 ext4_evict_inode+0xc8c/0xff0 ? ext4_inode_is_fast_symlink+0x3a0/0x3a0 ? do_raw_spin_unlock+0x53/0x8a0 ? ext4_inode_is_fast_symlink+0x3a0/0x3a0 evict+0x4ac/0x950 ? proc_nr_inodes+0x310/0x310 ? trace_ext4_drop_inode+0xa2/0x220 ? _raw_spin_unlock+0x1a/0x30 ? iput+0x4cb/0x7e0 do_unlinkat+0x495/0x7c0 ? try_break_deleg+0x120/0x120 ? 0xffffffff81000000 ? __check_object_size+0x15a/0x210 ? strncpy_from_user+0x13e/0x250 ? getname_flags+0x1dc/0x530 __x64_sys_unlinkat+0xc8/0xf0 do_syscall_64+0x65/0x110 entry_SYSCALL_64_after_hwframe+0x67/0x6f RIP: 0033:0x434ffd Code: 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 8 RSP: 002b:00007ffc50fa7b28 EFLAGS: 00000246 ORIG_RAX: 0000000000000107 RAX: ffffffffffffffda RBX: 00007ffc50fa7e18 RCX: 0000000000434ffd RDX: 0000000000000000 RSI: 0000000020000240 RDI: 0000000000000005 RBP: 00007ffc50fa7be0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007ffc50fa7e08 R14: 00000000004bbf30 R15: 0000000000000001 </TASK> The buggy address belongs to the object at ffff888012c12000 which belongs to the cache filp of size 360
The buggy address is located 196 bytes inside of
freed 360-byte region [ffff888012c12000, ffff888012c12168)
The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12c12 head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x40(head|node=0|zone=0) page_type: f5(slab) raw: 0000000000000040 ffff888000ad7640 ffffea0000497a00 dead000000000004 raw: 0000000000000000 0000000000100010 00000001f5000000 0000000000000000
head: 0000000000000040 ffff888000ad7640 ffffea0000497a00 dead000000000004
head: 0000000000000000 0000000000100010 00000001f5000000 0000000000000000
head: 0000000000000001 ffffea00004b0481 ffffffffffffffff 0000000000000000
head: 0000000000000002 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888012c11f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888012c12000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
Quoted 1 line
ffff888012c12080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888012c12100: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
ffff888012c12180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
--- fs/ext4/xattr.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
fs/ext4/xattr.c +10 -1
@@ -1176,15 +1176,24 @@ ext4_xattr_inode_dec_ref_all(handle_t *handle, struct inode *parent, {struct inode *ea_inode;struct ext4_xattr_entry *entry; +struct ext4_iloc iloc;bool dirty = false;unsigned int ea_ino;int err;int credits; +void *end; + +if (block_csum) + end = (void *)bh->b_data + bh->b_size; +else { +ext4_get_inode_loc (parent, &iloc); + end = (void *)ext4_raw_inode (&iloc) +EXT4_SB (parent->i_sb)->s_inode_size; + }/* One credit for dec ref on ea_inode, one for orphan list addition, */ credits =2 + extra_credits; -for (entry = first; !IS_LAST_ENTRY (entry); +for (entry = first; (void *)entry < end && !IS_LAST_ENTRY (entry); entry =EXT4_XATTR_NEXT (entry)) {if (!entry->e_value_inum)continue ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 37/54 cdc_ether|r8152: ThinkPad Hybrid USB-C/A Dock quirk
In reply to Sasha LevinFrom: Philipp Hahn <[email protected]>
[ Upstream commit a07f23ad9baf716cbf7746e452c92960536ceae6 ]
Lenovo ThinkPad Hybrid USB-C with USB-A Dock (17ef:a359) is affected by the same problem as the Lenovo Powered USB-C Travel Hub (17ef:721e):
Both are based on the Realtek RTL8153B chip used to use the cdc_ether driver. However, using this driver, with the system suspended the device constantly sends pause-frames as soon as the receive buffer fills up. This causes issues with other devices, where some Ethernet switches stop forwarding packets altogether.
Using the Realtek driver (r8152) fixes this issue. Pause frames are no longer sent while the host system is suspended.
--- drivers/net/usb/cdc_ether.c | 7 +++++++ drivers/net/usb/r8152.c | 6 ++++++ drivers/net/usb/r8153_ecm.c | 6 ++++++ 3 files changed, 19 insertions(+)
drivers/net/usb/cdc_ether.c +7 -0
@@ -783,6 +783,13 @@ static const struct usb_device_id products[] = { .driver_info = 0, }, +/* Lenovo ThinkPad Hybrid USB-C with USB-A Dock (40af0135eu, based on Realtek RTL8153) */ +{ +USB_DEVICE_AND_INTERFACE_INFO (LENOVO_VENDOR_ID ,0xa359 ,USB_CLASS_COMM , + USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), + .driver_info =0 , +}, + /* Aquantia AQtion USB to 5GbE Controller (based on AQC111U) */ { USB_DEVICE_AND_INTERFACE_INFO(AQUANTIA_VENDOR_ID, 0xc101,
drivers/net/usb/r8152.c +6 -0
@@ -785,6 +785,7 @@ enum rtl8152_flags {#define DEVICE_ID_THINKPAD_USB_C_DONGLE 0x720c#define DEVICE_ID_THINKPAD_USB_C_DOCK_GEN2 0xa387#define DEVICE_ID_THINKPAD_USB_C_DOCK_GEN3 0x3062 +#define DEVICE_ID_THINKPAD_HYBRID_USB_C_DOCK 0xa359struct tally_counter {__le64 tx_packets;
@@ -9787,6 +9788,7 @@ static bool rtl8152_supports_lenovo_macpassthru(struct usb_device *udev)case DEVICE_ID_THINKPAD_USB_C_DOCK_GEN2 :case DEVICE_ID_THINKPAD_USB_C_DOCK_GEN3 :case DEVICE_ID_THINKPAD_USB_C_DONGLE : +case DEVICE_ID_THINKPAD_HYBRID_USB_C_DOCK :return 1 ; } }else if (vendor_id ==VENDOR_ID_REALTEK && parent_vendor_id ==VENDOR_ID_LENOVO ) {
@@ -10064,6 +10066,8 @@ static const struct usb_device_id rtl8152_table[] = { { USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0927) }, { USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0c5e) }, { USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101) }, + +/* Lenovo */ { USB_DEVICE(VENDOR_ID_LENOVO, 0x304f) }, { USB_DEVICE(VENDOR_ID_LENOVO, 0x3054) }, { USB_DEVICE(VENDOR_ID_LENOVO, 0x3062) },
@@ -10074,7 +10078,9 @@ static const struct usb_device_id rtl8152_table[] = { { USB_DEVICE(VENDOR_ID_LENOVO, 0x720c) }, { USB_DEVICE(VENDOR_ID_LENOVO, 0x7214) }, { USB_DEVICE(VENDOR_ID_LENOVO, 0x721e) }, + { USB_DEVICE(VENDOR_ID_LENOVO, 0xa359) }, { USB_DEVICE(VENDOR_ID_LENOVO, 0xa387) }, + { USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041) }, { USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff) }, { USB_DEVICE(VENDOR_ID_TPLINK, 0x0601) },
drivers/net/usb/r8153_ecm.c +6 -0
@@ -135,6 +135,12 @@ static const struct usb_device_id products[] = { USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), .driver_info = (unsigned long)&r8153_info, }, +/* Lenovo ThinkPad Hybrid USB-C with USB-A Dock (40af0135eu, based on Realtek RTL8153) */ +{ + USB_DEVICE_AND_INTERFACE_INFO(VENDOR_ID_LENOVO, 0xa359, USB_CLASS_COMM, +USB_CDC_SUBCLASS_ETHERNET ,USB_CDC_PROTO_NONE ), + .driver_info = (unsigned long)&r8153_info, +}, { }, /* END */ };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 38/54 scsi: st: Fix array overflow in st_setup()
In reply to Sasha LevinFrom: Kai Mäkisara <[email protected]>
[ Upstream commit a018d1cf990d0c339fe0e29b762ea5dc10567d67 ]
Change the array size to follow parms size instead of a fixed value.
--- drivers/scsi/st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/st.c +1 -1
@@ -4122,7 +4122,7 @@ static void validate_options(void)*/ static int __init st_setup (char *str) { -int i, len, ints[5 ]; +int i, len, ints[ARRAY_SIZE (parms) +1 ];char *stp; stp =get_options (str,ARRAY_SIZE (ints), ints);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 39/54 ahci: Marvell 88SE9215 controllers prefer DMA for ATAPI
In reply to Sasha LevinFrom: Huacai Chen <[email protected]>
[ Upstream commit 0507c777f5d8f9e34b137d28ee263599a7b81242 ]
We use CD/DVD drives under Marvell 88SE9215 SATA controller on many Loongson-based machines. We found its PIO doesn't work well, and on the opposite its DMA seems work very well.
We don't know the detail of the 88SE9215 SATA controller, but we have tested different CD/DVD drives and they all have problems under 88SE9215 (but they all work well under an Intel SATA controller). So, we consider this problem is bound to 88SE9215 SATA controller rather than bound to CD/DVD drives.
As a solution, we define a new dedicated AHCI board id which is named board_ahci_yes_fbs_atapi_dma for 88SE9215, and for this id we set the AHCI_HFLAG_ATAPI_DMA_QUIRK and ATA_QUIRK_ATAPI_MOD16_DMA flags on the SATA controller in order to prefer ATAPI DMA.
--- drivers/ata/ahci.c | 11 ++++++++++- drivers/ata/ahci.h | 1 + drivers/ata/libahci.c | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-)
drivers/ata/ahci.c +10 -1
@@ -63,6 +63,7 @@ enum board_ids { board_ahci_pcs_quirk_no_devslp, board_ahci_pcs_quirk_no_sntf, board_ahci_yes_fbs, + board_ahci_yes_fbs_atapi_dma,/* board IDs for specific chipsets in alphabetical order */ board_ahci_al,
@@ -188,6 +189,14 @@ static const struct ata_port_info ahci_port_info[] = { .udma_mask = ATA_UDMA6, .port_ops = &ahci_ops, }, + [board_ahci_yes_fbs_atapi_dma] = { +AHCI_HFLAGS (AHCI_HFLAG_YES_FBS | + AHCI_HFLAG_ATAPI_DMA_QUIRK), + .flags = AHCI_FLAG_COMMON, + .pio_mask = ATA_PIO4, + .udma_mask = ATA_UDMA6, + .port_ops = &ahci_ops, + },/* by chipsets */ [board_ahci_al] = { AHCI_HFLAGS (AHCI_HFLAG_NO_PMP | AHCI_HFLAG_NO_MSI),
@@ -590,7 +599,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x91a3), .driver_data = board_ahci_yes_fbs }, { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9215), - .driver_data = board_ahci_yes_fbs }, + .driver_data = board_ahci_yes_fbs_atapi_dma }, { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230), .driver_data = board_ahci_yes_fbs }, { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9235),
drivers/ata/ahci.h +1 -0
@@ -246,6 +246,7 @@ enum {AHCI_HFLAG_NO_SXS =BIT (26 ),/* SXS not supported */ AHCI_HFLAG_43BIT_ONLY =BIT (27 ),/* 43bit DMA addr limit */ AHCI_HFLAG_INTEL_PCS_QUIRK =BIT (28 ),/* apply Intel PCS quirk */ + AHCI_HFLAG_ATAPI_DMA_QUIRK = BIT(29), /* force ATAPI to use DMA *//* ap->flags bits */
drivers/ata/libahci.c +4 -0
@@ -1322,6 +1322,10 @@ static void ahci_dev_config(struct ata_device *dev) {struct ahci_host_priv *hpriv = dev->link->ap->host->private_data; +if ((dev->class ==ATA_DEV_ATAPI ) && + (hpriv->flags &AHCI_HFLAG_ATAPI_DMA_QUIRK )) + dev->quirks |=ATA_QUIRK_ATAPI_MOD16_DMA ; +if (hpriv->flags &AHCI_HFLAG_SECT255 ) { dev->max_sectors =255 ; ata_dev_info(dev,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 40/54 btrfs: reject out-of-band dirty folios during writeback
In reply to Sasha LevinFrom: Qu Wenruo <[email protected]>
[ Upstream commit 7ca3e84980ef6484a5c6f004aa180b61ce0c37d9 ]
[OUT-OF-BAND DIRTY FOLIOS]
An out-of-band folio means the folio is marked dirty but without notifying the filesystem.
This can lead to various problems, not limited to:
- No folio::private to track per block status
- No proper space reserved for such a dirty folio
[HISTORY IN BTRFS]
This used to be a problem related to get_user_page(), but with the introduction of pin_user_pages*(), we should no longer hit such case anymore.
In btrfs, we have a long history of catching such out-of-band dirty folios by:
- Mark the folio ordered during delayed allocation
- Check the folio ordered flag during writeback
If the folio has no ordered flag, it means it doesn't go through delayed allocation, thus it's definitely an out-of-band one.
If we got one, we go through COW fixup, which will re-dirty the folio with proper handling in another workqueue.
[PROBLEMS OF COW-FIXUP]
Such workaround is a blockage for us to migrate to iomap (it requires extra flags to trace if a folio is dirtied by the fs or not) and I'd argue it's not data checksum safe, since if a folio can be marked dirty without informing the fs, the content can also change at any time.
But with the introduction of pin_user_pages*() during v5.8 merge window, such out-of-band dirty folio such be treated as a bug. Ext4 has treated such case by warning and erroring out even before pin_user_pages*().
Furthermore, there are already proofs that such folio ordered flag tracking can be screwed up by incorrect error handling, check the commit messages of the following commits:
06f364284794 ("btrfs: do proper folio cleanup when cow_file_range() failed") c2b47df81c8e ("btrfs: do proper folio cleanup when run_delalloc_nocow() failed")
[FIXES]
Unlike btrfs, ext4 and xfs (iomap) never bother handling such out-of-band dirty folios.
- Ext4 just warns and errors out
- Iomap always follows the folio/block dirty flags
And there is nothing really COW specific, xfs also supports COW too.
Here we take one step towards ext4 by doing warning and erroring out. But since the cow fixup thing is introduced from the beginning, we keep the old behavior for non-experimental builds, and only do the new warning for experimental builds before we're 100% sure and remove cow fixup.
--- fs/btrfs/extent_io.c | 28 +++++++++++++++++++++++++++- fs/btrfs/inode.c | 15 +++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-)
fs/btrfs/extent_io.c +27 -1
@@ -1442,12 +1442,14 @@ static noinline_for_stack int extent_writepage_io(struct btrfs_inode *inode, start + len <= folio_start + folio_size(folio)); ret =btrfs_writepage_cow_fixup (folio); -if (ret) { +if (ret == -EAGAIN ) {/* Fixup worker will requeue */ folio_redirty_for_writepage (bio_ctrl->wbc, folio);folio_unlock (folio);return 1 ; } +if (ret <0 ) +return ret;for (cur = start; cur < start + len; cur += fs_info->sectorsize)set_bit ((cur - folio_start) >> fs_info->sectorsize_bits, &range_bitmap);
@@ -1551,6 +1553,30 @@ static int extent_writepage(struct folio *folio, struct btrfs_bio_ctrl *bio_ctrl* The proper bitmap can only be initialized until writepage_delalloc(). */ bio_ctrl->submit_bitmap = (unsigned long )-1 ; + +/* +* If the page is dirty but without private set, it's marked dirty +* without informing the fs. +* Nowadays that is a bug, since the introduction of +* pin_user_pages*(). +* +* So here we check if the page has private set to rule out such +* case. +* But we also have a long history of relying on the COW fixup, +* so here we only enable this check for experimental builds until +* we're sure it's safe. +*/ +if (IS_ENABLED (CONFIG_BTRFS_EXPERIMENTAL ) && +unlikely (!folio_test_private (folio))) { +WARN_ON (IS_ENABLED (CONFIG_BTRFS_DEBUG )); +btrfs_err_rl (fs_info, +"root %lld ino %llu folio %llu is marked dirty without notifying the fs" , + inode->root->root_key.objectid, +btrfs_ino (inode),folio_pos (folio)); + ret = -EUCLEAN ; + goto done; + } + ret =set_folio_extent_mapped (folio);if (ret <0 ) goto done;
fs/btrfs/inode.c +15 -0
@@ -2877,6 +2877,21 @@ int btrfs_writepage_cow_fixup(struct folio *folio)if (folio_test_ordered (folio))return 0 ; +/* +* For experimental build, we error out instead of EAGAIN. +* +* We should not hit such out-of-band dirty folios anymore. +*/ +if (IS_ENABLED (CONFIG_BTRFS_EXPERIMENTAL )) { +WARN_ON (IS_ENABLED (CONFIG_BTRFS_DEBUG )); +btrfs_err_rl (fs_info, +"root %lld ino %llu folio %llu is marked dirty without notifying the fs" , +BTRFS_I (inode)->root->root_key.objectid, +btrfs_ino (BTRFS_I (inode)), +folio_pos (folio)); +return -EUCLEAN ; + } +/* * folio_checked is set below when we create a fixup worker for this * folio, don't try to create another one if we're already
Signature · 1 line
2.39.5
Re: [PATCH AUTOSEL 6.14 40/54] btrfs: reject out-of-band dirty folios during writeback
Quoted 3 lines · Sasha Levin
From: Qu Wenruo <[email protected]>
[ Upstream commit
7ca3e84980ef6484a5c6f004aa180b61ce0c37d9]
Please drop this commit from all stable branches, it's relevant only for testing.
Sasha Levin
maintainerRe: [PATCH AUTOSEL 6.14 40/54] btrfs: reject out-of-band dirty folios during writeback
Quoted 7 lines · David Sterba
Quoted 3 lines · Sasha Levin
From: Qu Wenruo <[email protected]>
[ Upstream commit
7ca3e84980ef6484a5c6f004aa180b61ce0c37d9]Please drop this commit from all stable branches, it's relevant only for testing.
Will do, thanks!
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 41/54 btrfs: harden block_group::bg_list against list_del() races
In reply to Sasha LevinFrom: Boris Burkov <[email protected]>
[ Upstream commit 7511e29cf1355b2c47d0effb39e463119913e2f6 ]
As far as I can tell, these calls of list_del_init() on bg_list cannot run concurrently with btrfs_mark_bg_unused() or btrfs_mark_bg_to_reclaim(), as they are in transaction error paths and situations where the block group is readonly.
However, if there is any chance at all of racing with mark_bg_unused(), or a different future user of bg_list, better to be safe than sorry.
Otherwise we risk the following interleaving (bg_list refcount in parens)
T1 (some random op) T2 (btrfs_mark_bg_unused)
!list_empty(&bg->bg_list); (1)
list_del_init(&bg->bg_list); (1)
list_move_tail (1)
btrfs_put_block_group (0)
btrfs_delete_unused_bgs
bg = list_first_entry
list_del_init(&bg->bg_list);
btrfs_put_block_group(bg); (-1)Ultimately, this results in a broken ref count that hits zero one deref early and the real final deref underflows the refcount, resulting in a WARNING.
--- fs/btrfs/extent-tree.c | 8 ++++++++ fs/btrfs/transaction.c | 12 ++++++++++++ 2 files changed, 20 insertions(+)
fs/btrfs/extent-tree.c +8 -0
@@ -2874,7 +2874,15 @@ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans) block_group->length, &trimmed); +/* +* Not strictly necessary to lock, as the block_group should be +* read-only from btrfs_delete_unused_bgs(). +*/ +ASSERT (block_group->ro); +spin_lock (&fs_info->unused_bgs_lock);list_del_init (&block_group->bg_list); +spin_unlock (&fs_info->unused_bgs_lock); +btrfs_unfreeze_block_group (block_group);btrfs_put_block_group (block_group);
fs/btrfs/transaction.c +12 -0
@@ -160,7 +160,13 @@ void btrfs_put_transaction(struct btrfs_transaction *transaction) cache =list_first_entry (&transaction->deleted_bgs, struct btrfs_block_group, bg_list); +/* +* Not strictly necessary to lock, as no other task will be using a +* block_group on the deleted_bgs list during a transaction abort. +*/ +spin_lock (&transaction->fs_info->unused_bgs_lock);list_del_init (&cache->bg_list); +spin_unlock (&transaction->fs_info->unused_bgs_lock);btrfs_unfreeze_block_group (cache);btrfs_put_block_group (cache); }
@@ -2096,7 +2102,13 @@ static void btrfs_cleanup_pending_block_groups(struct btrfs_trans_handle *trans)list_for_each_entry_safe (block_group, tmp, &trans->new_bgs, bg_list) {btrfs_dec_delayed_refs_rsv_bg_inserts (fs_info); +/* +* Not strictly necessary to lock, as no other task will be using a +* block_group on the new_bgs list during a transaction abort. +*/ +spin_lock (&fs_info->unused_bgs_lock);list_del_init (&block_group->bg_list); +spin_unlock (&fs_info->unused_bgs_lock); } }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 42/54 wifi: mt76: mt76x2u: add TP-Link TL-WDN6200 ID to device table
In reply to Sasha LevinFrom: Icenowy Zheng <[email protected]>
[ Upstream commit 06cccc2ebbe6c8a20f714f3a0ff3ff489d3004bb ]
The TP-Link TL-WDN6200 "Driverless" version cards use a MT7612U chipset.
Add the USB ID to mt76x2u driver.
--- drivers/net/wireless/mediatek/mt76/mt76x2/usb.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/mt76x2/usb.c +1 -0
@@ -22,6 +22,7 @@ static const struct usb_device_id mt76x2u_device_table[] = { { USB_DEVICE(0x0846, 0x9053) }, /* Netgear A6210 */ { USB_DEVICE(0x045e, 0x02e6) }, /* XBox One Wireless Adapter */ { USB_DEVICE(0x045e, 0x02fe) }, /* XBox One Wireless Adapter */ + { USB_DEVICE(0x2357, 0x0137) }, /* TP-Link TL-WDN6200 */ { }, };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 43/54 net: vlan: don't propagate flags on open
In reply to Sasha LevinFrom: Stanislav Fomichev <[email protected]>
[ Upstream commit 27b918007d96402aba10ed52a6af8015230f1793 ]
With the device instance lock, there is now a possibility of a deadlock:
[ 1.211455] ============================================
[ 1.211571] WARNING: possible recursive locking detected
[ 1.211687] 6.14.0-rc5-01215-g032756b4ca7a-dirty #5 Not tainted
[ 1.211823] --------------------------------------------
[ 1.211936] ip/184 is trying to acquire lock:
[ 1.212032] ffff8881024a4c30 (&dev->lock){+.+.}-{4:4}, at: dev_set_allmulti+0x4e/0xb0
[ 1.212207]
[ 1.212207] but task is already holding lock:
[ 1.212332] ffff8881024a4c30 (&dev->lock){+.+.}-{4:4}, at: dev_open+0x50/0xb0
[ 1.212487]
[ 1.212487] other info that might help us debug this:
[ 1.212626] Possible unsafe locking scenario:
[ 1.212626]
[ 1.212751] CPU0
[ 1.212815] ----
[ 1.212871] lock(&dev->lock);
[ 1.212944] lock(&dev->lock);
[ 1.213016]
[ 1.213016] *** DEADLOCK ***
[ 1.213016]
[ 1.213143] May be due to missing lock nesting notation
[ 1.213143]
[ 1.213294] 3 locks held by ip/184:
[ 1.213371] #0: ffffffff838b53e0 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_nets_lock+0x1b/0xa0
[ 1.213543] #1: ffffffff84e5fc70 (&net->rtnl_mutex){+.+.}-{4:4}, at: rtnl_nets_lock+0x37/0xa0
[ 1.213727] #2: ffff8881024a4c30 (&dev->lock){+.+.}-{4:4}, at: dev_open+0x50/0xb0
[ 1.213895]
[ 1.213895] stack backtrace:
[ 1.213991] CPU: 0 UID: 0 PID: 184 Comm: ip Not tainted 6.14.0-rc5-01215-g032756b4ca7a-dirty #5
[ 1.213993] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Arch Linux 1.16.3-1-1 04/01/2014
[ 1.213994] Call Trace:
[ 1.213995] <TASK>
[ 1.213996] dump_stack_lvl+0x8e/0xd0
[ 1.214000] print_deadlock_bug+0x28b/0x2a0
[ 1.214020] lock_acquire+0xea/0x2a0
[ 1.214027] __mutex_lock+0xbf/0xd40
[ 1.214038] dev_set_allmulti+0x4e/0xb0 # real_dev->flags & IFF_ALLMULTI
[ 1.214040] vlan_dev_open+0xa5/0x170 # ndo_open on vlandev
[ 1.214042] __dev_open+0x145/0x270
[ 1.214046] __dev_change_flags+0xb0/0x1e0
[ 1.214051] netif_change_flags+0x22/0x60 # IFF_UP vlandev
[ 1.214053] dev_change_flags+0x61/0xb0 # for each device in group from dev->vlan_info
[ 1.214055] vlan_device_event+0x766/0x7c0 # on netdevsim0
[ 1.214058] notifier_call_chain+0x78/0x120
[ 1.214062] netif_open+0x6d/0x90
[ 1.214064] dev_open+0x5b/0xb0 # locks netdevsim0
[ 1.214066] bond_enslave+0x64c/0x1230
[ 1.214075] do_set_master+0x175/0x1e0 # on netdevsim0
[ 1.214077] do_setlink+0x516/0x13b0
[ 1.214094] rtnl_newlink+0xaba/0xb80
[ 1.214132] rtnetlink_rcv_msg+0x440/0x490
[ 1.214144] netlink_rcv_skb+0xeb/0x120
[ 1.214150] netlink_unicast+0x1f9/0x320
[ 1.214153] netlink_sendmsg+0x346/0x3f0
[ 1.214157] __sock_sendmsg+0x86/0xb0
[ 1.214160] ____sys_sendmsg+0x1c8/0x220
[ 1.214164] ___sys_sendmsg+0x28f/0x2d0
[ 1.214179] __x64_sys_sendmsg+0xef/0x140
[ 1.214184] do_syscall_64+0xec/0x1d0
[ 1.214190] entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 1.214191] RIP: 0033:0x7f2d1b4a7e56Device setup:
netdevsim0 (down)
^ ^
bond netdevsim1.100@netdevsim1 allmulticast=on (down)
When we enslave the lower device (netdevsim0) which has a vlan, we propagate vlan's allmuti/promisc flags during ndo_open. This causes (re)locking on of the real_dev.
Propagate allmulti/promisc on flags change, not on the open. There is a slight semantics change that vlans that are down now propagate the flags, but this seems unlikely to result in the real issues.
Reproducer:
echo 0 1 > /sys/bus/netdevsim/new_device
dev_path=$(ls -d /sys/bus/netdevsim/devices/netdevsim0/net/*) dev=$(echo $dev_path | rev | cut -d/ -f1 | rev)
ip link set dev $dev name netdevsim0
ip link set dev netdevsim0 up
ip link add link netdevsim0 name netdevsim0.100 type vlan id 100 ip link set dev netdevsim0.100 allmulticast on down ip link add name bond1 type bond mode 802.3ad
ip link set dev netdevsim0 down
ip link set dev netdevsim0 master bond1
ip link set dev bond1 up
ip link show
--- net/8021q/vlan_dev.c | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-)
net/8021q/vlan_dev.c +4 -27
@@ -273,17 +273,6 @@ static int vlan_dev_open(struct net_device *dev) goto out; } -if (dev->flags &IFF_ALLMULTI ) { - err =dev_set_allmulti (real_dev,1 ); -if (err <0 ) - goto del_unicast; - } -if (dev->flags &IFF_PROMISC ) { - err =dev_set_promiscuity (real_dev,1 ); -if (err <0 ) - goto clear_allmulti; - } -ether_addr_copy (vlan->real_dev_addr, real_dev->dev_addr);if (vlan->flags &VLAN_FLAG_GVRP )
@@ -297,12 +286,6 @@ static int vlan_dev_open(struct net_device *dev)netif_carrier_on (dev);return 0 ; -clear_allmulti: -if (dev->flags &IFF_ALLMULTI ) -dev_set_allmulti (real_dev,-1 ); -del_unicast: -if (!ether_addr_equal (dev->dev_addr, real_dev->dev_addr)) -dev_uc_del (real_dev, dev->dev_addr); out:netif_carrier_off (dev);return err;
@@ -315,10 +298,6 @@ static int vlan_dev_stop(struct net_device *dev)dev_mc_unsync (real_dev, dev);dev_uc_unsync (real_dev, dev); -if (dev->flags &IFF_ALLMULTI ) -dev_set_allmulti (real_dev,-1 ); -if (dev->flags &IFF_PROMISC ) -dev_set_promiscuity (real_dev,-1 );if (!ether_addr_equal (dev->dev_addr, real_dev->dev_addr))dev_uc_del (real_dev, dev->dev_addr);
@@ -490,12 +469,10 @@ static void vlan_dev_change_rx_flags(struct net_device *dev, int change) {struct net_device *real_dev =vlan_dev_priv (dev)->real_dev; -if (dev->flags &IFF_UP ) { -if (change &IFF_ALLMULTI ) -dev_set_allmulti (real_dev, dev->flags &IFF_ALLMULTI ?1 :-1 ); -if (change &IFF_PROMISC ) -dev_set_promiscuity (real_dev, dev->flags &IFF_PROMISC ?1 :-1 ); - } +if (change &IFF_ALLMULTI ) +dev_set_allmulti (real_dev, dev->flags &IFF_ALLMULTI ?1 :-1 ); +if (change &IFF_PROMISC ) +dev_set_promiscuity (real_dev, dev->flags &IFF_PROMISC ?1 :-1 ); }static void vlan_dev_set_rx_mode (struct net_device *vlan_dev)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 44/54 tracing: fix return value in __ftrace_event_enable_disable for TRACE_REG_UNREGISTER
In reply to Sasha LevinFrom: Gabriele Paoloni <[email protected]>
[ Upstream commit 0c588ac0ca6c22b774d9ad4a6594681fdfa57d9d ]
When __ftrace_event_enable_disable invokes the class callback to unregister the event, the return value is not reported up to the caller, hence leading to event unregister failures being silently ignored.
This patch assigns the ret variable to the invocation of the event unregister callback, so that its return value is stored and reported to the caller, and it raises a warning in case of error.
--- kernel/trace/trace_events.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/trace/trace_events.c +3 -1
@@ -790,7 +790,9 @@ static int __ftrace_event_enable_disable(struct trace_event_file *file,clear_bit (EVENT_FILE_FL_RECORDED_TGID_BIT , &file->flags); } - call->class->reg (call,TRACE_REG_UNREGISTER , file); + ret = call->class->reg (call,TRACE_REG_UNREGISTER , file); + +WARN_ON_ONCE (ret); }/* If in SOFT_MODE, just set the SOFT_DISABLE_BIT, else clear it */ if (file->flags &EVENT_FILE_FL_SOFT_MODE )
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 45/54 Bluetooth: btusb: Add new VID/PID for WCN785x
In reply to Sasha LevinFrom: Dorian Cruveiller <[email protected]>
[ Upstream commit c7629ccfa175e16bb44a60c469214e1a6051f63d ]
Add VID 0489 & PID e10d for Qualcomm WCN785x USB Bluetooth chip.
The information in /sys/kernel/debug/usb/devices about the Bluetooth device is listed as the below.
T: Bus=01 Lev=01 Prnt=01 Port=03 Cnt=03 Dev#= 4 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=0489 ProdID=e10d Rev= 0.01 C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms I: If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 63 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 63 Ivl=1ms I: If#= 1 Alt= 7 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 65 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 65 Ivl=1ms
--- drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -376,6 +376,8 @@ static const struct usb_device_id quirks_table[] = { BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x0489, 0xe0f3), .driver_info = BTUSB_QCA_WCN6855 | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe10d), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x13d3, 0x3623), .driver_info = BTUSB_QCA_WCN6855 | BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x2c7c, 0x0130), .driver_info = BTUSB_QCA_WCN6855 |
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 46/54 Bluetooth: btintel_pcie: Add device id of Whale Peak
In reply to Sasha LevinFrom: Kiran K <[email protected]>
[ Upstream commit 6b8c05e52d66e4fe4ab1df4c6e15f339ecd9aa51 ]
Add device of Whale Peak.
Output of sudo lspci -v -s 00:14.7:
00:14.7 Bluetooth: Intel Corporation Device e476
Subsystem: Intel Corporation Device 0011
Flags: bus master, fast devsel, latency 0, IRQ 16, IOMMU group 11 Memory at 11011c30000 (64-bit, non-prefetchable) [size=16K]
Capabilities: [c8] Power Management version 3
Capabilities: [d0] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [40] Express Root Complex Integrated Endpoint, MSI 00
Capabilities: [80] MSI-X: Enable+ Count=32 Masked-
Capabilities: [100] Latency Tolerance Reporting
Kernel driver in use: btintel_pcie
Kernel modules: btintel_pcie
--- drivers/bluetooth/btintel_pcie.c | 1 + 1 file changed, 1 insertion(+)
drivers/bluetooth/btintel_pcie.c +1 -0
@@ -36,6 +36,7 @@/* Intel Bluetooth PCIe device id table */ static const struct pci_device_id btintel_pcie_table[] = { {BTINTEL_PCI_DEVICE (0xA876 ,PCI_ANY_ID ) }, + {BTINTEL_PCI_DEVICE (0xE476 ,PCI_ANY_ID ) }, {0 } };MODULE_DEVICE_TABLE (pci, btintel_pcie_table);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 47/54 Bluetooth: btusb: Add 13 USB device IDs for Qualcomm WCN785x
In reply to Sasha LevinFrom: Zijun Hu <[email protected]>
[ Upstream commit 2dd1c1eee3e496fcc16971be4db5bb792a36025c ]
Add 13 USB device IDs for Qualcomm WCN785x, and these IDs are extracted from Windows driver inf file for various types of WoS (Windows on Snapdragon) laptop.
--- drivers/bluetooth/btusb.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/bluetooth/btusb.c +26 -0
@@ -376,12 +376,38 @@ static const struct usb_device_id quirks_table[] = { BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x0489, 0xe0f3), .driver_info = BTUSB_QCA_WCN6855 | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe100), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe103), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe10a), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x0489, 0xe10d), .driver_info = BTUSB_QCA_WCN6855 | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe11b), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe11c), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe11f), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe141), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe14a), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe14b), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe14d), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x13d3, 0x3623), .driver_info = BTUSB_QCA_WCN6855 | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x13d3, 0x3624), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x2c7c, 0x0130), .driver_info = BTUSB_QCA_WCN6855 | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x2c7c, 0x0131), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x2c7c, 0x0132), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, /* Broadcom BCM2035 */ { USB_DEVICE(0x0a5c, 0x2009), .driver_info = BTUSB_BCM92035 },
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 48/54 Bluetooth: hci_uart: fix race during initialization
In reply to Sasha LevinFrom: Arseniy Krasnov <[email protected]>
[ Upstream commit 366ceff495f902182d42b6f41525c2474caf3f9a ]
'hci_register_dev()' calls power up function, which is executed by kworker - 'hci_power_on()'. This function does access to bluetooth chip using callbacks from 'hci_ldisc.c', for example 'hci_uart_send_frame()'. Now 'hci_uart_send_frame()' checks 'HCI_UART_PROTO_READY' bit set, and if not - it fails. Problem is that 'HCI_UART_PROTO_READY' is set after 'hci_register_dev()', and there is tiny chance that 'hci_power_on()' will be executed before setting this bit. In that case HCI init logic fails.
Patch moves setting of 'HCI_UART_PROTO_READY' before calling function 'hci_uart_register_dev()'.
--- drivers/bluetooth/hci_ldisc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bluetooth/hci_ldisc.c +2 -1
@@ -707,12 +707,13 @@ static int hci_uart_set_proto(struct hci_uart *hu, int id) hu->proto = p; +set_bit (HCI_UART_PROTO_READY , &hu->flags); + err =hci_uart_register_dev (hu);if (err) {return err; } -set_bit (HCI_UART_PROTO_READY , &hu->flags);return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 49/54 Bluetooth: btusb: Add 2 HWIDs for MT7922
In reply to Sasha LevinFrom: Jiande Lu <[email protected]>
[ Upstream commit a88643b7e48506777e175e80c902c727ddd90851 ]
Add below HWIDs for MediaTek MT7922 USB Bluetooth chip. VID 0x0489, PID 0xe152
VID 0x0489, PID 0xe153
Patch has been tested successfully and controller is recognized device pair successfully.
MT7922 module bring up message as below.
Bluetooth: Core ver 2.22
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
Bluetooth: L2CAP socket layer initialized
Bluetooth: SCO socket layer initialized
Bluetooth: hci0: HW/SW Version: 0x008a008a, Build Time: 20241106163512
Bluetooth: hci0: Device setup in 2284925 usecs
Bluetooth: hci0: HCI Enhanced Setup Synchronous Connection command is advertised, but not supported.
Bluetooth: hci0: AOSP extensions version v1.00
Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Bluetooth: BNEP filters: protocol multicast
Bluetooth: BNEP socket layer initialized
Bluetooth: MGMT ver 1.22
Bluetooth: RFCOMM TTY layer initialized
Bluetooth: RFCOMM socket layer initialized
Bluetooth: RFCOMM ver 1.11
--- drivers/bluetooth/btusb.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/bluetooth/btusb.c +4 -0
@@ -668,6 +668,10 @@ static const struct usb_device_id quirks_table[] = { BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x0489, 0xe102), .driver_info = BTUSB_MEDIATEK | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe152), .driver_info = BTUSB_MEDIATEK | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe153), .driver_info = BTUSB_MEDIATEK | + BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x04ca, 0x3804), .driver_info = BTUSB_MEDIATEK | BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x04ca, 0x38e4), .driver_info = BTUSB_MEDIATEK |
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 50/54 Bluetooth: hci_qca: use the power sequencer for wcn6750
In reply to Sasha LevinFrom: Janaki Ramaiah Thota <[email protected]>
[ Upstream commit 852cfdc7a5a5af54358325c1e0f490cc178d9664 ]
Older boards are having entry "enable-gpios" in dts, we can safely assume latest boards which are supporting PMU node enrty will support power sequencer.
--- drivers/bluetooth/hci_qca.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/hci_qca.c +1 -1
@@ -2359,6 +2359,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)switch (qcadev->btsoc_type) {case QCA_WCN6855 :case QCA_WCN7850 : +case QCA_WCN6750 :if (!device_property_present (&serdev->dev,"enable-gpios" )) {/* * Backward compatibility with old DT sources. If the
@@ -2378,7 +2379,6 @@ static int qca_serdev_probe(struct serdev_device *serdev)case QCA_WCN3990 :case QCA_WCN3991 :case QCA_WCN3998 : -case QCA_WCN6750 : qcadev->bt_power->dev = &serdev->dev; err =qca_init_regulators (qcadev->bt_power, data->vregs, data->num_vregs);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 51/54 Bluetooth: qca: simplify WCN399x NVM loading
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 1cc41b5092e3aa511454ec882c525af311bee631 ]
The WCN399x code has two separate cases for loading the NVM data. In preparation to adding support for WCN3950, which also requires similar quirk, split the "variant" to be specified explicitly and merge two snprintfs into a single one.
--- drivers/bluetooth/btqca.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/bluetooth/btqca.c +6 -7
@@ -785,6 +785,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, const char *firmware_name, const char *rampatch_name) { struct qca_fw_config config = {}; +const char *variant ="" ;int err;u8 rom_ver =0 ;u32 soc_ver;
@@ -883,13 +884,11 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,case QCA_WCN3990 :case QCA_WCN3991 :case QCA_WCN3998 : -if (le32_to_cpu (ver.soc_id) ==QCA_WCN3991_SOC_ID ) { -snprintf (config.fwname,sizeof (config.fwname), -"qca/crnv%02xu.bin" , rom_ver); - }else { -snprintf (config.fwname,sizeof (config.fwname), -"qca/crnv%02x.bin" , rom_ver); - } +if (le32_to_cpu (ver.soc_id) ==QCA_WCN3991_SOC_ID ) + variant ="u" ; + +snprintf (config.fwname,sizeof (config.fwname), +"qca/crnv%02x%s.bin" , rom_ver, variant);break ;case QCA_WCN3988 : snprintf(config.fwname, sizeof(config.fwname),
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 52/54 Bluetooth: qca: add WCN3950 support
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit d5712c511cb358ab87f1e884848419ec76a67ab2 ]
WCN3950 is another example of the WCN39xx BT/WiFI family of chips. It requires different firmware files and has different current requirements, so add it as a separate SoC type.
The firmware for these chips has been recently added to the linux-firmware repository and will be a part of the upcoming release:
- qca/cmbtfw12.tlv
- qca/cmbtfw13.tlv
- qca/cmnv12.bin
- qca/cmnv13.bin
- qca/cmnv13s.bin
- qca/cmnv13t.bin
--- drivers/bluetooth/btqca.c | 14 ++++++++++++++ drivers/bluetooth/btqca.h | 4 ++++ drivers/bluetooth/hci_qca.c | 25 +++++++++++++++++++++++++ 3 files changed, 43 insertions(+)
drivers/bluetooth/btqca.c +14 -0
@@ -816,6 +816,10 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,snprintf (config.fwname,sizeof (config.fwname),"qca/%s" , rampatch_name); }else {switch (soc_type) { +case QCA_WCN3950 : +snprintf (config.fwname,sizeof (config.fwname), +"qca/cmbtfw%02x.tlv" , rom_ver); +break ;case QCA_WCN3990 :case QCA_WCN3991 :case QCA_WCN3998 :
@@ -881,6 +885,15 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, } }else {switch (soc_type) { +case QCA_WCN3950 : +if (le32_to_cpu (ver.soc_id) ==QCA_WCN3950_SOC_ID_T ) + variant ="t" ; +else if (le32_to_cpu (ver.soc_id) ==QCA_WCN3950_SOC_ID_S ) + variant ="u" ; + +snprintf (config.fwname,sizeof (config.fwname), +"qca/cmnv%02x%s.bin" , rom_ver, variant); +break ;case QCA_WCN3990 :case QCA_WCN3991 :case QCA_WCN3998 :
@@ -947,6 +960,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,* VsMsftOpCode. */ switch (soc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
drivers/bluetooth/btqca.h +4 -0
@@ -41,6 +41,9 @@#define QCA_WCN3991_SOC_ID 0x40014320 +#define QCA_WCN3950_SOC_ID_T 0x40074130 +#define QCA_WCN3950_SOC_ID_S 0x40075130 +/* QCA chipset version can be decided by patch and SoC * version, combination with upper 2 bytes from SoC * and lower 2 bytes from patch will be used.
@@ -145,6 +148,7 @@ enum qca_btsoc_type {QCA_INVALID =-1 ,QCA_AR3002 ,QCA_ROME , +QCA_WCN3950 ,QCA_WCN3988 ,QCA_WCN3990 , QCA_WCN3998,
drivers/bluetooth/hci_qca.c +25 -0
@@ -623,6 +623,7 @@ static int qca_open(struct hci_uart *hu) qcadev =serdev_device_get_drvdata (hu->serdev);switch (qcadev->btsoc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1366,6 +1367,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate)/* Give the controller time to process the request */ switch (qca_soc_type (hu)) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1452,6 +1454,7 @@ static unsigned int qca_get_speed(struct hci_uart *hu,static int qca_check_speeds (struct hci_uart *hu) {switch (qca_soc_type (hu)) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1494,6 +1497,7 @@ static int qca_set_speed(struct hci_uart *hu, enum qca_speed_type speed_type)* changing the baudrate of chip and host. */ switch (soc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1528,6 +1532,7 @@ static int qca_set_speed(struct hci_uart *hu, enum qca_speed_type speed_type) error:switch (soc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1746,6 +1751,7 @@ static int qca_regulator_init(struct hci_uart *hu) }switch (soc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1776,6 +1782,7 @@ static int qca_regulator_init(struct hci_uart *hu)qca_set_speed (hu,QCA_INIT_SPEED );switch (soc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1807,6 +1814,7 @@ static int qca_power_on(struct hci_dev *hdev)return 0 ;switch (soc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1891,6 +1899,7 @@ static int qca_setup(struct hci_uart *hu) soc_name ="qca2066" ;break ; +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1925,6 +1934,7 @@ static int qca_setup(struct hci_uart *hu)clear_bit (QCA_SSR_TRIGGERED , &qca->flags);switch (soc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1958,6 +1968,7 @@ static int qca_setup(struct hci_uart *hu) }switch (soc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -2046,6 +2057,17 @@ static const struct hci_uart_proto qca_proto = { .dequeue = qca_dequeue, }; +static const struct qca_device_data qca_soc_data_wcn3950__maybe_unused = { + .soc_type =QCA_WCN3950 , + .vregs = (struct qca_vreg []) { + {"vddio" ,15000 }, + {"vddxo" ,60000 }, + {"vddrf" ,155000 }, + {"vddch0" ,585000 }, + }, + .num_vregs =4 , +}; +static const struct qca_device_data qca_soc_data_wcn3988__maybe_unused = { .soc_type =QCA_WCN3988 , .vregs = (struct qca_vreg []) {
@@ -2338,6 +2360,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) qcadev->btsoc_type =QCA_ROME ;switch (qcadev->btsoc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -2375,6 +2398,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)break ; } fallthrough; +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -2683,6 +2707,7 @@ static const struct of_device_id qca_bluetooth_of_match[] = { { .compatible = "qcom,qca6174-bt" }, { .compatible = "qcom,qca6390-bt", .data = &qca_soc_data_qca6390}, { .compatible = "qcom,qca9377-bt" }, + { .compatible = "qcom,wcn3950-bt", .data = &qca_soc_data_wcn3950}, { .compatible = "qcom,wcn3988-bt", .data = &qca_soc_data_wcn3988}, { .compatible = "qcom,wcn3990-bt", .data = &qca_soc_data_wcn3990}, { .compatible = "qcom,wcn3991-bt", .data = &qca_soc_data_wcn3991},
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 53/54 Bluetooth: Add quirk for broken READ_VOICE_SETTING
In reply to Sasha LevinFrom: Pedro Nishiyama <[email protected]>
[ Upstream commit ff26b2dd6568392f60fa67a4e58279938025c3af ]
Some fake controllers cannot be initialized because they return a smaller report than expected for READ_VOICE_SETTING.
--- include/net/bluetooth/hci.h | 8 ++++++++ include/net/bluetooth/hci_core.h | 4 ++++ net/bluetooth/hci_sync.c | 3 +++ 3 files changed, 15 insertions(+)
include/net/bluetooth/hci.h +8 -0
@@ -354,6 +354,14 @@ enum {* during the hdev->setup vendor callback. */ HCI_QUIRK_FIXUP_LE_EXT_ADV_REPORT_PHY , + +/* When this quirk is set, the HCI_OP_READ_VOICE_SETTING command is +* skipped. This is required for a subset of the CSR controller clones +* which erroneously claim to support it. +* +* This quirk must be set before hci_register_dev is called. +*/ + HCI_QUIRK_BROKEN_READ_VOICE_SETTING, };/* HCI device flags */
include/net/bluetooth/hci_core.h +4 -0
@@ -1925,6 +1925,10 @@ void hci_conn_del_sysfs(struct hci_conn *conn); ((dev)->commands[20 ] &0x10 && \ !test_bit(HCI_QUIRK_BROKEN_READ_ENC_KEY_SIZE, &hdev->quirks)) +#define read_voice_setting_capable (dev) \ + ((dev)->commands[9] & 0x04 && \ + !test_bit(HCI_QUIRK_BROKEN_READ_VOICE_SETTING, &(dev)->quirks)) +/* Use enhanced synchronous connection if command is supported and its quirk * has not been set. */
net/bluetooth/hci_sync.c +3 -0
@@ -3696,6 +3696,9 @@ static int hci_read_local_name_sync(struct hci_dev *hdev)/* Read Voice Setting */ static int hci_read_voice_setting_sync (struct hci_dev *hdev) { +if (!read_voice_setting_capable (hdev)) +return 0 ; +return __hci_cmd_sync_status (hdev,HCI_OP_READ_VOICE_SETTING ,0 ,NULL ,HCI_CMD_TIMEOUT ); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 54/54 Bluetooth: Add quirk for broken READ_PAGE_SCAN_TYPE
In reply to Sasha LevinFrom: Pedro Nishiyama <[email protected]>
[ Upstream commit 127881334eaad639e0a19a399ee8c91d6c9dc982 ]
Some fake controllers cannot be initialized because they return a smaller report than expected for READ_PAGE_SCAN_TYPE.
--- include/net/bluetooth/hci.h | 8 ++++++++ net/bluetooth/hci_sync.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +8 -0
@@ -362,6 +362,14 @@ enum {* This quirk must be set before hci_register_dev is called. */ HCI_QUIRK_BROKEN_READ_VOICE_SETTING , + +/* When this quirk is set, the HCI_OP_READ_PAGE_SCAN_TYPE command is +* skipped. This is required for a subset of the CSR controller clones +* which erroneously claim to support it. +* +* This quirk must be set before hci_register_dev is called. +*/ + HCI_QUIRK_BROKEN_READ_PAGE_SCAN_TYPE, };/* HCI device flags */
net/bluetooth/hci_sync.c +2 -1
@@ -4132,7 +4132,8 @@ static int hci_read_page_scan_type_sync(struct hci_dev *hdev)* support the Read Page Scan Type command. Check support for * this command in the bit mask of supported commands. */ -if (!(hdev->commands[13 ] &0x01 )) +if (!(hdev->commands[13 ] &0x01 ) || +test_bit (HCI_QUIRK_BROKEN_READ_PAGE_SCAN_TYPE , &hdev->quirks))return 0 ; return __hci_cmd_sync_status(hdev, HCI_OP_READ_PAGE_SCAN_TYPE,
Signature · 1 line
2.39.5