5.19.17-rc1 review
Subsystems (9)
Greg Kroah-Hartman
maintainerPATCH 520/717 crypto: qat - fix DMA transfer direction
In reply to Greg Kroah-HartmanFrom: Damian Muszynski <[email protected]>
[ Upstream commit cf5bb835b7c8a5fee7f26455099cca7feb57f5e9 ]
When CONFIG_DMA_API_DEBUG is selected, while running the crypto self test on the QAT crypto algorithms, the function add_dma_entry() reports a warning similar to the one below, saying that overlapping mappings are not supported. This occurs in tests where the input and the output scatter list point to the same buffers (i.e. two different scatter lists which point to the same chunks of memory).
The logic that implements the mapping uses the flag DMA_BIDIRECTIONAL for both the input and the output scatter lists which leads to overlapped write mappings. These are not supported by the DMA layer.
Fix by specifying the correct DMA transfer directions when mapping buffers. For in-place operations where the input scatter list matches the output scatter list, buffers are mapped once with DMA_BIDIRECTIONAL, otherwise input buffers are mapped using the flag DMA_TO_DEVICE and output buffers are mapped with DMA_FROM_DEVICE. Overlapping a read mapping with a write mapping is a valid case in dma-coherent devices like QAT.
The function that frees and unmaps the buffers, qat_alg_free_bufl() has been changed accordingly to the changes to the mapping function.
DMA-API: 4xxx 0000:06:00.0: cacheline tracking EEXIST, overlapping mappings aren't supported
WARNING: CPU: 53 PID: 4362 at kernel/dma/debug.c:570 add_dma_entry+0x1e9/0x270 ... Call Trace: dma_map_page_attrs+0x82/0x2d0 ? preempt_count_add+0x6a/0xa0 qat_alg_sgl_to_bufl+0x45b/0x990 [intel_qat] qat_alg_aead_dec+0x71/0x250 [intel_qat] crypto_aead_decrypt+0x3d/0x70 test_aead_vec_cfg+0x649/0x810 ? number+0x310/0x3a0 ? vsnprintf+0x2a3/0x550 ? scnprintf+0x42/0x70 ? valid_sg_divisions.constprop.0+0x86/0xa0 ? test_aead_vec+0xdf/0x120 test_aead_vec+0xdf/0x120 alg_test_aead+0x185/0x400 alg_test+0x3d8/0x500 ? crypto_acomp_scomp_free_ctx+0x30/0x30 ? __schedule+0x32a/0x12a0 ? ttwu_queue_wakelist+0xbf/0x110 ? _raw_spin_unlock_irqrestore+0x23/0x40 ? try_to_wake_up+0x83/0x570 ? _raw_spin_unlock_irqrestore+0x23/0x40 ? __set_cpus_allowed_ptr_locked+0xea/0x1b0 ? crypto_acomp_scomp_free_ctx+0x30/0x30 cryptomgr_test+0x27/0x50 kthread+0xe6/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30
--- drivers/crypto/qat/qat_common/qat_algs.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/crypto/qat/qat_common/qat_algs.c +12 -6
@@ -673,11 +673,14 @@ static void qat_alg_free_bufl(struct qat_crypto_instance *inst,dma_addr_t blpout = qat_req->buf.bloutp;size_t sz = qat_req->buf.sz;size_t sz_out = qat_req->buf.sz_out; +int bl_dma_dir;int i; + bl_dma_dir = blp != blpout ?DMA_TO_DEVICE :DMA_BIDIRECTIONAL ; +for (i =0 ; i < bl->num_bufs; i++)dma_unmap_single (dev, bl->bufers[i].addr, - bl->bufers[i].len,DMA_BIDIRECTIONAL ); + bl->bufers[i].len, bl_dma_dir);dma_unmap_single (dev, blp, sz,DMA_TO_DEVICE );
@@ -691,7 +694,7 @@ static void qat_alg_free_bufl(struct qat_crypto_instance *inst,for (i = bufless; i < blout->num_bufs; i++) {dma_unmap_single (dev, blout->bufers[i].addr, blout->bufers[i].len, -DMA_BIDIRECTIONAL ); +DMA_FROM_DEVICE ); }dma_unmap_single (dev, blpout, sz_out,DMA_TO_DEVICE );
@@ -716,6 +719,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst,struct scatterlist *sg;size_t sz_out, sz =struct_size (bufl, bufers, n);int node =dev_to_node (&GET_DEV (inst->accel_dev)); +int bufl_dma_dir;if (unlikely (!n))return -EINVAL ;
@@ -733,6 +737,8 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, qat_req->buf.sgl_src_valid = true; } + bufl_dma_dir = sgl != sglout ?DMA_TO_DEVICE :DMA_BIDIRECTIONAL ; +for_each_sg (sgl, sg, n, i) bufl->bufers[i].addr =DMA_MAPPING_ERROR ;
@@ -744,7 +750,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, bufl->bufers[y].addr =dma_map_single (dev,sg_virt (sg), sg->length, -DMA_BIDIRECTIONAL ); + bufl_dma_dir); bufl->bufers[y].len = sg->length;if (unlikely (dma_mapping_error (dev, bufl->bufers[y].addr))) goto err_in;
@@ -787,7 +793,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, bufers[y].addr =dma_map_single (dev,sg_virt (sg), sg->length, -DMA_BIDIRECTIONAL ); +DMA_FROM_DEVICE );if (unlikely (dma_mapping_error (dev, bufers[y].addr))) goto err_out; bufers[y].len = sg->length;
@@ -817,7 +823,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst,if (!dma_mapping_error (dev, buflout->bufers[i].addr))dma_unmap_single (dev, buflout->bufers[i].addr, buflout->bufers[i].len, -DMA_BIDIRECTIONAL ); +DMA_FROM_DEVICE );if (!qat_req->buf.sgl_dst_valid)kfree (buflout);
@@ -831,7 +837,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst,if (!dma_mapping_error (dev, bufl->bufers[i].addr))dma_unmap_single (dev, bufl->bufers[i].addr, bufl->bufers[i].len, -DMA_BIDIRECTIONAL ); + bufl_dma_dir);if (!qat_req->buf.sgl_src_valid)kfree (bufl);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 496/717 powerpc/pci_dn: Add missing of_node_put()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 110a1fcb6c4d55144d8179983a475f17a1d6f832 ]
In pci_add_device_node_info(), use of_node_put() to drop the reference to 'parent' returned by of_get_parent() to keep refcount balance.
--- arch/powerpc/kernel/pci_dn.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/kernel/pci_dn.c +1 -0
@@ -330,6 +330,7 @@ struct pci_dn *pci_add_device_node_info(struct pci_controller *hose,INIT_LIST_HEAD (&pdn->list); parent =of_get_parent (dn); pdn->parent = parent ?PCI_DN (parent) :NULL ; +of_node_put (parent);if (pdn->parent)list_add_tail (&pdn->list, &pdn->parent->child_list);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 536/717 f2fs: fix race condition on setting FI_NO_EXTENT flag
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit 07725adc55c0a414c10acb5c8c86cea34b95ddef ]
The following scenarios exist.
process A: process B:
->f2fs_drop_extent_tree ->f2fs_update_extent_cache_range
->f2fs_update_extent_tree_range
->write_lock
->set_inode_flag
->is_inode_flag_set
->__free_extent_tree // Shouldn't
// have been
// cleaned up
// here->write_lock
In this case, the "FI_NO_EXTENT" flag is set between f2fs_update_extent_tree_range and is_inode_flag_set by other process. it leads to clearing the whole exten tree which should not have happened. And we fix it by move the setting it to the range of write_lock.
--- fs/f2fs/extent_cache.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/f2fs/extent_cache.c +1 -2
@@ -804,9 +804,8 @@ void f2fs_drop_extent_tree(struct inode *inode)if (!f2fs_may_extent_tree (inode))return ; -set_inode_flag (inode,FI_NO_EXTENT ); -write_lock (&et->lock); +set_inode_flag (inode,FI_NO_EXTENT );__free_extent_tree (sbi, et);if (et->largest.len) { et->largest.len =0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 499/717 powerpc: Fix fallocate and fadvise64_64 compat parameter combination
In reply to Greg Kroah-HartmanFrom: Rohan McLure <[email protected]>
[ Upstream commit 016ff72bd2090903715c0f9422a44afbb966f4ee ]
As reported[1] by Arnd, the arch-specific fadvise64_64 and fallocate compatibility handlers assume parameters are passed with 32-bit big-endian ABI. This affects the assignment of odd-even parameter pairs to the high or low words of a 64-bit syscall parameter.
Fix fadvise64_64 fallocate compat handlers to correctly swap upper/lower 32 bits conditioned on endianness.
A future patch will replace the arch-specific compat fallocate with an asm-generic implementation. This patch is intended for ease of back-port.
[1]: https://lore.kernel.org/all/[email protected]/
--- arch/powerpc/include/asm/syscalls.h | 12 ++++++++++++ arch/powerpc/kernel/sys_ppc32.c | 14 +------------- arch/powerpc/kernel/syscalls.c | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-)
arch/powerpc/include/asm/syscalls.h +12 -0
@@ -8,6 +8,18 @@#include <linux/types.h> #include <linux/compat.h> +/* +* long long munging: +* The 32 bit ABI passes long longs in an odd even register pair. +* High and low parts are swapped depending on endian mode, +* so define a macro (similar to mips linux32) to handle that. +*/ +#ifdef __LITTLE_ENDIAN__ +#define merge_64 (low, high) (((u64)high << 32) | low) +#else +#define merge_64 (high, low) (((u64)high << 32) | low) +#endif +struct rtas_args ; asmlinkage long sys_mmap(unsigned long addr, size_t len,
arch/powerpc/kernel/sys_ppc32.c +1 -13
@@ -56,18 +56,6 @@ unsigned long compat_sys_mmap2(unsigned long addr, size_t len,return sys_mmap (addr, len, prot, flags, fd, pgoff <<12 ); } -/* -* long long munging: -* The 32 bit ABI passes long longs in an odd even register pair. -* High and low parts are swapped depending on endian mode, -* so define a macro (similar to mips linux32) to handle that. -*/ -#ifdef __LITTLE_ENDIAN__ -#define merge_64 (low, high) ((u64)high << 32) | low -#else -#define merge_64 (high, low) ((u64)high << 32) | low -#endif -compat_ssize_t compat_sys_pread64 (unsigned int fd,char __user *ubuf,compat_size_t count,u32 reg6,u32 pos1,u32 pos2) {
@@ -94,7 +82,7 @@ asmlinkage int compat_sys_truncate64(const char __user * path, u32 reg4,asmlinkage long compat_sys_fallocate (int fd,int mode,u32 offset1,u32 offset2,u32 len1,u32 len2) { -return ksys_fallocate (fd, mode, ((loff_t )offset1 <<32 ) | offset2, +return ksys_fallocate (fd, mode,merge_64 (offset1, offset2),merge_64 (len1, len2)); }
arch/powerpc/kernel/syscalls.c +2 -2
@@ -98,8 +98,8 @@ long ppc64_personality(unsigned long personality)long ppc_fadvise64_64 (int fd,int advice,u32 offset_high,u32 offset_low,u32 len_high,u32 len_low) { -return ksys_fadvise64_64 (fd, (u64 )offset_high <<32 | offset_low, - (u64 )len_high <<32 | len_low, advice); +return ksys_fadvise64_64 (fd,merge_64 (offset_high, offset_low), +merge_64 (len_high, len_low), advice); }SYSCALL_DEFINE0 (switch_endian)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 537/717 f2fs: fix to account FS_CP_DATA_IO correctly
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit d80afefb17e01aa0c46a8eebc01882e0ebd8b0f6 ]
f2fs_inode_info.cp_task was introduced for FS_CP_DATA_IO accounting since commit b0af6d491a6b ("f2fs: add app/fs io stat").
However, cp_task usage coverage has been increased due to below commits:
commit 040d2bb318d1 ("f2fs: fix to avoid deadloop if data_flush is on") commit 186857c5a14a ("f2fs: fix potential recursive call when enabling data_flush")
So that, if data_flush mountoption is on, when data flush was triggered from background, the IO from data flush will be accounted as checkpoint IO type incorrectly.
In order to fix this issue, this patch splits cp_task into two:
a) cp_task: used for IO accounting
b) wb_task: used to avoid deadlock
--- fs/f2fs/checkpoint.c | 13 +++++++++---- fs/f2fs/data.c | 4 ++-- fs/f2fs/f2fs.h | 4 +++- fs/f2fs/segment.c | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-)
fs/f2fs/checkpoint.c +9 -4
@@ -1063,7 +1063,8 @@ void f2fs_remove_dirty_inode(struct inode *inode)spin_unlock (&sbi->inode_lock[type]); } -int f2fs_sync_dirty_inodes (struct f2fs_sb_info *sbi,enum inode_type type) +int f2fs_sync_dirty_inodes (struct f2fs_sb_info *sbi,enum inode_type type, +bool from_cp) {struct list_head *head;struct inode *inode;
@@ -1098,11 +1099,15 @@ int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type)if (inode) {unsigned long cur_ino = inode->i_ino; -F2FS_I (inode)->cp_task = current; +if (from_cp) +F2FS_I (inode)->cp_task = current; +F2FS_I (inode)->wb_task = current;filemap_fdatawrite (inode->i_mapping); -F2FS_I (inode)->cp_task =NULL ; +F2FS_I (inode)->wb_task =NULL ; +if (from_cp) +F2FS_I (inode)->cp_task =NULL ;iput (inode);/* We need to give cpu to another writers. */
@@ -1231,7 +1236,7 @@ static int block_operations(struct f2fs_sb_info *sbi)/* write all the dirty dentry pages */ if (get_pages (sbi,F2FS_DIRTY_DENTS )) {f2fs_unlock_all (sbi); - err =f2fs_sync_dirty_inodes (sbi,DIR_INODE ); + err =f2fs_sync_dirty_inodes (sbi,DIR_INODE , true);if (err)return err;cond_resched ();
fs/f2fs/data.c +2 -2
@@ -2843,7 +2843,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, }unlock_page (page);if (!S_ISDIR (inode->i_mode) && !IS_NOQUOTA (inode) && - !F2FS_I (inode)->cp_task && allow_balance) + !F2FS_I (inode)->wb_task && allow_balance)f2fs_balance_fs (sbi, need_balance_fs);if (unlikely (f2fs_cp_error (sbi))) {
@@ -3141,7 +3141,7 @@ static inline bool __should_serialize_io(struct inode *inode, struct writeback_control *wbc) {/* to avoid deadlock in path of data flush */ -if (F2FS_I (inode)->cp_task) +if (F2FS_I (inode)->wb_task)return false;if (!S_ISREG (inode->i_mode))
fs/f2fs/f2fs.h +3 -1
@@ -784,6 +784,7 @@ struct f2fs_inode_info {unsigned int clevel;/* maximum level of given file name */ struct task_struct *task;/* lookup and create consistency */ struct task_struct *cp_task;/* separate cp/wb IO stats*/ +struct task_struct *wb_task;/* indicate inode is in context of writeback */ nid_t i_xattr_nid;/* node id that contains xattrs */ loff_t last_disk_size;/* lastly written file size */ spinlock_t i_size_lock;/* protect last_disk_size */
@@ -3710,7 +3711,8 @@ int f2fs_recover_orphan_inodes(struct f2fs_sb_info *sbi);int f2fs_get_valid_checkpoint (struct f2fs_sb_info *sbi);void f2fs_update_dirty_folio (struct inode *inode,struct folio *folio);void f2fs_remove_dirty_inode (struct inode *inode); -int f2fs_sync_dirty_inodes (struct f2fs_sb_info *sbi,enum inode_type type); +int f2fs_sync_dirty_inodes (struct f2fs_sb_info *sbi,enum inode_type type, +bool from_cp);void f2fs_wait_on_all_pages (struct f2fs_sb_info *sbi,int type);u64 f2fs_get_sectors_written (struct f2fs_sb_info *sbi);int f2fs_write_checkpoint (struct f2fs_sb_info *sbi,struct cp_control *cpc);
fs/f2fs/segment.c +1 -1
@@ -469,7 +469,7 @@ void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi, bool from_bg)mutex_lock (&sbi->flush_lock);blk_start_plug (&plug); -f2fs_sync_dirty_inodes (sbi,FILE_INODE ); +f2fs_sync_dirty_inodes (sbi,FILE_INODE , false);blk_finish_plug (&plug);mutex_unlock (&sbi->flush_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 539/717 module: tracking: Keep a record of tainted unloaded modules only
In reply to Greg Kroah-HartmanFrom: Aaron Tomlin <[email protected]>
[ Upstream commit 47cc75aa92837a9d3f15157d6272ff285585d75d ]
This ensures that no module record/or entry is added to the unloaded_tainted_modules list if it does not carry a taint.
--- kernel/module/tracking.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/module/tracking.c +3 -0
@@ -21,6 +21,9 @@ int try_add_tainted_module(struct module *mod)module_assert_mutex_or_preempt (); +if (!mod->taints) + goto out; +list_for_each_entry_rcu (mod_taint, &unloaded_tainted_modules, list,lockdep_is_held (&module_mutex)) { if (!strcmp(mod_taint->name, mod->name) &&
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 502/717 powerpc/64: mark irqs hard disabled in boot paca
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 799f7063c7645f9a751d17f5dfd73b952f962cd2 ]
This prevents interrupts in early boot (e.g., program check) from enabling MSR[EE], potentially causing endian mismatch or other crashes when reporting early boot traps.
--- arch/powerpc/kernel/setup_64.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/kernel/setup_64.c +3 -1
@@ -183,8 +183,10 @@ static void __init fixup_boot_paca(void)get_paca ()->cpu_start =1 ;/* Allow percpu accesses to work until we setup percpu data */ get_paca ()->data_offset =0 ; -/* Mark interrupts disabled in PACA */ +/* Mark interrupts soft and hard disabled in PACA */ irq_soft_mask_set (IRQS_DISABLED ); +get_paca ()->irq_happened =PACA_IRQ_HARD_DIS ; +WARN_ON (mfmsr () &MSR_EE ); }static void __init configure_exceptions (void )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 522/717 clocksource/drivers/timer-gxp: Add missing error handling in gxp_timer_probe
In reply to Greg Kroah-HartmanFrom: Lin Yujun <[email protected]>
[ Upstream commit 0e2c8e6d769bcdc4f6634a02c545356282275e68 ]
Add platform_device_put() to make sure to free the platform device in the event platform_device_add() fails.
--- drivers/clocksource/timer-gxp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/clocksource/timer-gxp.c +6 -1
@@ -171,6 +171,7 @@ static int gxp_timer_probe(struct platform_device *pdev) {struct platform_device *gxp_watchdog_device;struct device *dev = &pdev->dev; +int ret;if (!gxp_timer) {pr_err ("Gxp Timer not initialized, cannot create watchdog" );
@@ -187,7 +188,11 @@ static int gxp_timer_probe(struct platform_device *pdev) gxp_watchdog_device->dev.platform_data = gxp_timer->counter; gxp_watchdog_device->dev.parent = dev; -return platform_device_add (gxp_watchdog_device); + ret =platform_device_add (gxp_watchdog_device); +if (ret) +platform_device_put (gxp_watchdog_device); + +return ret; }static const struct of_device_id gxp_timer_of_match[] = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 507/717 crypto: sahara - dont sleep when in softirq
In reply to Greg Kroah-HartmanFrom: Zhengchao Shao <[email protected]>
[ Upstream commit 108586eba094b318e6a831f977f4ddcc403a15da ]
Function of sahara_aes_crypt maybe could be called by function of crypto_skcipher_encrypt during the rx softirq, so it is not allowed to use mutex lock.
--- drivers/crypto/sahara.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/crypto/sahara.c +9 -9
@@ -26,10 +26,10 @@#include <linux/kernel.h> #include <linux/kthread.h> #include <linux/module.h> -#include <linux/mutex.h> #include <linux/of.h> #include <linux/of_device.h> #include <linux/platform_device.h> +#include <linux/spinlock.h> #define SHA_BUFFER_LEN PAGE_SIZE#define SAHARA_MAX_SHA_BLOCK_SIZE SHA256_BLOCK_SIZE
@@ -196,7 +196,7 @@ struct sahara_dev {void __iomem *regs_base;struct clk *clk_ipg;struct clk *clk_ahb; -struct mutex queue_mutex; +spinlock_t queue_spinlock;struct task_struct *kthread;struct completion dma_completion;
@@ -642,9 +642,9 @@ static int sahara_aes_crypt(struct skcipher_request *req, unsigned long mode) rctx->mode = mode; -mutex_lock (&dev->queue_mutex); +spin_lock_bh (&dev->queue_spinlock); err =crypto_enqueue_request (&dev->queue, &req->base); -mutex_unlock (&dev->queue_mutex); +spin_unlock_bh (&dev->queue_spinlock);wake_up_process (dev->kthread);
@@ -1043,10 +1043,10 @@ static int sahara_queue_manage(void *data) do { __set_current_state(TASK_INTERRUPTIBLE); - mutex_lock(&dev->queue_mutex); + spin_lock_bh(&dev->queue_spinlock); backlog = crypto_get_backlog(&dev->queue); async_req = crypto_dequeue_request(&dev->queue); - mutex_unlock(&dev->queue_mutex); + spin_unlock_bh(&dev->queue_spinlock); if (backlog) backlog->complete(backlog, -EINPROGRESS);
@@ -1092,9 +1092,9 @@ static int sahara_sha_enqueue(struct ahash_request *req, int last) rctx->first =1 ; } -mutex_lock (&dev->queue_mutex); +spin_lock_bh (&dev->queue_spinlock); ret =crypto_enqueue_request (&dev->queue, &req->base); -mutex_unlock (&dev->queue_mutex); +spin_unlock_bh (&dev->queue_spinlock);wake_up_process (dev->kthread);
@@ -1449,7 +1449,7 @@ static int sahara_probe(struct platform_device *pdev)crypto_init_queue (&dev->queue,SAHARA_QUEUE_LENGTH ); -mutex_init (&dev->queue_mutex); +spin_lock_init (&dev->queue_spinlock); dev_ptr = dev;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 547/717 cpufreq: intel_pstate: Add Tigerlake support in no-HWP mode
In reply to Greg Kroah-HartmanFrom: Doug Smythies <[email protected]>
[ Upstream commit 71bb5c82aaaea007167f3ba68d3a669c74d7d55d ]
Users may disable HWP in firmware, in which case intel_pstate wouldn't load unless the CPU model is explicitly supported.
Add TIGERLAKE to the list of CPUs that can register intel_pstate while not advertising the HWP capability. Without this change, an TIGERLAKE in no-HWP mode could only use the acpi_cpufreq frequency scaling driver.
See also commits:d8de7a44e11f: cpufreq: intel_pstate: Add Skylake servers supportfbdc21e9b038: cpufreq: intel_pstate: Add Icelake servers support in no-HWP mode 706c5328851d: cpufreq: intel_pstate: Add Cometlake support in no-HWP mode
Reported by: M. Cargi Ari <[email protected]>
--- drivers/cpufreq/intel_pstate.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/intel_pstate.c +1 -0
@@ -2416,6 +2416,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = {X86_MATCH (SKYLAKE_X , core_funcs),X86_MATCH (COMETLAKE , core_funcs),X86_MATCH (ICELAKE_X , core_funcs), +X86_MATCH (TIGERLAKE , core_funcs), {} };MODULE_DEVICE_TABLE (x86cpu, intel_pstate_cpu_ids);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 301/717 drm/bridge: tc358767: Add of_node_put() when breaking out of loop
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 14e7157afb055248ed34901fcd6fbf54201cfea1 ]
In tc_probe_bridge_endpoint(), we should call of_node_put() when breaking out of the for_each_endpoint_of_node() which will automatically increase and decrease the refcount.
--- drivers/gpu/drm/bridge/tc358767.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/tc358767.c +3 -2
@@ -1986,9 +1986,10 @@ static int tc_probe_bridge_endpoint(struct tc_data *tc)for_each_endpoint_of_node (dev->of_node, node) {of_graph_parse_endpoint (node, &endpoint); -if (endpoint.port >2 ) +if (endpoint.port >2 ) { +of_node_put (node);return -EINVAL ; - + } mode |=BIT (endpoint.port); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 462/717 clk: qcom: apss-ipq6018: mark apcs_alias0_core_clk as critical
In reply to Greg Kroah-HartmanFrom: Robert Marko <[email protected]>
[ Upstream commit 86e78995c93ee182433f965babfccd48417d4dcf ]
While fixing up the driver I noticed that my IPQ8074 board was hanging after CPUFreq switched the frequency during boot, WDT would eventually reset it.
So mark apcs_alias0_core_clk as critical since its the clock feeding the CPU cluster and must never be disabled.
--- drivers/clk/qcom/apss-ipq6018.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/apss-ipq6018.c +1 -1
@@ -57,7 +57,7 @@ static struct clk_branch apcs_alias0_cor .parent_hws = (const struct clk_hw *[]){ &apcs_alias0_clk_src.clkr.hw }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, },
Greg Kroah-Hartman
maintainerPATCH 552/717 ACPI: x86: Add a quirk for Dell Inspiron 14 2-in-1 for StorageD3Enable
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
[ Upstream commit 018d6711c26e4bd26e20a819fcc7f8ab902608f3 ]
Dell Inspiron 14 2-in-1 has two ACPI nodes under GPP1 both with _ADR of 0, both without _HID. It's ambiguous which the kernel should take, but it seems to take "DEV0". Unfortunately "DEV0" is missing the device property StorageD3Enable which is present on "NVME".
To avoid this causing problems for suspend, add a quirk for this system to behave like StorageD3Enable property was found.
--- drivers/acpi/x86/utils.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/acpi/x86/utils.c +18 -1
@@ -207,9 +207,26 @@ static const struct x86_cpu_id storage_d3_cpu_ids[] = { {} }; +static const struct dmi_system_id force_storage_d3_dmi[] = { + { +/* +* _ADR is ambiguous between GPP1.DEV0 and GPP1.NVME +* but .NVME is needed to get StorageD3Enable node +* https://bugzilla.kernel.org/show_bug.cgi?id=216440 +*/ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Inspiron 14 7425 2-in-1" ), + } + }, + {} +}; +bool force_storage_d3 (void ) { -return x86_match_cpu (storage_d3_cpu_ids); +const struct dmi_system_id *dmi_id =dmi_first_match (force_storage_d3_dmi); + +return dmi_id ||x86_match_cpu (storage_d3_cpu_ids); }/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 493/717 powerpc/configs: Properly enable PAPR_SCM in pseries_defconfig
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit aa398d88aea4ec863bd7aea35d5035a37096dc59 ]
My commit to add PAPR_SCM to pseries_defconfig failed to add the required dependencies, meaning the driver doesn't get built.
Add the required LIBNVDIMM=m.
--- arch/powerpc/configs/pseries_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/configs/pseries_defconfig +1 -0
@@ -40,6 +40,7 @@ CONFIG_PPC_SPLPAR=y CONFIG_DTL=y CONFIG_PPC_SMLPAR=y CONFIG_IBMEBUS=y +CONFIG_LIBNVDIMM=m CONFIG_PAPR_SCM=m CONFIG_PPC_SVM=y # CONFIG_PPC_PMAC is not set
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 517/717 crypto: akcipher - default implementation for setting a private key
In reply to Greg Kroah-HartmanFrom: Ignat Korchagin <[email protected]>
[ Upstream commit bc155c6c188c2f0c5749993b1405673d25a80389 ]
Changes from v1:
* removed the default implementation from set_pub_key: it is assumed that an implementation must always have this callback defined as there are no use case for an algorithm, which doesn't need a public key
Many akcipher implementations (like ECDSA) support only signature verifications, so they don't have all callbacks defined.
Commit 78a0324f4a53 ("crypto: akcipher - default implementations for request callbacks") introduced default callbacks for sign/verify operations, which just return an error code.
However, these are not enough, because before calling sign the caller would likely call set_priv_key first on the instantiated transform (as the in-kernel testmgr does). This function does not have a default stub, so the kernel crashes, when trying to set a private key on an akcipher, which doesn't support signature generation.
I've noticed this, when trying to add a KAT vector for ECDSA signature to the testmgr.
With this patch the testmgr returns an error in dmesg (as it should) instead of crashing the kernel NULL ptr dereference.
--- crypto/akcipher.c | 8 ++++++++ 1 file changed, 8 insertions(+)
crypto/akcipher.c +8 -0
@@ -120,6 +120,12 @@ static int akcipher_default_op(struct akcipher_request *req)return -ENOSYS ; } +static int akcipher_default_set_key (struct crypto_akcipher *tfm, +const void *key,unsigned int keylen) +{ +return -ENOSYS ; +} +int crypto_register_akcipher (struct akcipher_alg *alg) {struct crypto_alg *base = &alg->base;
@@ -132,6 +138,8 @@ int crypto_register_akcipher(struct akcipher_alg *alg) alg->encrypt = akcipher_default_op;if (!alg->decrypt) alg->decrypt = akcipher_default_op; +if (!alg->set_priv_key) + alg->set_priv_key = akcipher_default_set_key;akcipher_prepare_alg (alg);return crypto_register_alg (base);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 367/717 ext4: dont run ext4lazyinit for read-only filesystems
In reply to Greg Kroah-HartmanFrom: Josh Triplett <[email protected]>
[ Upstream commit 426d15ad11419066f7042ffa8fbf1b5c21a1ecbe ]
On a read-only filesystem, we won't invoke the block allocator, so we don't need to prefetch the block bitmaps.
This avoids starting and running the ext4lazyinit thread at all on a system with no read-write ext4 filesystems (for instance, a container VM with read-only filesystems underneath an overlayfs).
--- fs/ext4/super.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/ext4/super.c +3 -3
@@ -3953,9 +3953,9 @@ int ext4_register_li_request(struct super_block *sb, goto out; } -if (test_opt (sb,NO_PREFETCH_BLOCK_BITMAPS ) && - (first_not_zeroed == ngroups ||sb_rdonly (sb) || - !test_opt (sb,INIT_INODE_TABLE ))) +if (sb_rdonly (sb) || + (test_opt (sb,NO_PREFETCH_BLOCK_BITMAPS ) && + (first_not_zeroed == ngroups || !test_opt (sb,INIT_INODE_TABLE )))) goto out; elr =ext4_li_request_new (sb, first_not_zeroed);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 519/717 crypto: inside-secure - Change swab to swab32
In reply to Greg Kroah-HartmanFrom: Peter Harliman Liem <[email protected]>
[ Upstream commit 664593407e936b6438fbfaaf98876910fd31cf9a ]
The use of swab() is causing failures in 64-bit arch, as it translates to __swab64() instead of the intended __swab32(). It eventually causes wrong results in xcbcmac & cmac algo.
--- drivers/crypto/inside-secure/safexcel_hash.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/crypto/inside-secure/safexcel_hash.c +4 -4
@@ -383,7 +383,7 @@ static int safexcel_ahash_send_req(struct crypto_async_request *async, int ring,u32 x; x = ipad[i] ^ ipad[i +4 ]; - cache[i] ^=swab (x); + cache[i] ^=swab32 (x); } } cache_len =AES_BLOCK_SIZE ;
@@ -821,7 +821,7 @@ static int safexcel_ahash_final(struct ahash_request *areq)u32 *result = (void *)areq->result;/* K3 */ - result[i] =swab (ctx->base.ipad.word[i +4 ]); + result[i] =swab32 (ctx->base.ipad.word[i +4 ]); } areq->result[0 ] ^=0x80 ;// 10- padding crypto_cipher_encrypt_one (ctx->kaes, areq->result, areq->result);
@@ -2106,7 +2106,7 @@ static int safexcel_xcbcmac_setkey(struct crypto_ahash *tfm, const u8 *key,crypto_cipher_encrypt_one (ctx->kaes, (u8 *)key_tmp +AES_BLOCK_SIZE ,"\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3" );for (i =0 ; i <3 *AES_BLOCK_SIZE /sizeof (u32); i++) - ctx->base.ipad.word[i] =swab (key_tmp[i]); + ctx->base.ipad.word[i] =swab32 (key_tmp[i]);crypto_cipher_clear_flags (ctx->kaes,CRYPTO_TFM_REQ_MASK ); crypto_cipher_set_flags(ctx->kaes, crypto_ahash_get_flags(tfm) &
@@ -2189,7 +2189,7 @@ static int safexcel_cmac_setkey(struct crypto_ahash *tfm, const u8 *key,return ret;for (i =0 ; i < len /sizeof (u32); i++) - ctx->base.ipad.word[i +8 ] =swab (aes.key_enc[i]); + ctx->base.ipad.word[i +8 ] =swab32 (aes.key_enc[i]);/* precompute the CMAC key material */ crypto_cipher_clear_flags (ctx->kaes,CRYPTO_TFM_REQ_MASK );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 530/717 kbuild: rpm-pkg: fix breakage when V=1 is used
In reply to Greg Kroah-HartmanFrom: Janis Schoetterl-Glausch <[email protected]>
[ Upstream commit 2e07005f4813a9ff6e895787e0c2d1fea859b033 ]
Doing make V=1 binrpm-pkg results in:
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.EgV6qJ
+ umask 022
+ cd .
+ /bin/rm -rf /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x
+ /bin/mkdir -p /home/scgl/rpmbuild/BUILDROOT
+ /bin/mkdir /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x
+ mkdir -p /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x/boot
+ make -f ./Makefile image_name
+ cp test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \ echo >&2; \ echo >&2 " ERROR: Kernel configuration is invalid."; \ echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\ echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ echo >&2 ; \ /bin/false) arch/s390/boot/bzImage /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x/boot/vmlinuz-6.0.0-rc5+
cp: invalid option -- 'e'
Try 'cp --help' for more information.
error: Bad exit status from /var/tmp/rpm-tmp.EgV6qJ (%install)
Because the make call to get the image name is verbose and prints additional information.
--- scripts/package/mkspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/package/mkspec +2 -2
@@ -85,10 +85,10 @@ $S mkdir -p %{buildroot}/boot %ifarch ia64 mkdir -p %{buildroot}/boot/efi - cp \$($MAKE image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE + cp \$($MAKE -s image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE ln -s efi/vmlinuz-$KERNELRELEASE %{buildroot}/boot/ %else - cp \$($MAKE image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE + cp \$($MAKE -s image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE %endif $M $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install $MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 541/717 rcu: Avoid triggering strict-GP irq-work when RCU is idle
In reply to Greg Kroah-HartmanFrom: Zqiang <[email protected]>
[ Upstream commit 621189a1fe93cb2b34d62c5cdb9e258bca044813 ]
Kernels built with PREEMPT_RCU=y and RCU_STRICT_GRACE_PERIOD=y trigger irq-work from rcu_read_unlock(), and the resulting irq-work handler invokes rcu_preempt_deferred_qs_handle(). The point of this triggering is to force grace periods to end quickly in order to give tools like KASAN a better chance of detecting RCU usage bugs such as leaking RCU-protected pointers out of an RCU read-side critical section.
However, this irq-work triggering is unconditional. This works, but there is no point in doing this irq-work unless the current grace period is waiting on the running CPU or task, which is not the common case. After all, in the common case there are many rcu_read_unlock() calls per CPU per grace period.
This commit therefore triggers the irq-work only when the current grace period is waiting on the running CPU or task.
This change was tested as follows on a four-CPU system:
echo rcu_preempt_deferred_qs_handler > /sys/kernel/debug/tracing/set_ftrace_filter echo 1 > /sys/kernel/debug/tracing/function_profile_enabled
insmod rcutorture.ko
sleep 20
rmmod rcutorture.ko
echo 0 > /sys/kernel/debug/tracing/function_profile_enabled
echo > /sys/kernel/debug/tracing/set_ftrace_filter
This procedure produces results in this per-CPU set of files:
/sys/kernel/debug/tracing/trace_stat/function*
Sample output from one of these files is as follows:
Function Hit Time Avg s^2 -------- --- ---- --- --- rcu_preempt_deferred_qs_handle 838746 182650.3 us 0.217 us 0.004 us
The baseline sum of the "Hit" values (the number of calls to this function) was 3,319,015. With this commit, that sum was 1,140,359, for a 2.9x reduction. The worst-case variance across the CPUs was less than 25%, so this large effect size is statistically significant.
The raw data is available in the Link: URL.
--- kernel/rcu/tree_plugin.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/rcu/tree_plugin.h +2 -1
@@ -641,7 +641,8 @@ static void rcu_read_unlock_special(struct task_struct *t) expboost = (t->rcu_blocked_node &&READ_ONCE (t->rcu_blocked_node->exp_tasks)) || (rdp->grpmask &READ_ONCE (rnp->expmask)) || -IS_ENABLED (CONFIG_RCU_STRICT_GRACE_PERIOD ) || + (IS_ENABLED (CONFIG_RCU_STRICT_GRACE_PERIOD ) && + ((rdp->grpmask &READ_ONCE (rnp->qsmask)) || t->rcu_blocked_node)) || (IS_ENABLED (CONFIG_RCU_BOOST ) && irqs_were_disabled && t->rcu_blocked_node);// Need to defer quiescent state until everything is enabled.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 540/717 fs: dlm: fix race in lowcomms
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit 30ea3257e8766027c4d8d609dcbd256ff9a76073 ]
This patch fixes a race between queue_work() in _dlm_lowcomms_commit_msg() and srcu_read_unlock(). The queue_work() can take the final reference of a dlm_msg and so msg->idx can contain garbage which is signaled by the following warning:
[ 676.237050] ------------[ cut here ]------------ [ 676.237052] WARNING: CPU: 0 PID: 1060 at include/linux/srcu.h:189 dlm_lowcomms_commit_msg+0x41/0x50 [ 676.238945] Modules linked in: dlm_locktorture torture rpcsec_gss_krb5 intel_rapl_msr intel_rapl_common iTCO_wdt iTCO_vendor_support qxl kvm_intel drm_ttm_helper vmw_vsock_virtio_transport kvm vmw_vsock_virtio_transport_common ttm irqbypass crc32_pclmul joydev crc32c_intel serio_raw drm_kms_helper vsock virtio_scsi virtio_console virtio_balloon snd_pcm drm syscopyarea sysfillrect sysimgblt snd_timer fb_sys_fops i2c_i801 lpc_ich snd i2c_smbus soundcore pcspkr [ 676.244227] CPU: 0 PID: 1060 Comm: lock_torture_wr Not tainted 5.19.0-rc3+ #1546 [ 676.245216] Hardware name: Red Hat KVM/RHEL-AV, BIOS 1.16.0-2.module+el8.7.0+15506+033991b0 04/01/2014 [ 676.246460] RIP: 0010:dlm_lowcomms_commit_msg+0x41/0x50 [ 676.247132] Code: fe ff ff ff 75 24 48 c7 c6 bd 0f 49 bb 48 c7 c7 38 7c 01 bd e8 00 e7 ca ff 89 de 48 c7 c7 60 78 01 bd e8 42 3d cd ff 5b 5d c3 <0f> 0b eb d8 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 55 48 [ 676.249253] RSP: 0018:ffffa401c18ffc68 EFLAGS: 00010282 [ 676.249855] RAX: 0000000000000001 RBX: 00000000ffff8b76 RCX: 0000000000000006 [ 676.250713] RDX: 0000000000000000 RSI: ffffffffbccf3a10 RDI: ffffffffbcc7b62e [ 676.251610] RBP: ffffa401c18ffc70 R08: 0000000000000001 R09: 0000000000000001 [ 676.252481] R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000005 [ 676.253421] R13: ffff8b76786ec370 R14: ffff8b76786ec370 R15: ffff8b76786ec480 [ 676.254257] FS: 0000000000000000(0000) GS:ffff8b7777800000(0000) knlGS:0000000000000000 [ 676.255239] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 676.255897] CR2: 00005590205d88b8 CR3: 000000017656c003 CR4: 0000000000770ee0 [ 676.256734] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 676.257567] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 676.258397] PKRU: 55555554 [ 676.258729] Call Trace: [ 676.259063] <TASK> [ 676.259354] dlm_midcomms_commit_mhandle+0xcc/0x110 [ 676.259964] queue_bast+0x8b/0xb0 [ 676.260423] grant_pending_locks+0x166/0x1b0 [ 676.261007] _unlock_lock+0x75/0x90 [ 676.261469] unlock_lock.isra.57+0x62/0xa0 [ 676.262009] dlm_unlock+0x21e/0x330 [ 676.262457] ? lock_torture_stats+0x80/0x80 [dlm_locktorture] [ 676.263183] torture_unlock+0x5a/0x90 [dlm_locktorture] [ 676.263815] ? preempt_count_sub+0xba/0x100 [ 676.264361] ? complete+0x1d/0x60 [ 676.264777] lock_torture_writer+0xb8/0x150 [dlm_locktorture] [ 676.265555] kthread+0x10a/0x130 [ 676.266007] ? kthread_complete_and_exit+0x20/0x20 [ 676.266616] ret_from_fork+0x22/0x30 [ 676.267097] </TASK> [ 676.267381] irq event stamp: 9579855 [ 676.267824] hardirqs last enabled at (9579863): [<ffffffffbb14e6f8>] __up_console_sem+0x58/0x60 [ 676.268896] hardirqs last disabled at (9579872): [<ffffffffbb14e6dd>] __up_console_sem+0x3d/0x60 [ 676.270008] softirqs last enabled at (9579798): [<ffffffffbc200349>] __do_softirq+0x349/0x4c7 [ 676.271438] softirqs last disabled at (9579897): [<ffffffffbb0d54c0>] irq_exit_rcu+0xb0/0xf0 [ 676.272796] ---[ end trace 0000000000000000 ]---
I reproduced this warning with dlm_locktorture test which is currently not upstream. However this patch fix the issue by make a additional refcount between dlm_lowcomms_new_msg() and dlm_lowcomms_commit_msg(). In case of the race the kref_put() in dlm_lowcomms_commit_msg() will be the final put.
--- fs/dlm/lowcomms.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/dlm/lowcomms.c +4 -0
@@ -1336,6 +1336,8 @@ struct dlm_msg *dlm_lowcomms_new_msg(int nodeid, int len, gfp_t allocation,return NULL ; } +/* for dlm_lowcomms_commit_msg() */ +kref_get (&msg->ref);/* we assume if successful commit must called */ msg->idx = idx;return msg;
@@ -1375,6 +1377,8 @@ void dlm_lowcomms_commit_msg(struct dlm_msg *msg) {_dlm_lowcomms_commit_msg (msg);srcu_read_unlock (&connections_srcu, msg->idx); +/* because dlm_lowcomms_new_msg() */ +kref_put (&msg->ref, dlm_msg_release); }#endif
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 564/717 x86/mce: Retrieve poison range from hardware
In reply to Greg Kroah-HartmanFrom: Jane Chu <[email protected]>
[ Upstream commit f9781bb18ed828e7b83b7bac4a4ad7cd497ee7d7 ]
When memory poison consumption machine checks fire, MCE notifier handlers like nfit_handle_mce() record the impacted physical address range which is reported by the hardware in the MCi_MISC MSR. The error information includes data about blast radius, i.e. how many cachelines did the hardware determine are impacted. A recent change
7917f9cdb503 ("acpi/nfit: rely on mce->misc to determine poison granularity")
updated nfit_handle_mce() to stop hard coding the blast radius value of 1 cacheline, and instead rely on the blast radius reported in 'struct mce' which can be up to 4K (64 cachelines).
It turns out that apei_mce_report_mem_error() had a similar problem in that it hard coded a blast radius of 4K rather than reading the blast radius from the error information. Fix apei_mce_report_mem_error() to convey the proper poison granularity.
--- arch/x86/kernel/cpu/mce/apei.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/mce/apei.c +12 -1
@@ -29,15 +29,26 @@void apei_mce_report_mem_error (int severity,struct cper_sec_mem_err *mem_err) {struct mce m; +int lsb;if (!(mem_err->validation_bits &CPER_MEM_VALID_PA ))return ; +/* +* Even if the ->validation_bits are set for address mask, +* to be extra safe, check and reject an error radius '0', +* and fall back to the default page size. +*/ +if (mem_err->validation_bits &CPER_MEM_VALID_PA_MASK ) + lsb =find_first_bit ((void *)&mem_err->physical_addr_mask,PAGE_SHIFT ); +else + lsb =PAGE_SHIFT ; +mce_setup (&m); m.bank =-1 ;/* Fake a memory read error with unknown channel */ m.status =MCI_STATUS_VAL |MCI_STATUS_EN |MCI_STATUS_ADDRV |MCI_STATUS_MISCV |0x9f ; - m.misc = (MCI_MISC_ADDR_PHYS <<6 ) |PAGE_SHIFT ; + m.misc = (MCI_MISC_ADDR_PHYS <<6 ) | lsb;if (severity >=GHES_SEV_RECOVERABLE ) m.status |=MCI_STATUS_UC ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 531/717 crypto: marvell/octeontx - prevent integer overflows
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit caca37cf6c749ff0303f68418cfe7b757a4e0697 ]
The "code_length" value comes from the firmware file. If your firmware is untrusted realistically there is probably very little you can do to protect yourself. Still we try to limit the damage as much as possible. Also Smatch marks any data read from the filesystem as untrusted and prints warnings if it not capped correctly.
The "code_length * 2" can overflow. The round_up(ucode_size, 16) + sizeof() expression can overflow too. Prevent these overflows.
--- .../crypto/marvell/octeontx/otx_cptpf_ucode.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c +16 -2
@@ -286,6 +286,7 @@ static int process_tar_file(struct device *dev,struct tar_ucode_info_t *tar_info;struct otx_cpt_ucode_hdr *ucode_hdr;int ucode_type, ucode_size; +unsigned int code_length;/* * If size is less than microcode header size then don't report
@@ -303,7 +304,13 @@ static int process_tar_file(struct device *dev,if (get_ucode_type (ucode_hdr, &ucode_type))return 0 ; - ucode_size =ntohl (ucode_hdr->code_length) *2 ; + code_length =ntohl (ucode_hdr->code_length); +if (code_length >=INT_MAX /2 ) { +dev_err (dev,"Invalid code_length %u\n" , code_length); +return -EINVAL ; + } + + ucode_size = code_length *2 ;if (!ucode_size || (size <round_up (ucode_size,16 ) +sizeof (struct otx_cpt_ucode_hdr ) +OTX_CPT_UCODE_SIGN_LEN )) {dev_err (dev,"Ucode %s invalid size\n" , filename);
@@ -886,6 +893,7 @@ static int ucode_load(struct device *dev, struct otx_cpt_ucode *ucode, {struct otx_cpt_ucode_hdr *ucode_hdr;const struct firmware *fw; +unsigned int code_length;int ret;set_ucode_filename (ucode, ucode_filename);
@@ -896,7 +904,13 @@ static int ucode_load(struct device *dev, struct otx_cpt_ucode *ucode, ucode_hdr = (struct otx_cpt_ucode_hdr *) fw->data;memcpy (ucode->ver_str, ucode_hdr->ver_str,OTX_CPT_UCODE_VER_STR_SZ ); ucode->ver_num = ucode_hdr->ver_num; - ucode->size =ntohl (ucode_hdr->code_length) *2 ; + code_length =ntohl (ucode_hdr->code_length); +if (code_length >=INT_MAX /2 ) { +dev_err (dev,"Ucode invalid code_length %u\n" , code_length); + ret = -EINVAL ; + goto release_fw; + } + ucode->size = code_length *2 ;if (!ucode->size || (fw->size <round_up (ucode->size,16 ) +sizeof (struct otx_cpt_ucode_hdr ) +OTX_CPT_UCODE_SIGN_LEN )) {dev_err (dev,"Ucode %s invalid size\n" , ucode_filename);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 568/717 net: axienet: Switch to 64-bit RX/TX statistics
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
[ Upstream commit cb45a8bf4693965e89d115cd2c510f12bc127c37 ]
The RX and TX byte/packet statistics in this driver could be overflowed relatively quickly on a 32-bit platform. Switch these stats to use the u64_stats infrastructure to avoid this.
--- drivers/net/ethernet/xilinx/xilinx_axienet.h | 12 ++++++ .../net/ethernet/xilinx/xilinx_axienet_main.c | 37 +++++++++++++++++-- 2 files changed, 45 insertions(+), 4 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet.h +12 -0
@@ -402,6 +402,9 @@ struct axidma_bd {* @rx_bd_num: Size of RX buffer descriptor ring * @rx_bd_ci: Stores the index of the Rx buffer descriptor in the ring being * accessed currently. +* @rx_packets: RX packet count for statistics +* @rx_bytes: RX byte count for statistics +* @rx_stat_sync: Synchronization object for RX stats * @napi_tx: NAPI TX control structure * @tx_dma_cr: Nominal content of TX DMA control register * @tx_bd_v: Virtual address of the TX buffer descriptor ring
@@ -411,6 +414,9 @@ struct axidma_bd {* complete. Only updated at runtime by TX NAPI poll. * @tx_bd_tail: Stores the index of the next Tx buffer descriptor in the ring * to be populated. +* @tx_packets: TX packet count for statistics +* @tx_bytes: TX byte count for statistics +* @tx_stat_sync: Synchronization object for TX stats * @dma_err_task: Work structure to process Axi DMA errors * @tx_irq: Axidma TX IRQ number * @rx_irq: Axidma RX IRQ number
@@ -458,6 +464,9 @@ struct axienet_local {dma_addr_t rx_bd_p;u32 rx_bd_num;u32 rx_bd_ci; +u64_stats_t rx_packets; +u64_stats_t rx_bytes; +struct u64_stats_sync rx_stat_sync;struct napi_struct napi_tx;u32 tx_dma_cr;
@@ -466,6 +475,9 @@ struct axienet_local {u32 tx_bd_num;u32 tx_bd_ci;u32 tx_bd_tail; +u64_stats_t tx_packets; +u64_stats_t tx_bytes; +struct u64_stats_sync tx_stat_sync;struct work_struct dma_err_task;
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +33 -4
@@ -752,8 +752,10 @@ static int axienet_tx_poll(struct napi_struct *napi, int budget)if (lp->tx_bd_ci >= lp->tx_bd_num) lp->tx_bd_ci %= lp->tx_bd_num; - ndev->stats.tx_packets += packets; - ndev->stats.tx_bytes += size; +u64_stats_update_begin (&lp->tx_stat_sync); +u64_stats_add (&lp->tx_packets, packets); +u64_stats_add (&lp->tx_bytes, size); +u64_stats_update_end (&lp->tx_stat_sync);/* Matches barrier in axienet_start_xmit */ smp_mb ();
@@ -984,8 +986,10 @@ static int axienet_rx_poll(struct napi_struct *napi, int budget) cur_p = &lp->rx_bd_v[lp->rx_bd_ci]; } - lp->ndev->stats.rx_packets += packets; - lp->ndev->stats.rx_bytes += size; +u64_stats_update_begin (&lp->rx_stat_sync); +u64_stats_add (&lp->rx_packets, packets); +u64_stats_add (&lp->rx_bytes, size); +u64_stats_update_end (&lp->rx_stat_sync);if (tail_p)axienet_dma_out_addr (lp,XAXIDMA_RX_TDESC_OFFSET , tail_p);
@@ -1292,10 +1296,32 @@ static int axienet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)return phylink_mii_ioctl (lp->phylink, rq, cmd); } +static void +axienet_get_stats64 (struct net_device *dev,struct rtnl_link_stats64 *stats) +{ +struct axienet_local *lp =netdev_priv (dev); +unsigned int start; + +netdev_stats_to_stats64 (stats, &dev->stats); + +do { + start =u64_stats_fetch_begin_irq (&lp->rx_stat_sync); + stats->rx_packets =u64_stats_read (&lp->rx_packets); + stats->rx_bytes =u64_stats_read (&lp->rx_bytes); + }while (u64_stats_fetch_retry_irq (&lp->rx_stat_sync, start)); + +do { + start =u64_stats_fetch_begin_irq (&lp->tx_stat_sync); + stats->tx_packets =u64_stats_read (&lp->tx_packets); + stats->tx_bytes =u64_stats_read (&lp->tx_bytes); + }while (u64_stats_fetch_retry_irq (&lp->tx_stat_sync, start)); +} +static const struct net_device_ops axienet_netdev_ops = { .ndo_open = axienet_open, .ndo_stop = axienet_stop, .ndo_start_xmit = axienet_start_xmit, + .ndo_get_stats64 = axienet_get_stats64, .ndo_change_mtu = axienet_change_mtu, .ndo_set_mac_address = netdev_set_mac_address, .ndo_validate_addr = eth_validate_addr,
@@ -1850,6 +1876,9 @@ static int axienet_probe(struct platform_device *pdev) lp->rx_bd_num =RX_BD_NUM_DEFAULT ; lp->tx_bd_num =TX_BD_NUM_DEFAULT ; +u64_stats_init (&lp->rx_stat_sync); +u64_stats_init (&lp->tx_stat_sync); +netif_napi_add (ndev, &lp->napi_rx, axienet_rx_poll,NAPI_POLL_WEIGHT );netif_napi_add (ndev, &lp->napi_tx, axienet_tx_poll,NAPI_POLL_WEIGHT );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 569/717 net-next: Fix IP_UNICAST_IF option behavior for connected sockets
In reply to Greg Kroah-HartmanFrom: Richard Gobert <[email protected]>
[ Upstream commit 0e4d354762cefd3e16b4cff8988ff276e45effc4 ]
The IP_UNICAST_IF socket option is used to set the outgoing interface for outbound packets.
The IP_UNICAST_IF socket option was added as it was needed by the Wine project, since no other existing option (SO_BINDTODEVICE socket option, IP_PKTINFO socket option or the bind function) provided the needed characteristics needed by the IP_UNICAST_IF socket option. [1] The IP_UNICAST_IF socket option works well for unconnected sockets, that is, the interface specified by the IP_UNICAST_IF socket option is taken into consideration in the route lookup process when a packet is being sent. However, for connected sockets, the outbound interface is chosen when connecting the socket, and in the route lookup process which is done when a packet is being sent, the interface specified by the IP_UNICAST_IF socket option is being ignored.
This inconsistent behavior was reported and discussed in an issue opened on systemd's GitHub project [2]. Also, a bug report was submitted in the kernel's bugzilla [3].
To understand the problem in more detail, we can look at what happens for UDP packets over IPv4 (The same analysis was done separately in the referenced systemd issue).
When a UDP packet is sent the udp_sendmsg function gets called and the following happens:
1. The oif member of the struct ipcm_cookie ipc (which stores the output interface of the packet) is initialized by the ipcm_init_sk function to inet->sk.sk_bound_dev_if (the device set by the SO_BINDTODEVICE socket option).
2. If the IP_PKTINFO socket option was set, the oif member gets overridden by the call to the ip_cmsg_send function.
3. If no output interface was selected yet, the interface specified by the IP_UNICAST_IF socket option is used.
4. If the socket is connected and no destination address is specified in the send function, the struct ipcm_cookie ipc is not taken into consideration and the cached route, that was calculated in the connect function is being used.
Thus, for a connected socket, the IP_UNICAST_IF sockopt isn't taken into consideration.
This patch corrects the behavior of the IP_UNICAST_IF socket option for connect()ed sockets by taking into consideration the IP_UNICAST_IF sockopt when connecting the socket.
In order to avoid reconnecting the socket, this option is still ignored when applied on an already connected socket until connect() is called again by the Richard Gobert.
Change the __ip4_datagram_connect function, which is called during socket connection, to take into consideration the interface set by the IP_UNICAST_IF socket option, in a similar way to what is done in the udp_sendmsg function.
[1] https://lore.kernel.org/netdev/1328685717.4736.4.camel@edumazet-laptop/T/
[2] https://github.com/systemd/systemd/issues/11935#issuecomment-618691018
[3] https://bugzilla.kernel.org/show_bug.cgi?id=210255
--- net/ipv4/datagram.c | 2 ++ tools/testing/selftests/net/fcnal-test.sh | 30 +++++++++++++++++++++++ tools/testing/selftests/net/nettest.c | 16 ++++++++++-- 3 files changed, 46 insertions(+), 2 deletions(-)
net/ipv4/datagram.c +2 -0
@@ -42,6 +42,8 @@ int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len oif = inet->mc_index;if (!saddr) saddr = inet->mc_addr; + }else if (!oif) { + oif = inet->uc_index; } fl4 = &inet->cork.fl.u.ip4; rt = ip_route_connect(fl4, usin->sin_addr.s_addr, saddr, oif,
tools/testing/selftests/net/fcnal-test.sh +30 -0
@@ -1466,6 +1466,13 @@ ipv4_udp_novrf() run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S -0 ${NSA_IP} log_test_addr ${a} $? 0 "Client, device bind via IP_UNICAST_IF" + log_start + run_cmd_nsb nettest -D -s & + sleep 1 + run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S -0 ${NSA_IP} -U + log_test_addr ${a} $? 0 "Client, device bind via IP_UNICAST_IF, with connect()" + + log_start show_hint "Should fail 'Connection refused'" run_cmd nettest -D -r ${a}
@@ -1525,6 +1532,13 @@ ipv4_udp_novrf() run_cmd nettest -D -d ${NSA_DEV} -S -r ${a} log_test_addr ${a} $? 0 "Global server, device client via IP_UNICAST_IF, local connection" + log_start + run_cmd nettest -s -D & + sleep 1 + run_cmd nettest -D -d ${NSA_DEV} -S -r ${a} -U + log_test_addr ${a} $? 0 "Global server, device client via IP_UNICAST_IF, local connection, with connect()" + + # IPv4 with device bind has really weird behavior - it overrides the # fib lookup, generates an rtable and tries to send the packet. This # causes failures for local traffic at different places
@@ -1550,6 +1564,15 @@ ipv4_udp_novrf() sleep 1 run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection" + + log_start + show_hint "Should fail since addresses on loopback are out of device scope" + run_cmd nettest -D -s & + sleep 1 + run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S -U + log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection, with connect()" + + done a=${NSA_IP}
@@ -3157,6 +3180,13 @@ ipv6_udp_novrf() sleep 1 run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -S log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection" + + log_start + show_hint "Should fail 'No route to host' since addresses on loopback are out of device scope" + run_cmd nettest -6 -D -s & + sleep 1 + run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -S -U + log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection, with connect()" done a=${NSA_IP6}
tools/testing/selftests/net/nettest.c +14 -2
@@ -127,6 +127,9 @@ struct sock_args {/* ESP in UDP encap test */ int use_xfrm; + +/* use send() and connect() instead of sendto */ +int datagram_connect; };static int server_mode;
@@ -979,6 +982,11 @@ static int send_msg(int sd, void *addr, socklen_t alen, struct sock_args *args)log_err_errno ("write failed sending msg to peer" );return 1 ; } + }else if (args->datagram_connect) { +if (send (sd, msg, msglen,0 ) <0 ) { +log_err_errno ("send failed sending msg to peer" ); +return 1 ; + } }else if (args->ifindex && args->use_cmsg) {if (send_msg_cmsg (sd, addr, alen, args->ifindex, args->version))return 1 ;
@@ -1659,7 +1667,7 @@ static int connectsock(void *addr, socklen_t alen, struct sock_args *args)if (args->has_local_ip &&bind_socket (sd, args)) goto err; -if (args->type !=SOCK_STREAM ) +if (args->type !=SOCK_STREAM && !args->datagram_connect) goto out;if (args->password &&tcp_md5sig (sd, addr, alen, args))
@@ -1854,7 +1862,7 @@ static int ipc_parent(int cpid, int fd, struct sock_args *args)return client_status; } -#define GETOPT_STR "sr:l:c:p:t:g:P:DRn:M:X:m:d:I:BN:O:SCi6xL:0:1:2:3:Fbqf" +#define GETOPT_STR "sr:l:c:p:t:g:P:DRn:M:X:m:d:I:BN:O:SUCi6xL:0:1:2:3:Fbqf"#define OPT_FORCE_BIND_KEY_IFINDEX 1001#define OPT_NO_BIND_KEY_IFINDEX 1002
@@ -1891,6 +1899,7 @@ static void print_usage(char *prog)" -I dev bind socket to given device name - server mode\n" " -S use setsockopt (IP_UNICAST_IF or IP_MULTICAST_IF)\n" " to set device binding\n" +" -U Use connect() and send() for datagram sockets\n" " -f bind socket with the IP[V6]_FREEBIND option\n" " -C use cmsg and IP_PKTINFO to specify device binding\n" "\n"
@@ -2074,6 +2083,9 @@ int main(int argc, char *argv[])case 'x' : args.use_xfrm =1 ;break ; +case 'U' : + args.datagram_connect =1 ; +break ;default :print_usage (argv[0 ]);return 1 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 573/717 iavf: Fix race between iavf_close and iavf_reset_task
In reply to Greg Kroah-HartmanFrom: Michal Jaron <[email protected]>
[ Upstream commit 11c12adcbc1598d91e73ab6ddfa41d25a01478ed ]
During stress tests with adding VF to namespace and changing vf's trust there was a race between iavf_reset_task and iavf_close. Sometimes when IAVF_FLAG_AQ_DISABLE_QUEUES from iavf_close was sent to PF after reset and before IAVF_AQ_GET_CONFIG was sent then PF returns error IAVF_NOT_SUPPORTED to disable queues request and following requests. There is need to get_config before other aq_required will be send but iavf_close clears all flags, if get_config was not sent before iavf_close, then it will not be send at all.
In case when IAVF_FLAG_AQ_GET_OFFLOAD_VLAN_V2_CAPS was sent before IAVF_FLAG_AQ_DISABLE_QUEUES then there was rtnl_lock deadlock between iavf_close and iavf_adminq_task until iavf_close timeouts and disable queues was sent after iavf_close ends.
There was also a problem with sending delete/add filters. Sometimes when filters was not yet added to PF and in iavf_close all filters was set to remove there might be a try to remove nonexistent filters on PF.
Add aq_required_tmp to save aq_required flags and send them after disable_queues will be handled. Clear flags given to iavf_down different than IAVF_FLAG_AQ_GET_CONFIG as this flag is necessary to sent other aq_required. Remove some flags that we don't want to send as we are in iavf_close and we want to disable interface. Remove filters which was not yet sent and send del filters flags only when there are filters to remove.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 177 ++++++++++++++++---- 1 file changed, 141 insertions(+), 36 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +141 -36
@@ -1184,66 +1184,138 @@ static void iavf_up_complete(struct iavf_adapter *adapter) }/** -* iavf_down - Shutdown the connection processing +* iavf_clear_mac_vlan_filters - Remove mac and vlan filters not sent to PF +* yet and mark other to be removed. * @adapter: board private structure -* -* Expects to be called while holding the __IAVF_IN_CRITICAL_TASK bit lock. **/ -void iavf_down (struct iavf_adapter *adapter) +static void iavf_clear_mac_vlan_filters (struct iavf_adapter *adapter) { -struct net_device *netdev = adapter->netdev; -struct iavf_vlan_filter *vlf; -struct iavf_cloud_filter *cf; -struct iavf_fdir_fltr *fdir; -struct iavf_mac_filter *f; -struct iavf_adv_rss *rss; - -if (adapter->state <= __IAVF_DOWN_PENDING) -return ; - -netif_carrier_off (netdev); -netif_tx_disable (netdev); - adapter->link_up = false; -iavf_napi_disable_all (adapter); -iavf_irq_disable (adapter); +struct iavf_vlan_filter *vlf, *vlftmp; +struct iavf_mac_filter *f, *ftmp;spin_lock_bh (&adapter->mac_vlan_list_lock); -/* clear the sync flag on all filters */ __dev_uc_unsync (adapter->netdev,NULL );__dev_mc_unsync (adapter->netdev,NULL );/* remove all MAC filters */ -list_for_each_entry (f, &adapter->mac_filter_list, list) { - f->remove = true; +list_for_each_entry_safe (f, ftmp, &adapter->mac_filter_list, + list) { +if (f->add) { +list_del (&f->list); +kfree (f); + }else { + f->remove = true; + } }/* remove all VLAN filters */ -list_for_each_entry (vlf, &adapter->vlan_filter_list, list) { - vlf->remove = true; +list_for_each_entry_safe (vlf, vlftmp, &adapter->vlan_filter_list, + list) { +if (vlf->add) { +list_del (&vlf->list); +kfree (vlf); + }else { + vlf->remove = true; + } } -spin_unlock_bh (&adapter->mac_vlan_list_lock); +} + +/** +* iavf_clear_cloud_filters - Remove cloud filters not sent to PF yet and +* mark other to be removed. +* @adapter: board private structure +**/ +static void iavf_clear_cloud_filters (struct iavf_adapter *adapter) +{ +struct iavf_cloud_filter *cf, *cftmp;/* remove all cloud filters */ spin_lock_bh (&adapter->cloud_filter_list_lock); -list_for_each_entry (cf, &adapter->cloud_filter_list, list) { - cf->del = true; +list_for_each_entry_safe (cf, cftmp, &adapter->cloud_filter_list, + list) { +if (cf->add) { +list_del (&cf->list); +kfree (cf); + adapter->num_cloud_filters--; + }else { + cf->del = true; + } }spin_unlock_bh (&adapter->cloud_filter_list_lock); +} + +/** +* iavf_clear_fdir_filters - Remove fdir filters not sent to PF yet and mark +* other to be removed. +* @adapter: board private structure +**/ +static void iavf_clear_fdir_filters (struct iavf_adapter *adapter) +{ +struct iavf_fdir_fltr *fdir, *fdirtmp;/* remove all Flow Director filters */ spin_lock_bh (&adapter->fdir_fltr_lock); -list_for_each_entry (fdir, &adapter->fdir_list_head, list) { - fdir->state =IAVF_FDIR_FLTR_DEL_REQUEST ; +list_for_each_entry_safe (fdir, fdirtmp, &adapter->fdir_list_head, + list) { +if (fdir->state ==IAVF_FDIR_FLTR_ADD_REQUEST ) { +list_del (&fdir->list); +kfree (fdir); + adapter->fdir_active_fltr--; + }else { + fdir->state =IAVF_FDIR_FLTR_DEL_REQUEST ; + } }spin_unlock_bh (&adapter->fdir_fltr_lock); +} + +/** +* iavf_clear_adv_rss_conf - Remove adv rss conf not sent to PF yet and mark +* other to be removed. +* @adapter: board private structure +**/ +static void iavf_clear_adv_rss_conf (struct iavf_adapter *adapter) +{ +struct iavf_adv_rss *rss, *rsstmp;/* remove all advance RSS configuration */ spin_lock_bh (&adapter->adv_rss_lock); -list_for_each_entry (rss, &adapter->adv_rss_list_head, list) - rss->state =IAVF_ADV_RSS_DEL_REQUEST ; +list_for_each_entry_safe (rss, rsstmp, &adapter->adv_rss_list_head, + list) { +if (rss->state ==IAVF_ADV_RSS_ADD_REQUEST ) { +list_del (&rss->list); +kfree (rss); + }else { + rss->state =IAVF_ADV_RSS_DEL_REQUEST ; + } + }spin_unlock_bh (&adapter->adv_rss_lock); +} + +/** +* iavf_down - Shutdown the connection processing +* @adapter: board private structure +* +* Expects to be called while holding the __IAVF_IN_CRITICAL_TASK bit lock. +**/ +void iavf_down (struct iavf_adapter *adapter) +{ +struct net_device *netdev = adapter->netdev; + +if (adapter->state <= __IAVF_DOWN_PENDING) +return ; + +netif_carrier_off (netdev); +netif_tx_disable (netdev); + adapter->link_up = false; +iavf_napi_disable_all (adapter); +iavf_irq_disable (adapter); + +iavf_clear_mac_vlan_filters (adapter); +iavf_clear_cloud_filters (adapter); +iavf_clear_fdir_filters (adapter); +iavf_clear_adv_rss_conf (adapter);if (!(adapter->flags &IAVF_FLAG_PF_COMMS_FAILED )) {/* cancel any current operation */
@@ -1252,11 +1324,16 @@ void iavf_down(struct iavf_adapter *adapter)* here for this to complete. The watchdog is still running * and it will take care of this. */ - adapter->aq_required =IAVF_FLAG_AQ_DEL_MAC_FILTER ; - adapter->aq_required |=IAVF_FLAG_AQ_DEL_VLAN_FILTER ; - adapter->aq_required |=IAVF_FLAG_AQ_DEL_CLOUD_FILTER ; - adapter->aq_required |=IAVF_FLAG_AQ_DEL_FDIR_FILTER ; - adapter->aq_required |=IAVF_FLAG_AQ_DEL_ADV_RSS_CFG ; +if (!list_empty (&adapter->mac_filter_list)) + adapter->aq_required |=IAVF_FLAG_AQ_DEL_MAC_FILTER ; +if (!list_empty (&adapter->vlan_filter_list)) + adapter->aq_required |=IAVF_FLAG_AQ_DEL_VLAN_FILTER ; +if (!list_empty (&adapter->cloud_filter_list)) + adapter->aq_required |=IAVF_FLAG_AQ_DEL_CLOUD_FILTER ; +if (!list_empty (&adapter->fdir_list_head)) + adapter->aq_required |=IAVF_FLAG_AQ_DEL_FDIR_FILTER ; +if (!list_empty (&adapter->adv_rss_list_head)) + adapter->aq_required |=IAVF_FLAG_AQ_DEL_ADV_RSS_CFG ; adapter->aq_required |=IAVF_FLAG_AQ_DISABLE_QUEUES ; }
@@ -4082,6 +4159,7 @@ static int iavf_open(struct net_device *netdev)static int iavf_close (struct net_device *netdev) {struct iavf_adapter *adapter =netdev_priv (netdev); +u64 aq_to_restore;int status;mutex_lock (&adapter->crit_lock);
@@ -4094,6 +4172,29 @@ static int iavf_close(struct net_device *netdev)set_bit (__IAVF_VSI_DOWN, adapter->vsi.state);if (CLIENT_ENABLED (adapter)) adapter->flags |=IAVF_FLAG_CLIENT_NEEDS_CLOSE ; +/* We cannot send IAVF_FLAG_AQ_GET_OFFLOAD_VLAN_V2_CAPS before +* IAVF_FLAG_AQ_DISABLE_QUEUES because in such case there is rtnl +* deadlock with adminq_task() until iavf_close timeouts. We must send +* IAVF_FLAG_AQ_GET_CONFIG before IAVF_FLAG_AQ_DISABLE_QUEUES to make +* disable queues possible for vf. Give only necessary flags to +* iavf_down and save other to set them right before iavf_close() +* returns, when IAVF_FLAG_AQ_DISABLE_QUEUES will be already sent and +* iavf will be in DOWN state. +*/ + aq_to_restore = adapter->aq_required; + adapter->aq_required &=IAVF_FLAG_AQ_GET_CONFIG ; + +/* Remove flags which we do not want to send after close or we want to +* send before disable queues. +*/ + aq_to_restore &= ~(IAVF_FLAG_AQ_GET_CONFIG | +IAVF_FLAG_AQ_ENABLE_QUEUES | +IAVF_FLAG_AQ_CONFIGURE_QUEUES | +IAVF_FLAG_AQ_ADD_VLAN_FILTER | +IAVF_FLAG_AQ_ADD_MAC_FILTER | +IAVF_FLAG_AQ_ADD_CLOUD_FILTER | +IAVF_FLAG_AQ_ADD_FDIR_FILTER | +IAVF_FLAG_AQ_ADD_ADV_RSS_CFG );iavf_down (adapter);iavf_change_state (adapter, __IAVF_DOWN_PENDING);
@@ -4117,6 +4218,10 @@ static int iavf_close(struct net_device *netdev) msecs_to_jiffies(500));if (!status)netdev_warn (netdev,"Device resources not yet released\n" ); + +mutex_lock (&adapter->crit_lock); + adapter->aq_required |= aq_to_restore; +mutex_unlock (&adapter->crit_lock);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 574/717 wifi: brcmfmac: fix use-after-free bug in brcmf_netdev_start_xmit()
In reply to Greg Kroah-HartmanFrom: Alexander Coffin <[email protected]>
[ Upstream commit 3f42faf6db431e04bf942d2ebe3ae88975723478 ]
Quoted 1 line
ret =
brcmf_proto_tx_queue_data(drvr, ifp->ifidx, skb);
may be schedule, and then complete before the line
Quoted 1 line
ndev->stats.tx_bytes+=skb->len;
[ 46.912801] ================================================================== [ 46.920552] BUG: KASAN: use-after-free in brcmf_netdev_start_xmit+0x718/0x8c8 [brcmfmac] [ 46.928673] Read of size 4 at addr ffffff803f5882e8 by task systemd-resolve/328 [ 46.935991] [ 46.937514] CPU: 1 PID: 328 Comm: systemd-resolve Tainted: G O 5.4.199-[REDACTED] #1 [ 46.947255] Hardware name: [REDACTED] [ 46.954568] Call trace: [ 46.957037] dump_backtrace+0x0/0x2b8 [ 46.960719] show_stack+0x24/0x30 [ 46.964052] dump_stack+0x128/0x194 [ 46.967557] print_address_description.isra.0+0x64/0x380 [ 46.972877] __kasan_report+0x1d4/0x240 [ 46.976723] kasan_report+0xc/0x18 [ 46.980138] __asan_report_load4_noabort+0x18/0x20 [ 46.985027] brcmf_netdev_start_xmit+0x718/0x8c8 [brcmfmac] [ 46.990613] dev_hard_start_xmit+0x1bc/0xda0 [ 46.994894] sch_direct_xmit+0x198/0xd08 [ 46.998827] __qdisc_run+0x37c/0x1dc0 [ 47.002500] __dev_queue_xmit+0x1528/0x21f8 [ 47.006692] dev_queue_xmit+0x24/0x30 [ 47.010366] neigh_resolve_output+0x37c/0x678 [ 47.014734] ip_finish_output2+0x598/0x2458 [ 47.018927] __ip_finish_output+0x300/0x730 [ 47.023118] ip_output+0x2e0/0x430 [ 47.026530] ip_local_out+0x90/0x140 [ 47.030117] igmpv3_sendpack+0x14c/0x228 [ 47.034049] igmpv3_send_cr+0x384/0x6b8 [ 47.037895] igmp_ifc_timer_expire+0x4c/0x118 [ 47.042262] call_timer_fn+0x1cc/0xbe8 [ 47.046021] __run_timers+0x4d8/0xb28 [ 47.049693] run_timer_softirq+0x24/0x40 [ 47.053626] __do_softirq+0x2c0/0x117c [ 47.057387] irq_exit+0x2dc/0x388 [ 47.060715] __handle_domain_irq+0xb4/0x158 [ 47.064908] gic_handle_irq+0x58/0xb0 [ 47.068581] el0_irq_naked+0x50/0x5c [ 47.072162] [ 47.073665] Allocated by task 328: [ 47.077083] save_stack+0x24/0xb0 [ 47.080410] __kasan_kmalloc.isra.0+0xc0/0xe0 [ 47.084776] kasan_slab_alloc+0x14/0x20 [ 47.088622] kmem_cache_alloc+0x15c/0x468 [ 47.092643] __alloc_skb+0xa4/0x498 [ 47.096142] igmpv3_newpack+0x158/0xd78 [ 47.099987] add_grhead+0x210/0x288 [ 47.103485] add_grec+0x6b0/0xb70 [ 47.106811] igmpv3_send_cr+0x2e0/0x6b8 [ 47.110657] igmp_ifc_timer_expire+0x4c/0x118 [ 47.115027] call_timer_fn+0x1cc/0xbe8 [ 47.118785] __run_timers+0x4d8/0xb28 [ 47.122457] run_timer_softirq+0x24/0x40 [ 47.126389] __do_softirq+0x2c0/0x117c [ 47.130142] [ 47.131643] Freed by task 180: [ 47.134712] save_stack+0x24/0xb0 [ 47.138041] __kasan_slab_free+0x108/0x180 [ 47.142146] kasan_slab_free+0x10/0x18 [ 47.145904] slab_free_freelist_hook+0xa4/0x1b0 [ 47.150444] kmem_cache_free+0x8c/0x528 [ 47.154292] kfree_skbmem+0x94/0x108 [ 47.157880] consume_skb+0x10c/0x5a8 [ 47.161466] __dev_kfree_skb_any+0x88/0xa0 [ 47.165598] brcmu_pkt_buf_free_skb+0x44/0x68 [brcmutil] [ 47.171023] brcmf_txfinalize+0xec/0x190 [brcmfmac] [ 47.176016] brcmf_proto_bcdc_txcomplete+0x1c0/0x210 [brcmfmac] [ 47.182056] brcmf_sdio_sendfromq+0x8dc/0x1e80 [brcmfmac] [ 47.187568] brcmf_sdio_dpc+0xb48/0x2108 [brcmfmac] [ 47.192529] brcmf_sdio_dataworker+0xc8/0x238 [brcmfmac] [ 47.197859] process_one_work+0x7fc/0x1a80 [ 47.201965] worker_thread+0x31c/0xc40 [ 47.205726] kthread+0x2d8/0x370 [ 47.208967] ret_from_fork+0x10/0x18 [ 47.212546] [ 47.214051] The buggy address belongs to the object at ffffff803f588280 [ 47.214051] which belongs to the cache skbuff_head_cache of size 208 [ 47.227086] The buggy address is located 104 bytes inside of [ 47.227086] 208-byte region [ffffff803f588280, ffffff803f588350) [ 47.238814] The buggy address belongs to the page: [ 47.243618] page:ffffffff00dd6200 refcount:1 mapcount:0 mapping:ffffff804b6bf800 index:0xffffff803f589900 compound_mapcount: 0 [ 47.255007] flags: 0x10200(slab|head) [ 47.258689] raw: 0000000000010200 ffffffff00dfa980 0000000200000002 ffffff804b6bf800 [ 47.266439] raw: ffffff803f589900 0000000080190018 00000001ffffffff 0000000000000000 [ 47.274180] page dumped because: kasan: bad access detected [ 47.279752] [ 47.281251] Memory state around the buggy address: [ 47.286051] ffffff803f588180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 47.293277] ffffff803f588200: fb fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 47.300502] >ffffff803f588280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 47.307723] ^ [ 47.314343] ffffff803f588300: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc [ 47.321569] ffffff803f588380: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb [ 47.328789] ==================================================================
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +2 -1
@@ -296,6 +296,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,struct brcmf_pub *drvr = ifp->drvr;struct ethhdr *eh;int head_delta; +unsigned int tx_bytes = skb->len;brcmf_dbg (DATA ,"Enter, bsscfgidx=%d\n" , ifp->bsscfgidx);
@@ -370,7 +371,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, ndev->stats.tx_dropped++; }else { ndev->stats.tx_packets++; - ndev->stats.tx_bytes += skb->len; + ndev->stats.tx_bytes += tx_bytes; }/* Return ok: we always eat the packet */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 352/717 soc: qcom: smsm: Fix refcount leak bugs in qcom_smsm_probe()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit af8f6f39b8afd772fda4f8e61823ef8c021bf382 ]
There are two refcount leak bugs in qcom_smsm_probe():
(1) The 'local_node' is escaped out from for_each_child_of_node() as the break of iteration, we should call of_node_put() for it in error path or when it is not used anymore.
(2) The 'node' is escaped out from for_each_available_child_of_node() as the 'goto', we should call of_node_put() for it in goto target.
--- drivers/soc/qcom/smsm.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/soc/qcom/smsm.c +13 -7
@@ -526,7 +526,7 @@ static int qcom_smsm_probe(struct platform_device *pdev)for (id =0 ; id < smsm->num_hosts; id++) { ret =smsm_parse_ipc (smsm, id);if (ret <0 ) -return ret; + goto out_put; }/* Acquire the main SMSM state vector */
@@ -534,13 +534,14 @@ static int qcom_smsm_probe(struct platform_device *pdev) smsm->num_entries * sizeof(u32));if (ret <0 && ret != -EEXIST ) {dev_err (&pdev->dev,"unable to allocate shared state entry\n" ); -return ret; + goto out_put; } states =qcom_smem_get (QCOM_SMEM_HOST_ANY ,SMEM_SMSM_SHARED_STATE ,NULL );if (IS_ERR (states)) {dev_err (&pdev->dev,"Unable to acquire shared state entry\n" ); -return PTR_ERR (states); + ret =PTR_ERR (states); + goto out_put; }/* Acquire the list of interrupt mask vectors */
@@ -548,13 +549,14 @@ static int qcom_smsm_probe(struct platform_device *pdev) ret =qcom_smem_alloc (QCOM_SMEM_HOST_ANY ,SMEM_SMSM_CPU_INTR_MASK , size);if (ret <0 && ret != -EEXIST ) {dev_err (&pdev->dev,"unable to allocate smsm interrupt mask\n" ); -return ret; + goto out_put; } intr_mask =qcom_smem_get (QCOM_SMEM_HOST_ANY ,SMEM_SMSM_CPU_INTR_MASK ,NULL );if (IS_ERR (intr_mask)) {dev_err (&pdev->dev,"unable to acquire shared memory interrupt mask\n" ); -return PTR_ERR (intr_mask); + ret =PTR_ERR (intr_mask); + goto out_put; }/* Setup the reference to the local state bits */
@@ -565,7 +567,8 @@ static int qcom_smsm_probe(struct platform_device *pdev) smsm->state =qcom_smem_state_register (local_node, &smsm_state_ops, smsm);if (IS_ERR (smsm->state)) {dev_err (smsm->dev,"failed to register qcom_smem_state\n" ); -return PTR_ERR (smsm->state); + ret =PTR_ERR (smsm->state); + goto out_put; }/* Register handlers for remote processor entries of interest. */
@@ -595,16 +598,19 @@ static int qcom_smsm_probe(struct platform_device *pdev) }platform_set_drvdata (pdev, smsm); +of_node_put (local_node);return 0 ; unwind_interfaces: +of_node_put (node);for (id =0 ; id < smsm->num_entries; id++)if (smsm->entries[id].domain)irq_domain_remove (smsm->entries[id].domain);qcom_smem_state_unregister (smsm->state); - +out_put: +of_node_put (local_node);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 556/717 wifi: ath10k: Set tx credit to one for WCN3990 snoc based devices
In reply to Greg Kroah-HartmanFrom: Youghandhar Chintala <[email protected]>
[ Upstream commit d81bbb684c250a637186d9286d75b1cb04d2986c ]
Currently host can send two WMI commands at once. There is possibility to cause SMMU issues or corruption, if host wants to initiate 2 DMA transfers, it is possible when copy complete interrupt for first DMA reaches host, CE has already updated SRRI (Source ring read index) for both DMA transfers and is in the middle of 2nd DMA. Host uses SRRI (Source ring read index) to interpret how many DMA’s have been completed and tries to unmap/free both the DMA entries. Hence now it is limiting to one.Because CE is still in the middle of 2nd DMA which can cause these issues when handling two DMA transfers.
This change will not impact other targets, as it is only for WCN3990.
Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.2.0-01387-QCAHLSWMTPLZ-1
--- drivers/net/wireless/ath/ath10k/core.c | 16 ++++++++++++++++ drivers/net/wireless/ath/ath10k/htc.c | 11 ++++++++--- drivers/net/wireless/ath/ath10k/hw.h | 2 ++ 3 files changed, 26 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +16 -0
@@ -95,6 +95,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = true, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA988X_HW_2_0_VERSION,
@@ -133,6 +134,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = true, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9887_HW_1_0_VERSION,
@@ -172,6 +174,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_3_2_VERSION,
@@ -206,6 +209,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .supports_peer_stats_info = true, .dynamic_sar_support = true, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_2_1_VERSION,
@@ -244,6 +248,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_2_1_VERSION,
@@ -282,6 +287,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_3_0_VERSION,
@@ -320,6 +326,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_3_2_VERSION,
@@ -362,6 +369,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .supports_peer_stats_info = true, .dynamic_sar_support = true, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA99X0_HW_2_0_DEV_VERSION,
@@ -406,6 +414,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9984_HW_1_0_DEV_VERSION,
@@ -457,6 +466,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9888_HW_2_0_DEV_VERSION,
@@ -505,6 +515,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9377_HW_1_0_DEV_VERSION,
@@ -543,6 +554,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9377_HW_1_1_DEV_VERSION,
@@ -583,6 +595,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9377_HW_1_1_DEV_VERSION,
@@ -614,6 +627,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .credit_size_workaround = true, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA4019_HW_1_0_DEV_VERSION,
@@ -659,6 +673,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = WCN3990_HW_1_0_DEV_VERSION,
@@ -690,6 +705,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = true, .hw_restart_disconnect = true, + .use_fw_tx_credits = false, }, };
drivers/net/wireless/ath/ath10k/htc.c +8 -3
@@ -947,13 +947,18 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc)return -ECOMM ; } - htc->total_transmit_credits =__le16_to_cpu (msg->ready.credit_count); +if (ar->hw_params.use_fw_tx_credits) + htc->total_transmit_credits =__le16_to_cpu (msg->ready.credit_count); +else + htc->total_transmit_credits =1 ; + htc->target_credit_size =__le16_to_cpu (msg->ready.credit_size);ath10k_dbg (ar,ATH10K_DBG_HTC , -"Target ready! transmit resources: %d size:%d\n" , +"Target ready! transmit resources: %d size:%d actual credits:%d\n" , htc->total_transmit_credits, - htc->target_credit_size); + htc->target_credit_size, + msg->ready.credit_count);if ((htc->total_transmit_credits ==0 ) || (htc->target_credit_size ==0 )) {
drivers/net/wireless/ath/ath10k/hw.h +2 -0
@@ -635,6 +635,8 @@ struct ath10k_hw_params {bool dynamic_sar_support;bool hw_restart_disconnect; + +bool use_fw_tx_credits; };struct htt_resp ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 543/717 cpufreq: amd_pstate: fix wrong lowest perf fetch
In reply to Greg Kroah-HartmanFrom: Perry Yuan <[email protected]>
[ Upstream commit b185c5053c65b7704ead4537e4d4d9b33dc398dc ]
Fix the wrong lowest perf value reading which is used for new des_perf calculation by governor requested, the incorrect min_perf will get incorrect des_perf to be set , that will cause the system frequency changing unexpectedly.
--- drivers/cpufreq/amd-pstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/amd-pstate.c +1 -1
@@ -322,7 +322,7 @@ static int amd_pstate_target(struct cpufreq_policy *policy,return -ENODEV ; cap_perf =READ_ONCE (cpudata->highest_perf); - min_perf =READ_ONCE (cpudata->lowest_nonlinear_perf); + min_perf =READ_ONCE (cpudata->lowest_perf); max_perf = cap_perf; freqs.old = policy->cur;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 434/717 ata: fix ata_id_sense_reporting_enabled() and ata_id_has_sense_reporting()
In reply to Greg Kroah-HartmanFrom: Niklas Cassel <[email protected]>
[ Upstream commit 690aa8c3ae308bc696ec8b1b357b995193927083 ]
ACS-5 section
7.13.6.41 Words 85..87, 120: Commands and feature sets supported or enabled states that:
If bit 15 of word 86 is set to one, bit 14 of word 119 is set to one, and bit 15 of word 119 is cleared to zero, then word 119 is valid.
If bit 15 of word 86 is set to one, bit 14 of word 120 is set to one, and bit 15 of word 120 is cleared to zero, then word 120 is valid.
(This text also exists in really old ACS standards, e.g. ACS-3.)
Currently, ata_id_sense_reporting_enabled() and ata_id_has_sense_reporting() both check bit 15 of word 86, but neither of them check that bit 14 of word 119 is set to one, or that bit 15 of word 119 is cleared to zero.
Additionally, make ata_id_sense_reporting_enabled() return false if !ata_id_has_sense_reporting(), similar to how e.g. ata_id_flush_ext_enabled() returns false if !ata_id_has_flush_ext().
--- include/linux/ata.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
include/linux/ata.h +9 -4
@@ -771,16 +771,21 @@ static inline bool ata_id_has_read_log_dma_ext(const u16 *id)static inline bool ata_id_has_sense_reporting (const u16 *id) { -if (!(id[ATA_ID_CFS_ENABLE_2 ] & (1 <<15 ))) +if (!(id[ATA_ID_CFS_ENABLE_2 ] &BIT (15 ))) +return false; +if ((id[ATA_ID_COMMAND_SET_3 ] & (BIT (15 ) |BIT (14 ))) !=BIT (14 ))return false; -return id[ATA_ID_COMMAND_SET_3 ] & (1 <<6 ); +return id[ATA_ID_COMMAND_SET_3 ] &BIT (6 ); }static inline bool ata_id_sense_reporting_enabled (const u16 *id) { -if (!(id[ATA_ID_CFS_ENABLE_2 ] & (1 <<15 ))) +if (!ata_id_has_sense_reporting (id)) +return false; +/* ata_id_has_sense_reporting() == true, word 86 must have bit 15 set */ +if ((id[ATA_ID_COMMAND_SET_4 ] & (BIT (15 ) |BIT (14 ))) !=BIT (14 ))return false; -return id[ATA_ID_COMMAND_SET_4 ] & (1 <<6 ); +return id[ATA_ID_COMMAND_SET_4 ] &BIT (6 ); }/**
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 575/717 Bluetooth: btintel: Mark Intel controller to support LE_STATES quirk
In reply to Greg Kroah-HartmanFrom: Kiran K <[email protected]>
[ Upstream commit dd0a1794f4334ddbf9b7c5e7d642aaffff38c69b ]
HarrrisonPeak, CyclonePeak, SnowFieldPeak and SandyPeak controllers are marked to support HCI_QUIRK_LE_STATES.
--- drivers/bluetooth/btintel.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/bluetooth/btintel.c +8 -9
@@ -2439,15 +2439,20 @@ static int btintel_setup_combined(struct hci_dev *hdev) INTEL_ROM_LEGACY_NO_WBS_SUPPORT)) set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); +if (ver.hw_variant ==0x08 && ver.fw_variant ==0x22 ) +set_bit (HCI_QUIRK_VALID_LE_STATES , + &hdev->quirks); err =btintel_legacy_rom_setup (hdev, &ver);break ;case 0x0b :/* SfP */ -case 0x0c :/* WsP */ case 0x11 :/* JfP */ case 0x12 :/* ThP */ case 0x13 :/* HrP */ case 0x14 :/* CcP */ +set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks); + fallthrough; +case 0x0c :/* WsP */ /* Apply the device specific HCI quirks * * All Legacy bootloader devices support WBS
@@ -2455,11 +2460,6 @@ static int btintel_setup_combined(struct hci_dev *hdev)set_bit (HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED , &hdev->quirks); -/* Valid LE States quirk for JfP/ThP familiy */ -if (ver.hw_variant ==0x11 || ver.hw_variant ==0x12 ) -set_bit (HCI_QUIRK_VALID_LE_STATES , - &hdev->quirks); -/* Setup MSFT Extension support */ btintel_set_msft_opcode (hdev, ver.hw_variant);
@@ -2530,9 +2530,8 @@ static int btintel_setup_combined(struct hci_dev *hdev)*/ set_bit (HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED , &hdev->quirks); -/* Valid LE States quirk for JfP/ThP familiy */ -if (ver.hw_variant ==0x11 || ver.hw_variant ==0x12 ) -set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks); +/* Set Valid LE States quirk */ +set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks);/* Setup MSFT Extension support */ btintel_set_msft_opcode (hdev, ver.hw_variant);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 549/717 powercap: intel_rapl: fix UBSAN shift-out-of-bounds issue
In reply to Greg Kroah-HartmanFrom: Chao Qin <[email protected]>
[ Upstream commit 2d93540014387d1c73b9ccc4d7895320df66d01b ]
When value < time_unit, the parameter of ilog2() will be zero and the return value is -1. u64(-1) is too large for shift exponent and then will trigger shift-out-of-bounds:
shift exponent 18446744073709551615 is too large for 32-bit type 'int'
Call Trace: rapl_compute_time_window_core rapl_write_data_raw set_time_window store_constraint_time_window_us
--- drivers/powercap/intel_rapl_common.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/powercap/intel_rapl_common.c +3 -0
@@ -994,6 +994,9 @@ static u64 rapl_compute_time_window_core(struct rapl_package *rp, u64 value, y = value &0x1f ; value = (1 << y) * (4 + f) * rp->time_unit /4 ; }else { +if (value < rp->time_unit) +return 0 ; +do_div (value, rp->time_unit); y =ilog2 (value); f =div64_u64 (4 * (value - (1 << y)),1 << y);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 580/717 wifi: rtw89: fix rx filter after scan
In reply to Greg Kroah-HartmanFrom: Po-Hao Huang <[email protected]>
[ Upstream commit 812825c2b204c491f1a5586c602e4ac75060493a ]
In monitor mode we should be able to received all packets even if it's not destined to us. But after scan, the configuration was wrongly set, so we fix it.
--- drivers/net/wireless/realtek/rtw89/fw.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/net/wireless/realtek/rtw89/fw.c +5 -7
@@ -2288,6 +2288,7 @@ void rtw89_hw_scan_start(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, {struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;struct cfg80211_scan_request *req = &scan_req->req; +u32 rx_fltr = rtwdev->hal.rx_fltr;u8 mac_addr[ETH_ALEN ]; rtwdev->scan_info.scanning_vif = vif;
@@ -2302,13 +2303,13 @@ void rtw89_hw_scan_start(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,ether_addr_copy (mac_addr, vif->addr);rtw89_core_scan_start (rtwdev, rtwvif, mac_addr, true); - rtwdev->hal.rx_fltr &= ~B_AX_A_BCN_CHK_EN ; - rtwdev->hal.rx_fltr &= ~B_AX_A_BC ; - rtwdev->hal.rx_fltr &= ~B_AX_A_A1_MATCH ; + rx_fltr &= ~B_AX_A_BCN_CHK_EN ; + rx_fltr &= ~B_AX_A_BC ; + rx_fltr &= ~B_AX_A_A1_MATCH ;rtw89_write32_mask (rtwdev,rtw89_mac_reg_by_idx (R_AX_RX_FLTR_OPT ,RTW89_MAC_0 ),B_AX_RX_FLTR_CFG_MASK , - rtwdev->hal.rx_fltr); + rx_fltr); } void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
@@ -2322,9 +2323,6 @@ void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,if (!vif)return ; - rtwdev->hal.rx_fltr |=B_AX_A_BCN_CHK_EN ; - rtwdev->hal.rx_fltr |=B_AX_A_BC ; - rtwdev->hal.rx_fltr |=B_AX_A_A1_MATCH ; rtw89_write32_mask(rtwdev, rtw89_mac_reg_by_idx(R_AX_RX_FLTR_OPT, RTW89_MAC_0), B_AX_RX_FLTR_CFG_MASK,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 324/717 drm/bochs: fix blanking
In reply to Greg Kroah-HartmanFrom: Gerd Hoffmann <[email protected]>
[ Upstream commit e740ceb53e4579a7a4063712cebecac3c343b189 ]
VGA_IS1_RC is the color mode register (VGA_IS1_RM the one for monochrome mode, note C vs. M at the end). So when using VGA_IS1_RC make sure the vga device is actually in color mode and set the corresponding bit in the misc register.
Reproducible when booting VMs in UEFI mode with some edk2 versions (edk2 fix is on the way too). Doesn't happen in BIOS mode because in that case the vgabios already flips the bit.
--- drivers/gpu/drm/tiny/bochs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/tiny/bochs.c +2 -0
@@ -306,6 +306,8 @@ static void bochs_hw_fini(struct drm_device *dev)static void bochs_hw_blank (struct bochs_device *bochs,bool blank) {DRM_DEBUG_DRIVER ("hw_blank %d\n" , blank); +/* enable color bit (so VGA_IS1_RC access works) */ +bochs_vga_writeb (bochs,VGA_MIS_W ,VGA_MIS_COLOR );/* discard ar_flip_flop */ (void )bochs_vga_readb (bochs,VGA_IS1_RC );/* blank or unblank; we need only update index and set 0x20 */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 433/717 RDMA/siw: Fix QP destroy to wait for all references dropped.
In reply to Greg Kroah-HartmanFrom: Bernard Metzler <[email protected]>
[ Upstream commit a3c278807a459e6f50afee6971cabe74cccfb490 ]
Delay QP destroy completion until all siw references to QP are dropped. The calling RDMA core will free QP structure after successful return from siw_qp_destroy() call, so siw must not hold any remaining reference to the QP upon return. A use-after-free was encountered in xfstest generic/460, while testing NFSoRDMA. Here, after a TCP connection drop by peer, the triggered siw_cm_work_handler got delayed until after QP destroy call, referencing a QP which has already freed.
--- drivers/infiniband/sw/siw/siw.h | 1 + drivers/infiniband/sw/siw/siw_qp.c | 2 +- drivers/infiniband/sw/siw/siw_verbs.c | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-)
drivers/infiniband/sw/siw/siw.h +1 -0
@@ -418,6 +418,7 @@ struct siw_qp {struct ib_qp base_qp;struct siw_device *sdev;struct kref ref; +struct completion qp_free;struct list_head devq;int tx_cpu;struct siw_qp_attrs attrs;
drivers/infiniband/sw/siw/siw_qp.c +1 -1
@@ -1342,6 +1342,6 @@ void siw_free_qp(struct kref *ref)vfree (qp->orq);siw_put_tx_cpu (qp->tx_cpu); - +complete (&qp->qp_free);atomic_dec (&sdev->num_qp); }
drivers/infiniband/sw/siw/siw_verbs.c +3 -0
@@ -480,6 +480,8 @@ int siw_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attrs,list_add_tail (&qp->devq, &sdev->qp_list);spin_unlock_irqrestore (&sdev->lock, flags); +init_completion (&qp->qp_free); +return 0 ; err_out_xa:
@@ -624,6 +626,7 @@ int siw_destroy_qp(struct ib_qp *base_qp, struct ib_udata *udata) qp->scq = qp->rcq =NULL ;siw_qp_put (qp); +wait_for_completion (&qp->qp_free);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 586/717 wifi: rt2x00: dont run Rt5592 IQ calibration on MT7620
In reply to Greg Kroah-HartmanFrom: Daniel Golle <[email protected]>
[ Upstream commit d3aad83d05aec0cfd7670cf0028f2ad4b81de92e ]
The function rt2800_iq_calibrate is intended for Rt5592 only. Don't call it for MT7620 which has it's own calibration functions.
--- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +2 -1
@@ -4365,7 +4365,8 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, reg = (rf->channel <=14 ?0x1c :0x24 ) +2 *rt2x00dev->lna_gain;rt2800_bbp_write_with_rx_chain (rt2x00dev,66 , reg); -rt2800_iq_calibrate (rt2x00dev, rf->channel); +if (rt2x00_rt (rt2x00dev,RT5592 )) +rt2800_iq_calibrate (rt2x00dev, rf->channel); } bbp =rt2800_bbp_read (rt2x00dev,4 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 423/717 remoteproc: Harden rproc_handle_vdev() against integer overflow
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 7d7f8fe4e399519cc9ac68a475fec6d3a996341b ]
The struct_size() macro protects against integer overflows but adding "+ rsc->config_len" introduces the risk of integer overflows again. Use size_add() to be safe.
--- drivers/remoteproc/remoteproc_core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/remoteproc/remoteproc_core.c +3 -2
@@ -518,12 +518,13 @@ static int rproc_handle_vdev(struct rproc *rproc, void *ptr,struct fw_rsc_vdev *rsc = ptr;struct device *dev = &rproc->dev;struct rproc_vdev *rvdev; +size_t rsc_size;int i, ret;char name[16 ];/* make sure resource isn't truncated */ -if (struct_size (rsc, vring, rsc->num_of_vrings) + rsc->config_len > - avail) { + rsc_size =struct_size (rsc, vring, rsc->num_of_vrings); +if (size_add (rsc_size, rsc->config_len) > avail) {dev_err (dev,"vdev rsc is truncated\n" );return -EINVAL ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 562/717 openvswitch: Fix overreporting of drops in dropwatch
In reply to Greg Kroah-HartmanFrom: Mike Pattrick <[email protected]>
[ Upstream commit c21ab2afa2c64896a7f0e3cbc6845ec63dcfad2e ]
Currently queue_userspace_packet will call kfree_skb for all frames, whether or not an error occurred. This can result in a single dropped frame being reported as multiple drops in dropwatch. This functions caller may also call kfree_skb in case of an error. This patch will consume the skbs instead and allow caller's to use kfree_skb.
--- net/openvswitch/datapath.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/openvswitch/datapath.c +3 -2
@@ -558,8 +558,9 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, out:if (err)skb_tx_error (skb); -kfree_skb (user_skb); -kfree_skb (nskb); +consume_skb (user_skb); +consume_skb (nskb); +return err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 578/717 wifi: mt76: mt7921: reset msta->airtime_ac while clearing up hw value
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 1bf66dc31032ff5292f4d5b76436653f269fcfbd ]
We should reset mstat->airtime_ac along with clear up the entries in the hardware WLAN table for the Rx and Rx accumulative airtime. Otherwsie, the value msta->airtime_ac - [tx, rx]_last may be a negative and that is not the actual airtime the device took in the last run.
--- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/mt7921/main.c +1 -0
@@ -738,6 +738,7 @@ void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,mt7921_mac_wtbl_update (dev, msta->wcid.idx,MT_WTBL_UPDATE_ADM_COUNT_CLEAR ); +memset (msta->airtime_ac,0 ,sizeof (msta->airtime_ac));mt7921_mcu_sta_update (dev, sta, vif, true,MT76_STA_INFO_STATE_ASSOC );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 414/717 dmaengine: hisilicon: Fix CQ head update
In reply to Greg Kroah-HartmanFrom: Jie Hai <[email protected]>
[ Upstream commit 94477a79cf80e8ab55b68f14bc579a12ddea1e0b ]
After completion of data transfer of one or multiple descriptors, the completion status and the current head pointer to submission queue are written into the CQ and interrupt can be generated to inform the software. In interrupt process CQ is read and cq_head is updated.
hisi_dma_irq updates cq_head only when the completion status is success. When an abnormal interrupt reports, cq_head will not update which will cause subsequent interrupt processes read the error CQ and never report the correct status.
This patch updates cq_head whenever CQ is accessed.
--- drivers/dma/hisi_dma.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/dma/hisi_dma.c +3 -5
@@ -436,12 +436,10 @@ static irqreturn_t hisi_dma_irq(int irq, void *data) desc = chan->desc; cqe = chan->cq + chan->cq_head;if (desc) { + chan->cq_head = (chan->cq_head +1 ) % hdma_dev->chan_depth; +hisi_dma_chan_write (hdma_dev->base,HISI_DMA_CQ_HEAD_PTR , + chan->qp_num, chan->cq_head);if (FIELD_GET (STATUS_MASK , cqe->w0) ==STATUS_SUCC ) { - chan->cq_head = (chan->cq_head +1 ) % - hdma_dev->chan_depth; -hisi_dma_chan_write (hdma_dev->base, -HISI_DMA_CQ_HEAD_PTR , chan->qp_num, - chan->cq_head);vchan_cookie_complete (&desc->vd); }else {dev_err (&hdma_dev->pdev->dev,"task error!\n" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 558/717 bpftool: Clear errno after libcaps checks
In reply to Greg Kroah-HartmanFrom: Quentin Monnet <[email protected]>
[ Upstream commit cea558855c39b7f1f02ff50dcf701ca6596bc964 ]
When bpftool is linked against libcap, the library runs a "constructor" function to compute the number of capabilities of the running kernel [0], at the beginning of the execution of the program. As part of this, it performs multiple calls to prctl(). Some of these may fail, and set errno to a non-zero value:
# strace -e prctl ./bpftool version
prctl(PR_CAPBSET_READ, CAP_MAC_OVERRIDE) = 1
prctl(PR_CAPBSET_READ, 0x30 /* CAP_??? */) = -1 EINVAL (Invalid argument)
prctl(PR_CAPBSET_READ, CAP_CHECKPOINT_RESTORE) = 1
prctl(PR_CAPBSET_READ, 0x2c /* CAP_??? */) = -1 EINVAL (Invalid argument)
prctl(PR_CAPBSET_READ, 0x2a /* CAP_??? */) = -1 EINVAL (Invalid argument)
prctl(PR_CAPBSET_READ, 0x29 /* CAP_??? */) = -1 EINVAL (Invalid argument)
** fprintf added at the top of main(): we have errno == 1
./bpftool v7.0.0
using libbpf v1.0
features: libbfd, libbpf_strict, skeletons
+++ exited with 0 +++This has been addressed in libcap 2.63 [1], but until this version is available everywhere, we can fix it on bpftool side.
Let's clean errno at the beginning of the main() function, to make sure that these checks do not interfere with the batch mode, where we error out if errno is set after a bpftool command.
[0] https://git.kernel.org/pub/scm/libs/libcap/libcap.git/tree/libcap/cap_alloc.c?h=libcap-2.65#n20
[1] https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=f25a1b7e69f7b33e6afb58b3e38f3450b7d2d9a0
--- tools/bpf/bpftool/main.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
tools/bpf/bpftool/main.c +10 -0
@@ -435,6 +435,16 @@ int main(int argc, char **argv)setlinebuf (stdout); +#ifdef USE_LIBCAP +/* Libcap < 2.63 hooks before main() to compute the number of +* capabilities of the running kernel, and doing so it calls prctl() +* which may fail and set errno to non-zero. +* Let's reset errno to make sure this does not interfere with the +* batch mode. +*/ + errno =0 ; +#endif + last_do_help = do_help; pretty_output = false; json_output = false;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 298/717 drm/mipi-dsi: Detach devices when removing the host
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 668a8f17b5290d04ef7343636a5588a0692731a1 ]
Whenever the MIPI-DSI host is unregistered, the code of mipi_dsi_host_unregister() loops over every device currently found on that bus and will unregister it.
However, it doesn't detach it from the bus first, which leads to all kind of resource leaks if the host wants to perform some clean up whenever a device is detached.
--- drivers/gpu/drm/drm_mipi_dsi.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/drm_mipi_dsi.c +1 -0
@@ -346,6 +346,7 @@ static int mipi_dsi_remove_device_fn(struct device *dev, void *priv) {struct mipi_dsi_device *dsi =to_mipi_dsi_device (dev); +mipi_dsi_detach (dsi);mipi_dsi_device_unregister (dsi);return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 313/717 ASoC: tas2764: Fix mute/unmute
In reply to Greg Kroah-HartmanFrom: Martin Povišer <[email protected]>
[ Upstream commit f5ad67f13623548e5aff847f89700c178aaf2a98 ]
Because the PWR_CTRL field is modeled as the power state of the DAC widget, and at the same time it is used to implement mute/unmute, we need some additional book-keeping to have the right end result no matter the sequence of calls. Without this fix, one permanently mutes an ongoing stream by toggling the associated speaker pin control.
(This mirrors commit 1e5907bcb3a3 ("ASoC: tas2770: Fix handling of mute/unmute") which was a fix to the tas2770 driver.)
--- sound/soc/codecs/tas2764.c | 57 +++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 25 deletions(-)
sound/soc/codecs/tas2764.c +32 -25
@@ -34,6 +34,9 @@ struct tas2764_priv {int v_sense_slot;int i_sense_slot; + +bool dac_powered; +bool unmuted; };static void tas2764_reset (struct tas2764_priv *tas2764)
@@ -50,6 +53,26 @@ static void tas2764_reset(struct tas2764_priv *tas2764)usleep_range (1000 ,2000 ); } +static int tas2764_update_pwr_ctrl (struct tas2764_priv *tas2764) +{ +struct snd_soc_component *component = tas2764->component; +unsigned int val; +int ret; + +if (tas2764->dac_powered) + val = tas2764->unmuted ? +TAS2764_PWR_CTRL_ACTIVE :TAS2764_PWR_CTRL_MUTE ; +else + val =TAS2764_PWR_CTRL_SHUTDOWN ; + + ret =snd_soc_component_update_bits (component,TAS2764_PWR_CTRL , +TAS2764_PWR_CTRL_MASK , val); +if (ret <0 ) +return ret; + +return 0 ; +} +#ifdef CONFIG_PM static int tas2764_codec_suspend (struct snd_soc_component *component) {
@@ -82,9 +105,7 @@ static int tas2764_codec_resume(struct snd_soc_component *component)usleep_range (1000 ,2000 ); } - ret =snd_soc_component_update_bits (component,TAS2764_PWR_CTRL , -TAS2764_PWR_CTRL_MASK , -TAS2764_PWR_CTRL_ACTIVE ); + ret =tas2764_update_pwr_ctrl (tas2764);if (ret <0 )return ret;
@@ -118,14 +139,12 @@ static int tas2764_dac_event(struct snd_soc_dapm_widget *w,switch (event) {case SND_SOC_DAPM_POST_PMU : - ret =snd_soc_component_update_bits (component,TAS2764_PWR_CTRL , -TAS2764_PWR_CTRL_MASK , -TAS2764_PWR_CTRL_MUTE ); + tas2764->dac_powered = true; + ret =tas2764_update_pwr_ctrl (tas2764);break ;case SND_SOC_DAPM_PRE_PMD : - ret =snd_soc_component_update_bits (component,TAS2764_PWR_CTRL , -TAS2764_PWR_CTRL_MASK , -TAS2764_PWR_CTRL_SHUTDOWN ); + tas2764->dac_powered = false; + ret =tas2764_update_pwr_ctrl (tas2764);break ;default :dev_err (tas2764->dev,"Unsupported event\n" );
@@ -170,17 +189,11 @@ static const struct snd_soc_dapm_route tas2764_audio_map[] = {static int tas2764_mute (struct snd_soc_dai *dai,int mute,int direction) { -struct snd_soc_component *component = dai->component; -int ret; - - ret =snd_soc_component_update_bits (component,TAS2764_PWR_CTRL , -TAS2764_PWR_CTRL_MASK , - mute ?TAS2764_PWR_CTRL_MUTE :0 ); +struct tas2764_priv *tas2764 = +snd_soc_component_get_drvdata (dai->component); -if (ret <0 ) -return ret; - -return 0 ; + tas2764->unmuted = !mute; +return tas2764_update_pwr_ctrl (tas2764); }static int tas2764_set_bitwidth (struct tas2764_priv *tas2764,int bitwidth)
@@ -494,12 +507,6 @@ static int tas2764_codec_probe(struct snd_soc_component *component)if (ret <0 )return ret; - ret =snd_soc_component_update_bits (component,TAS2764_PWR_CTRL , -TAS2764_PWR_CTRL_MASK , -TAS2764_PWR_CTRL_MUTE ); -if (ret <0 ) -return ret; -return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 521/717 clocksource/drivers/arm_arch_timer: Fix handling of ARM erratum 858921
In reply to Greg Kroah-HartmanFrom: Kunkun Jiang <[email protected]>
[ Upstream commit 6c3b62d93e195f78c1437c8fa7581e9b2f00886e ]
The commit a38b71b0833e ("clocksource/drivers/arm_arch_timer:
Move system register timer programming over to CVAL") moves the programming of the timers from the countdown timer (TVAL) over to the comparator (CVAL). This makes it necessary to read the counter when programming next event. However, the workaround of Cortex-A73 erratum 858921 does not set the corresponding set_next_event_phys and set_next_event_virt.
Add the appropriate hooks to apply the erratum mitigation when programming the next timer event.
--- drivers/clocksource/arm_arch_timer.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clocksource/arm_arch_timer.c +2 -0
@@ -473,6 +473,8 @@ static const struct arch_timer_erratum_workaround ool_workarounds[] = { .desc = "ARM erratum 858921", .read_cntpct_el0 = arm64_858921_read_cntpct_el0, .read_cntvct_el0 = arm64_858921_read_cntvct_el0, + .set_next_event_phys = erratum_set_next_event_phys, + .set_next_event_virt = erratum_set_next_event_virt, },#endif #ifdef CONFIG_SUN50I_ERRATUM_UNKNOWN1
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 223/717 Bluetooth: btusb: mediatek: fix WMT failure during runtime suspend
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit fd3f106677bac70437dc12e76c827294ed495a44 ]
WMT cmd/event doesn't follow up the generic HCI cmd/event handling, it needs constantly polling control pipe until the host received the WMT event, thus, we should require to specifically acquire PM counter on the USB to prevent the interface from entering auto suspended while WMT cmd/event in progress.
--- drivers/bluetooth/btusb.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/bluetooth/btusb.c +14 -0
@@ -2451,15 +2451,29 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev,set_bit (BTUSB_TX_WAIT_VND_EVT , &data->flags); +/* WMT cmd/event doesn't follow up the generic HCI cmd/event handling, +* it needs constantly polling control pipe until the host received the +* WMT event, thus, we should require to specifically acquire PM counter +* on the USB to prevent the interface from entering auto suspended +* while WMT cmd/event in progress. +*/ + err =usb_autopm_get_interface (data->intf); +if (err <0 ) + goto err_free_wc; + err =__hci_cmd_send (hdev,0xfc6f , hlen, wc);if (err <0 ) {clear_bit (BTUSB_TX_WAIT_VND_EVT , &data->flags); +usb_autopm_put_interface (data->intf); goto err_free_wc; }/* Submit control IN URB on demand to process the WMT event */ err =btusb_mtk_submit_wmt_recv_urb (hdev); + +usb_autopm_put_interface (data->intf); +if (err <0 ) goto err_free_wc;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 560/717 net: ethernet: ti: davinci_mdio: Add workaround for errata i2329
In reply to Greg Kroah-HartmanFrom: Ravi Gunasekaran <[email protected]>
[ Upstream commit d04807b80691c6041ca8e3dcf1870d1bf1082c22 ]
On the CPSW and ICSS peripherals, there is a possibility that the MDIO interface returns corrupt data on MDIO reads or writes incorrect data on MDIO writes. There is also a possibility for the MDIO interface to become unavailable until the next peripheral reset.
The workaround is to configure the MDIO in manual mode and disable the MDIO state machine and emulate the MDIO protocol by reading and writing appropriate fields in MDIO_MANUAL_IF_REG register of the MDIO controller to manipulate the MDIO clock and data pins.
More details about the errata i2329 and the workaround is available in:
https://www.ti.com/lit/er/sprz487a/sprz487a.pdf
Add implementation to disable MDIO state machine, configure MDIO in manual mode and achieve MDIO read and writes via MDIO Bitbanging
--- drivers/net/ethernet/ti/davinci_mdio.c | 242 +++++++++++++++++++++++-- 1 file changed, 231 insertions(+), 11 deletions(-)
drivers/net/ethernet/ti/davinci_mdio.c +231 -11
@@ -26,6 +26,8 @@#include <linux/of_device.h> #include <linux/of_mdio.h> #include <linux/pinctrl/consumer.h> +#include <linux/mdio-bitbang.h> +#include <linux/sys_soc.h> /* * This timeout definition is a worst-case ultra defensive measure against
@@ -41,6 +43,7 @@struct davinci_mdio_of_param {int autosuspend_delay_ms; +bool manual_mode; };struct davinci_mdio_regs {
@@ -49,6 +52,15 @@ struct davinci_mdio_regs {#define CONTROL_IDLE BIT(31)#define CONTROL_ENABLE BIT(30)#define CONTROL_MAX_DIV (0xffff) +#define CONTROL_CLKDIV GENMASK(15, 0) + +#define MDIO_MAN_MDCLK_O BIT(2) +#define MDIO_MAN_OE BIT(1) +#define MDIO_MAN_PIN BIT(0) +#define MDIO_MANUALMODE BIT(31) + +#define MDIO_PIN 0 +u32 alive;u32 link;
@@ -59,7 +71,9 @@ struct davinci_mdio_regs {u32 userintmasked;u32 userintmaskset;u32 userintmaskclr; -u32 __reserved_1[20 ]; +u32 manualif; +u32 poll; +u32 __reserved_1[18 ];struct {u32 access;
@@ -79,6 +93,7 @@ static const struct mdio_platform_data default_pdata = {struct davinci_mdio_data {struct mdio_platform_data pdata; +struct mdiobb_ctrl bb_ctrl;struct davinci_mdio_regs __iomem *regs;struct clk *clk;struct device *dev;
@@ -90,6 +105,7 @@ struct davinci_mdio_data {*/ bool skip_scan;u32 clk_div; +bool manual_mode; };static void davinci_mdio_init_clk (struct davinci_mdio_data *data)
@@ -128,9 +144,122 @@ static void davinci_mdio_enable(struct davinci_mdio_data *data)writel (data->clk_div |CONTROL_ENABLE , &data->regs->control); } -static int davinci_mdio_reset (struct mii_bus *bus) +static void davinci_mdio_disable (struct davinci_mdio_data *data) +{ +u32 reg; + +/* Disable MDIO state machine */ + reg =readl (&data->regs->control); + + reg &= ~CONTROL_CLKDIV ; + reg |= data->clk_div; + + reg &= ~CONTROL_ENABLE ; +writel (reg, &data->regs->control); +} + +static void davinci_mdio_enable_manual_mode (struct davinci_mdio_data *data) +{ +u32 reg; +/* set manual mode */ + reg =readl (&data->regs->poll); + reg |=MDIO_MANUALMODE ; +writel (reg, &data->regs->poll); +} + +static void davinci_set_mdc (struct mdiobb_ctrl *ctrl,int level) +{ +struct davinci_mdio_data *data; +u32 reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg =readl (&data->regs->manualif); + +if (level) + reg |=MDIO_MAN_MDCLK_O ; +else + reg &= ~MDIO_MAN_MDCLK_O ; + +writel (reg, &data->regs->manualif); +} + +static void davinci_set_mdio_dir (struct mdiobb_ctrl *ctrl,int output) +{ +struct davinci_mdio_data *data; +u32 reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg =readl (&data->regs->manualif); + +if (output) + reg |=MDIO_MAN_OE ; +else + reg &= ~MDIO_MAN_OE ; + +writel (reg, &data->regs->manualif); +} + +static void davinci_set_mdio_data (struct mdiobb_ctrl *ctrl,int value) +{ +struct davinci_mdio_data *data; +u32 reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg =readl (&data->regs->manualif); + +if (value) + reg |=MDIO_MAN_PIN ; +else + reg &= ~MDIO_MAN_PIN ; + +writel (reg, &data->regs->manualif); +} + +static int davinci_get_mdio_data (struct mdiobb_ctrl *ctrl) +{ +struct davinci_mdio_data *data; +unsigned long reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg =readl (&data->regs->manualif); +return test_bit (MDIO_PIN , ®); +} + +static int davinci_mdiobb_read (struct mii_bus *bus,int phy,int reg) +{ +int ret; + + ret =pm_runtime_resume_and_get (bus->parent); +if (ret <0 ) +return ret; + + ret =mdiobb_read (bus, phy, reg); + +pm_runtime_mark_last_busy (bus->parent); +pm_runtime_put_autosuspend (bus->parent); + +return ret; +} + +static int davinci_mdiobb_write (struct mii_bus *bus,int phy,int reg, +u16 val) +{ +int ret; + + ret =pm_runtime_resume_and_get (bus->parent); +if (ret <0 ) +return ret; + + ret =mdiobb_write (bus, phy, reg, val); + +pm_runtime_mark_last_busy (bus->parent); +pm_runtime_put_autosuspend (bus->parent); + +return ret; +} + +static int davinci_mdio_common_reset (struct davinci_mdio_data *data) { -struct davinci_mdio_data *data = bus->priv;u32 phy_mask, ver;int ret;
@@ -138,6 +267,11 @@ static int davinci_mdio_reset(struct mii_bus *bus)if (ret <0 )return ret; +if (data->manual_mode) { +davinci_mdio_disable (data); +davinci_mdio_enable_manual_mode (data); + } +/* wait for scan logic to settle */ msleep (PHY_MAX_ADDR * data->access_time);
@@ -171,6 +305,23 @@ static int davinci_mdio_reset(struct mii_bus *bus)return 0 ; } +static int davinci_mdio_reset (struct mii_bus *bus) +{ +struct davinci_mdio_data *data = bus->priv; + +return davinci_mdio_common_reset (data); +} + +static int davinci_mdiobb_reset (struct mii_bus *bus) +{ +struct mdiobb_ctrl *ctrl = bus->priv; +struct davinci_mdio_data *data; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + +return davinci_mdio_common_reset (data); +} +/* wait until hardware is ready for another user access */ static inline int wait_for_user_access (struct davinci_mdio_data *data) {
@@ -318,6 +469,28 @@ static int davinci_mdio_probe_dt(struct mdio_platform_data *data,return 0 ; } +struct k3_mdio_soc_data { +bool manual_mode; +}; + +static const struct k3_mdio_soc_data am65_mdio_soc_data = { + .manual_mode = true, +}; + +static const struct soc_device_attribute k3_mdio_socinfo[] = { + { .family ="AM62X" , .revision ="SR1.0" , .data = &am65_mdio_soc_data }, + { .family ="AM64X" , .revision ="SR1.0" , .data = &am65_mdio_soc_data }, + { .family ="AM64X" , .revision ="SR2.0" , .data = &am65_mdio_soc_data }, + { .family ="AM65X" , .revision ="SR1.0" , .data = &am65_mdio_soc_data }, + { .family ="AM65X" , .revision ="SR2.0" , .data = &am65_mdio_soc_data }, + { .family ="J7200" , .revision ="SR1.0" , .data = &am65_mdio_soc_data }, + { .family ="J7200" , .revision ="SR2.0" , .data = &am65_mdio_soc_data }, + { .family ="J721E" , .revision ="SR1.0" , .data = &am65_mdio_soc_data }, + { .family ="J721E" , .revision ="SR2.0" , .data = &am65_mdio_soc_data }, + { .family ="J721S2" , .revision ="SR1.0" , .data = &am65_mdio_soc_data}, + {/* sentinel */ }, +}; +#if IS_ENABLED (CONFIG_OF )static const struct davinci_mdio_of_param of_cpsw_mdio_data = { .autosuspend_delay_ms = 100,
@@ -331,6 +504,14 @@ static const struct of_device_id davinci_mdio_of_mtable[] = {MODULE_DEVICE_TABLE (of, davinci_mdio_of_mtable);#endif +static const struct mdiobb_ops davinci_mdiobb_ops = { + .owner =THIS_MODULE , + .set_mdc = davinci_set_mdc, + .set_mdio_dir = davinci_set_mdio_dir, + .set_mdio_data = davinci_set_mdio_data, + .get_mdio_data = davinci_get_mdio_data, +}; +static int davinci_mdio_probe (struct platform_device *pdev) {struct mdio_platform_data *pdata =dev_get_platdata (&pdev->dev);
@@ -345,7 +526,26 @@ static int davinci_mdio_probe(struct platform_device *pdev)if (!data)return -ENOMEM ; - data->bus =devm_mdiobus_alloc (dev); + data->manual_mode = false; + data->bb_ctrl.ops = &davinci_mdiobb_ops; + +if (IS_ENABLED (CONFIG_OF ) && dev->of_node) { +const struct soc_device_attribute *soc_match_data; + + soc_match_data =soc_device_match (k3_mdio_socinfo); +if (soc_match_data && soc_match_data->data) { +const struct k3_mdio_soc_data *socdata = + soc_match_data->data; + + data->manual_mode = socdata->manual_mode; + } + } + +if (data->manual_mode) + data->bus =alloc_mdio_bitbang (&data->bb_ctrl); +else + data->bus =devm_mdiobus_alloc (dev); +if (!data->bus) {dev_err (dev,"failed to alloc mii bus\n" );return -ENOMEM ;
@@ -371,11 +571,20 @@ static int davinci_mdio_probe(struct platform_device *pdev) } data->bus->name =dev_name (dev); - data->bus->read = davinci_mdio_read; - data->bus->write = davinci_mdio_write; - data->bus->reset = davinci_mdio_reset; + +if (data->manual_mode) { + data->bus->read = davinci_mdiobb_read; + data->bus->write = davinci_mdiobb_write; + data->bus->reset = davinci_mdiobb_reset; + +dev_info (dev,"Configuring MDIO in manual mode\n" ); + }else { + data->bus->read = davinci_mdio_read; + data->bus->write = davinci_mdio_write; + data->bus->reset = davinci_mdio_reset; + data->bus->priv = data; + } data->bus->parent = dev; - data->bus->priv = data; data->clk =devm_clk_get (dev,"fck" );if (IS_ERR (data->clk)) {
@@ -433,9 +642,13 @@ static int davinci_mdio_remove(struct platform_device *pdev) {struct davinci_mdio_data *data =platform_get_drvdata (pdev); -if (data->bus) +if (data->bus) {mdiobus_unregister (data->bus); +if (data->manual_mode) +free_mdio_bitbang (data->bus); + } +pm_runtime_dont_use_autosuspend (&pdev->dev);pm_runtime_disable (&pdev->dev);
@@ -452,7 +665,9 @@ static int davinci_mdio_runtime_suspend(struct device *dev) ctrl =readl (&data->regs->control); ctrl &= ~CONTROL_ENABLE ;writel (ctrl, &data->regs->control); -wait_for_idle (data); + +if (!data->manual_mode) +wait_for_idle (data);return 0 ; }
@@ -461,7 +676,12 @@ static int davinci_mdio_runtime_resume(struct device *dev) {struct davinci_mdio_data *data =dev_get_drvdata (dev); -davinci_mdio_enable (data); +if (data->manual_mode) { +davinci_mdio_disable (data); +davinci_mdio_enable_manual_mode (data); + }else { +davinci_mdio_enable (data); + }return 0 ; }#endif
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 399/717 media: amphion: fix a bug that vpu core may not resume after suspend
In reply to Greg Kroah-HartmanFrom: Ming Qian <[email protected]>
[ Upstream commit 0202a665bf17fbe98fed954944aabbcb4f14a4cc ]
driver will enable the vpu core when request the first instance on the core.
one vpu core can only support 8 streaming instances in the same time, the instance won't be added to core's list before streamon.
so the actual instance count may be greater then the number in the core's list.
in pm resume callback, driver will resume the core immediately if core's list is not empty.
but this check is not accurate,
if suspend during one instance is requested, but not streamon, then after suspend, the core won't be resume, and led to instance failure.
use the request_count instead of the core's list to check whether is the core needed to resume immediately after suspend.
And it can make the pm suspend and resume callback more clear.
--- drivers/media/platform/amphion/vpu.h | 1 - drivers/media/platform/amphion/vpu_core.c | 84 ++++++++++++----------- drivers/media/platform/amphion/vpu_core.h | 1 + drivers/media/platform/amphion/vpu_dbg.c | 9 ++- 4 files changed, 51 insertions(+), 44 deletions(-)
drivers/media/platform/amphion/vpu.h +0 -1
@@ -119,7 +119,6 @@ struct vpu_mbox {enum vpu_core_state {VPU_CORE_DEINIT =0 ,VPU_CORE_ACTIVE , -VPU_CORE_SNAPSHOT ,VPU_CORE_HANG };
drivers/media/platform/amphion/vpu_core.c +43 -41
149 lines not on this page · raw message
drivers/media/platform/amphion/vpu_core.h +1 -0
@@ -11,5 +11,6 @@ u32 csr_readl(struct vpu_core *core, u32 reg);int vpu_alloc_dma (struct vpu_core *core,struct vpu_buffer *buf);void vpu_free_dma (struct vpu_buffer *buf);struct vpu_inst *vpu_core_find_instance (struct vpu_core *core,u32 index); +void vpu_core_set_state (struct vpu_core *core,enum vpu_core_state state);#endif
drivers/media/platform/amphion/vpu_dbg.c +7 -2
@@ -15,6 +15,7 @@#include <linux/debugfs.h> #include "vpu.h" #include "vpu_defs.h" +#include "vpu_core.h" #include "vpu_helpers.h" #include "vpu_cmds.h" #include "vpu_rpc.h"
@@ -233,6 +234,10 @@ static int vpu_dbg_core(struct seq_file *s, void *data)if (seq_write (s, str, num))return 0 ; + num =scnprintf (str,sizeof (str),"power %s\n" , +vpu_iface_get_power_state (core) ?"on" :"off" ); +if (seq_write (s, str, num)) +return 0 ; num =scnprintf (str,sizeof (str),"state = %d\n" , core->state);if (seq_write (s, str, num))return 0 ;
@@ -346,10 +351,10 @@ static ssize_t vpu_dbg_core_write(struct file *file,pm_runtime_resume_and_get (core->dev);mutex_lock (&core->lock); -if (core->state !=VPU_CORE_DEINIT && !core->instance_mask) { +if (vpu_iface_get_power_state (core) && !core->request_count) {dev_info (core->dev,"reset\n" );if (!vpu_core_sw_reset (core)) { - core->state =VPU_CORE_ACTIVE ; +vpu_core_set_state (core,VPU_CORE_ACTIVE ); core->hang_mask =0 ; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 262/717 x86/microcode/AMD: Track patch allocation size explicitly
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 712f210a457d9c32414df246a72781550bc23ef6 ]
In preparation for reducing the use of ksize(), record the actual allocation size for later memcpy(). This avoids copying extra (uninitialized!) bytes into the patch buffer when the requested allocation size isn't exactly the size of a kmalloc bucket. Additionally, fix potential future issues where runtime bounds checking will notice that the buffer was allocated to a smaller value than returned by ksize().
--- arch/x86/include/asm/microcode.h | 1 + arch/x86/kernel/cpu/microcode/amd.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
arch/x86/include/asm/microcode.h +1 -0
@@ -9,6 +9,7 @@struct ucode_patch {struct list_head plist;void *data;/* Intel uses only this one */ +unsigned int size;u32 patch_id;u16 equiv_cpu; };
arch/x86/kernel/cpu/microcode/amd.c +2 -1
@@ -788,6 +788,7 @@ static int verify_and_add_patch(u8 family, u8 *fw, unsigned int leftover,kfree (patch);return -EINVAL ; } + patch->size = *patch_size; mc_hdr = (struct microcode_header_amd *)(fw +SECTION_HDR_SIZE ); proc_id = mc_hdr->processor_rev_id;
@@ -869,7 +870,7 @@ load_microcode_amd(bool save, u8 family, const u8 *data, size_t size)return ret;memset (amd_ucode_patch,0 ,PATCH_MAX_SIZE ); -memcpy (amd_ucode_patch, p->data,min_t (u32,ksize (p->data),PATCH_MAX_SIZE )); +memcpy (amd_ucode_patch, p->data,min_t (u32, p->size,PATCH_MAX_SIZE ));return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 565/717 wifi: ath9k: avoid uninit memory read in ath9k_htc_rx_msg()
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit b383e8abed41cc6ff1a3b34de75df9397fa4878c ]
syzbot is reporting uninit value at ath9k_htc_rx_msg() [1], for ioctl(USB_RAW_IOCTL_EP_WRITE) can call ath9k_hif_usb_rx_stream() with pkt_len = 0 but ath9k_hif_usb_rx_stream() uses __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC) based on an assumption that pkt_len is valid. As a result, ath9k_hif_usb_rx_stream() allocates skb with uninitialized memory and ath9k_htc_rx_msg() is reading from uninitialized memory.
Since bytes accessed by ath9k_htc_rx_msg() is not known until ath9k_htc_rx_msg() is called, it would be difficult to check minimal valid pkt_len at "if (pkt_len > 2 * MAX_RX_BUF_SIZE) {" line in ath9k_hif_usb_rx_stream().
We have two choices. One is to workaround by adding __GFP_ZERO so that ath9k_htc_rx_msg() sees 0 if pkt_len is invalid. The other is to let ath9k_htc_rx_msg() validate pkt_len before accessing. This patch chose the latter.
Note that I'm not sure threshold condition is correct, for I can't find details on possible packet length used by this protocol.
--- drivers/net/wireless/ath/ath9k/htc_hst.c | 43 +++++++++++++++--------- 1 file changed, 28 insertions(+), 15 deletions(-)
drivers/net/wireless/ath/ath9k/htc_hst.c +28 -15
@@ -364,33 +364,27 @@ void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle, }static void ath9k_htc_fw_panic_report (struct htc_target *htc_handle, -struct sk_buff *skb) +struct sk_buff *skb,u32 len) {uint32_t *pattern = (uint32_t *)skb->data; -switch (*pattern) { -case 0x33221199 : - { +if (*pattern ==0x33221199 && len >=sizeof (struct htc_panic_bad_vaddr )) {struct htc_panic_bad_vaddr *htc_panic; htc_panic = (struct htc_panic_bad_vaddr *) skb->data;dev_err (htc_handle->dev,"ath: firmware panic! " "exccause: 0x%08x; pc: 0x%08x; badvaddr: 0x%08x.\n" , htc_panic->exccause, htc_panic->pc, htc_panic->badvaddr); -break ; - } -case 0x33221299 : - { +return ; + } +if (*pattern ==0x33221299 ) {struct htc_panic_bad_epid *htc_panic; htc_panic = (struct htc_panic_bad_epid *) skb->data;dev_err (htc_handle->dev,"ath: firmware panic! " "bad epid: 0x%08x\n" , htc_panic->epid); -break ; - } -default : -dev_err (htc_handle->dev,"ath: unknown panic pattern!\n" ); -break ; +return ; } +dev_err (htc_handle->dev,"ath: unknown panic pattern!\n" ); }/*
@@ -411,16 +405,26 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle,if (!htc_handle || !skb)return ; +/* A valid message requires len >= 8. +* +* sizeof(struct htc_frame_hdr) == 8 +* sizeof(struct htc_ready_msg) == 8 +* sizeof(struct htc_panic_bad_vaddr) == 16 +* sizeof(struct htc_panic_bad_epid) == 8 +*/ +if (unlikely (len <sizeof (struct htc_frame_hdr ))) + goto invalid; htc_hdr = (struct htc_frame_hdr *) skb->data; epid = htc_hdr->endpoint_id;if (epid ==0x99 ) { -ath9k_htc_fw_panic_report (htc_handle, skb); +ath9k_htc_fw_panic_report (htc_handle, skb, len);kfree_skb (skb);return ; }if (epid <0 || epid >=ENDPOINT_MAX ) { +invalid:if (pipe_id !=USB_REG_IN_PIPE )dev_kfree_skb_any (skb);else
@@ -432,21 +436,30 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle,/* Handle trailer */ if (htc_hdr->flags &HTC_FLAGS_RECV_TRAILER ) { -if (be32_to_cpu (*(__be32 *) skb->data) ==0x00C60000 ) +if (be32_to_cpu (*(__be32 *) skb->data) ==0x00C60000 ) {/* Move past the Watchdog pattern */ htc_hdr = (struct htc_frame_hdr *)(skb->data +4 ); + len -=4 ; + } }/* Get the message ID */ +if (unlikely (len <sizeof (struct htc_frame_hdr ) +sizeof (__be16))) + goto invalid; msg_id = (__be16 *) ((void *) htc_hdr +sizeof (struct htc_frame_hdr ));/* Now process HTC messages */ switch (be16_to_cpu (*msg_id)) {case HTC_MSG_READY_ID : +if (unlikely (len <sizeof (struct htc_ready_msg ))) + goto invalid;htc_process_target_rdy (htc_handle, htc_hdr);break ;case HTC_MSG_CONNECT_SERVICE_RESPONSE_ID : +if (unlikely (len <sizeof (struct htc_frame_hdr ) + +sizeof (struct htc_conn_svc_rspmsg ))) + goto invalid;htc_process_conn_rsp (htc_handle, htc_hdr);break ;default :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 582/717 Bluetooth: hci_sysfs: Fix attempting to call device_add multiple times
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 448a496f760664d3e2e79466aa1787e6abc922b5 ]
device_add shall not be called multiple times as stated in its documentation:
'Do not call this routine or device_register() more than once for any device structure'
Syzkaller reports a bug as follows [1]:
------------[ cut here ]------------ kernel BUG at lib/list_debug.c:33! invalid opcode: 0000 [#1] PREEMPT SMP KASAN [...] Call Trace: <TASK> __list_add include/linux/list.h:69 [inline] list_add_tail include/linux/list.h:102 [inline] kobj_kset_join lib/kobject.c:164 [inline] kobject_add_internal+0x18f/0x8f0 lib/kobject.c:214 kobject_add_varg lib/kobject.c:358 [inline] kobject_add+0x150/0x1c0 lib/kobject.c:410 device_add+0x368/0x1e90 drivers/base/core.c:3452 hci_conn_add_sysfs+0x9b/0x1b0 net/bluetooth/hci_sysfs.c:53 hci_le_cis_estabilished_evt+0x57c/0xae0 net/bluetooth/hci_event.c:6799 hci_le_meta_evt+0x2b8/0x510 net/bluetooth/hci_event.c:7110 hci_event_func net/bluetooth/hci_event.c:7440 [inline] hci_event_packet+0x63d/0xfd0 net/bluetooth/hci_event.c:7495 hci_rx_work+0xae7/0x1230 net/bluetooth/hci_core.c:4007 process_one_work+0x991/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e4/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 </TASK>
--- net/bluetooth/hci_sysfs.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/hci_sysfs.c +3 -0
@@ -48,6 +48,9 @@ void hci_conn_add_sysfs(struct hci_conn *conn)BT_DBG ("conn %p" , conn); +if (device_is_registered (&conn->dev)) +return ; +dev_set_name (&conn->dev,"%s:%d" , hdev->name, conn->handle);if (device_add (&conn->dev) <0 ) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 555/717 NFSD: fix use-after-free on source server when doing inter-server copy
In reply to Greg Kroah-HartmanFrom: Dai Ngo <[email protected]>
[ Upstream commit 019805fea91599b22dfa62ffb29c022f35abeb06 ]
Use-after-free occurred when the laundromat tried to free expired cpntf_state entry on the s2s_cp_stateids list after inter-server copy completed. The sc_cp_list that the expired copy state was inserted on was already freed.
When COPY completes, the Linux client normally sends LOCKU(lock_state x), FREE_STATEID(lock_state x) and CLOSE(open_state y) to the source server. The nfs4_put_stid call from nfsd4_free_stateid cleans up the copy state from the s2s_cp_stateids list before freeing the lock state's stid.
However, sometimes the CLOSE was sent before the FREE_STATEID request. When this happens, the nfsd4_close_open_stateid call from nfsd4_close frees all lock states on its st_locks list without cleaning up the copy state on the sc_cp_list list. When the time the FREE_STATEID arrives the server returns BAD_STATEID since the lock state was freed. This causes the use-after-free error to occur when the laundromat tries to free the expired cpntf_state.
This patch adds a call to nfs4_free_cpntf_statelist in nfsd4_close_open_stateid to clean up the copy state before calling free_ol_stateid_reaplist to free the lock state's stid on the reaplist.
--- fs/nfsd/nfs4state.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/nfsd/nfs4state.c +5 -0
@@ -1049,6 +1049,7 @@ static struct nfs4_ol_stateid * nfs4_alloc_open_stateid(struct nfs4_client *clp)static void nfs4_free_deleg (struct nfs4_stid *stid) { +WARN_ON (!list_empty (&stid->sc_cp_list));kmem_cache_free (deleg_slab, stid);atomic_long_dec (&num_delegations); }
@@ -1463,6 +1464,7 @@ static void nfs4_free_ol_stateid(struct nfs4_stid *stid)release_all_access (stp);if (stp->st_stateowner)nfs4_put_stateowner (stp->st_stateowner); +WARN_ON (!list_empty (&stid->sc_cp_list));kmem_cache_free (stateid_slab, stid); }
@@ -6608,6 +6610,7 @@ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s)struct nfs4_client *clp = s->st_stid.sc_client;bool unhashed;LIST_HEAD (reaplist); +struct nfs4_ol_stateid *stp;spin_lock (&clp->cl_lock); unhashed =unhash_open_stateid (s, &reaplist);
@@ -6616,6 +6619,8 @@ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s)if (unhashed)put_ol_stateid_locked (s, &reaplist);spin_unlock (&clp->cl_lock); +list_for_each_entry (stp, &reaplist, st_locks) +nfs4_free_cpntf_statelist (clp->net, &stp->st_stid);free_ol_stateid_reaplist (&reaplist); }else {spin_unlock (&clp->cl_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 584/717 selftests/bpf: Free the allocated resources after test case succeeds
In reply to Greg Kroah-HartmanFrom: Hou Tao <[email protected]>
[ Upstream commit 103d002fb7d548fb1187e350f2b73788558128b9 ]
Free the created fd or allocated bpf_object after test case succeeds, else there will be resource leaks.
Spotted by using address sanitizer and checking the content of /proc/$pid/fd directory.
--- .../bpf/map_tests/array_map_batch_ops.c | 2 ++ .../bpf/map_tests/htab_map_batch_ops.c | 2 ++ .../bpf/map_tests/lpm_trie_map_batch_ops.c | 2 ++ tools/testing/selftests/bpf/test_maps.c | 24 ++++++++++++------- 4 files changed, 21 insertions(+), 9 deletions(-)
tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c +2 -0
@@ -3,6 +3,7 @@#include <stdio.h> #include <errno.h> #include <string.h> +#include <unistd.h> #include <bpf/bpf.h> #include <bpf/libbpf.h>
@@ -137,6 +138,7 @@ static void __test_map_lookup_and_update_batch(bool is_pcpu)free (keys);free (values);free (visited); +close (map_fd); }static void array_map_batch_ops (void )
tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c +2 -0
@@ -3,6 +3,7 @@#include <stdio.h> #include <errno.h> #include <string.h> +#include <unistd.h> #include <bpf/bpf.h> #include <bpf/libbpf.h>
@@ -255,6 +256,7 @@ void __test_map_lookup_and_delete_batch(bool is_pcpu)free (visited);if (!is_pcpu)free (values); +close (map_fd); }void htab_map_batch_ops (void )
tools/testing/selftests/bpf/map_tests/lpm_trie_map_batch_ops.c +2 -0
@@ -7,6 +7,7 @@#include <errno.h> #include <string.h> #include <stdlib.h> +#include <unistd.h> #include <bpf/bpf.h> #include <bpf/libbpf.h>
@@ -150,4 +151,5 @@ void test_lpm_trie_map_batch_ops(void)free (keys);free (values);free (visited); +close (map_fd); }
tools/testing/selftests/bpf/test_maps.c +15 -9
@@ -658,13 +658,13 @@ static void test_sockmap(unsigned int tasks, void *data) {struct bpf_map *bpf_map_rx, *bpf_map_tx, *bpf_map_msg, *bpf_map_break;int map_fd_msg =0 , map_fd_rx =0 , map_fd_tx =0 , map_fd_break; +struct bpf_object *parse_obj, *verdict_obj, *msg_obj;int ports[] = {50200 ,50201 ,50202 ,50204 };int err, i, fd, udp, sfd[6 ] = {0xdeadbeef };u8 buf[20 ] = {0x0 ,0x5 ,0x3 ,0x2 ,0x1 ,0x0 };int parse_prog, verdict_prog, msg_prog;struct sockaddr_in addr;int one =1 , s, sc, rc; -struct bpf_object *obj;struct timeval to;__u32 key, value;pid_t pid[tasks];
@@ -760,6 +760,7 @@ static void test_sockmap(unsigned int tasks, void *data) i, udp); goto out_sockmap; } +close (udp);/* Test update without programs */ for (i =0 ; i <6 ; i++) {
@@ -822,27 +823,27 @@ static void test_sockmap(unsigned int tasks, void *data)/* Load SK_SKB program and Attach */ err =bpf_prog_test_load (SOCKMAP_PARSE_PROG , -BPF_PROG_TYPE_SK_SKB , &obj, &parse_prog); +BPF_PROG_TYPE_SK_SKB , &parse_obj, &parse_prog);if (err) {printf ("Failed to load SK_SKB parse prog\n" ); goto out_sockmap; } err =bpf_prog_test_load (SOCKMAP_TCP_MSG_PROG , -BPF_PROG_TYPE_SK_MSG , &obj, &msg_prog); +BPF_PROG_TYPE_SK_MSG , &msg_obj, &msg_prog);if (err) {printf ("Failed to load SK_SKB msg prog\n" ); goto out_sockmap; } err =bpf_prog_test_load (SOCKMAP_VERDICT_PROG , -BPF_PROG_TYPE_SK_SKB , &obj, &verdict_prog); +BPF_PROG_TYPE_SK_SKB , &verdict_obj, &verdict_prog);if (err) {printf ("Failed to load SK_SKB verdict prog\n" ); goto out_sockmap; } - bpf_map_rx =bpf_object__find_map_by_name (obj,"sock_map_rx" ); + bpf_map_rx =bpf_object__find_map_by_name (verdict_obj,"sock_map_rx" );if (!bpf_map_rx) {printf ("Failed to load map rx from verdict prog\n" ); goto out_sockmap;
@@ -854,7 +855,7 @@ static void test_sockmap(unsigned int tasks, void *data) goto out_sockmap; } - bpf_map_tx =bpf_object__find_map_by_name (obj,"sock_map_tx" ); + bpf_map_tx =bpf_object__find_map_by_name (verdict_obj,"sock_map_tx" );if (!bpf_map_tx) {printf ("Failed to load map tx from verdict prog\n" ); goto out_sockmap;
@@ -866,7 +867,7 @@ static void test_sockmap(unsigned int tasks, void *data) goto out_sockmap; } - bpf_map_msg =bpf_object__find_map_by_name (obj,"sock_map_msg" ); + bpf_map_msg =bpf_object__find_map_by_name (verdict_obj,"sock_map_msg" );if (!bpf_map_msg) {printf ("Failed to load map msg from msg_verdict prog\n" ); goto out_sockmap;
@@ -878,7 +879,7 @@ static void test_sockmap(unsigned int tasks, void *data) goto out_sockmap; } - bpf_map_break =bpf_object__find_map_by_name (obj,"sock_map_break" ); + bpf_map_break =bpf_object__find_map_by_name (verdict_obj,"sock_map_break" );if (!bpf_map_break) {printf ("Failed to load map tx from verdict prog\n" ); goto out_sockmap;
@@ -1124,7 +1125,9 @@ static void test_sockmap(unsigned int tasks, void *data) }close (fd);close (map_fd_rx); -bpf_object__close (obj); +bpf_object__close (parse_obj); +bpf_object__close (msg_obj); +bpf_object__close (verdict_obj);return ; out:for (i =0 ; i <6 ; i++)
@@ -1282,8 +1285,11 @@ static void test_map_in_map(void)printf ("Inner map mim.inner was not destroyed\n" ); goto out_map_in_map; } + +close (fd); } +bpf_object__close (obj);return ; out_map_in_map:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 581/717 Bluetooth: L2CAP: initialize delayed works at l2cap_chan_create()
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit 2d2cb3066f2c90cd8ca540b36ba7a55e7f2406e0 ]
syzbot is reporting cancel_delayed_work() without INIT_DELAYED_WORK() at l2cap_chan_del() [1], for CONF_NOT_COMPLETE flag (which meant to prevent l2cap_chan_del() from calling cancel_delayed_work()) is cleared by timer which fires before l2cap_chan_del() is called by closing file descriptor created by socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_L2CAP).
l2cap_bredr_sig_cmd(L2CAP_CONF_REQ) and l2cap_bredr_sig_cmd(L2CAP_CONF_RSP) are calling l2cap_ertm_init(chan), and they call l2cap_chan_ready() (which clears CONF_NOT_COMPLETE flag) only when l2cap_ertm_init(chan) succeeded.
l2cap_sock_init() does not call l2cap_ertm_init(chan), and it instead sets CONF_NOT_COMPLETE flag by calling l2cap_chan_set_defaults(). However, when connect() is requested, "command 0x0409 tx timeout" happens after 2 seconds
from connect() request, and CONF_NOT_COMPLETE flag is cleared after 4
seconds from connect() request, for l2cap_conn_start() from l2cap_info_timeout() callback scheduled by
schedule_delayed_work(&conn->info_timer, L2CAP_INFO_TIMEOUT);
in l2cap_connect() is calling l2cap_chan_ready().
Fix this problem by initializing delayed works used by L2CAP_MODE_ERTM mode as soon as l2cap_chan_create() allocates a channel, like I did in commit be8597239379f0f5 ("Bluetooth: initialize skb_queue_head at l2cap_chan_create()").
--- net/bluetooth/l2cap_core.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
net/bluetooth/l2cap_core.c +6 -4
@@ -61,6 +61,9 @@ static void l2cap_send_disconn_req(struct l2cap_chan *chan, int err);static void l2cap_tx (struct l2cap_chan *chan,struct l2cap_ctrl *control,struct sk_buff_head *skbs,u8 event); +static void l2cap_retrans_timeout (struct work_struct *work); +static void l2cap_monitor_timeout (struct work_struct *work); +static void l2cap_ack_timeout (struct work_struct *work);static inline u8 bdaddr_type (u8 link_type,u8 bdaddr_type) {
@@ -476,6 +479,9 @@ struct l2cap_chan *l2cap_chan_create(void)write_unlock (&chan_list_lock);INIT_DELAYED_WORK (&chan->chan_timer, l2cap_chan_timeout); +INIT_DELAYED_WORK (&chan->retrans_timer, l2cap_retrans_timeout); +INIT_DELAYED_WORK (&chan->monitor_timer, l2cap_monitor_timeout); +INIT_DELAYED_WORK (&chan->ack_timer, l2cap_ack_timeout); chan->state =BT_OPEN ;
@@ -3319,10 +3325,6 @@ int l2cap_ertm_init(struct l2cap_chan *chan) chan->rx_state =L2CAP_RX_STATE_RECV ; chan->tx_state =L2CAP_TX_STATE_XMIT ; -INIT_DELAYED_WORK (&chan->retrans_timer, l2cap_retrans_timeout); -INIT_DELAYED_WORK (&chan->monitor_timer, l2cap_monitor_timeout); -INIT_DELAYED_WORK (&chan->ack_timer, l2cap_ack_timeout); -skb_queue_head_init (&chan->srej_q); err =l2cap_seq_list_init (&chan->srej_list, chan->tx_win);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 561/717 openvswitch: Fix double reporting of drops in dropwatch
In reply to Greg Kroah-HartmanFrom: Mike Pattrick <[email protected]>
[ Upstream commit 1100248a5c5ccd57059eb8d02ec077e839a23826 ]
Frames sent to userspace can be reported as dropped in ovs_dp_process_packet, however, if they are dropped in the netlink code then netlink_attachskb will report the same frame as dropped.
This patch checks for error codes which indicate that the frame has already been freed.
--- net/openvswitch/datapath.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
net/openvswitch/datapath.c +10 -3
@@ -252,10 +252,17 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key) upcall.mru =OVS_CB (skb)->mru; error =ovs_dp_upcall (dp, skb, key, &upcall,0 ); -if (unlikely (error)) -kfree_skb (skb); -else +switch (error) { +case 0 : +case -EAGAIN : +case -ERESTARTSYS : +case -EINTR :consume_skb (skb); +break ; +default : +kfree_skb (skb); +break ; + } stats_counter = &stats->n_missed; goto out; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 583/717 bnxt_en: replace reset with config timestamps
In reply to Greg Kroah-HartmanFrom: Vadim Fedorenko <[email protected]>
[ Upstream commit 8db3d514e96715c897fe793c4d5fc0fd86aca517 ]
Any change to the hardware timestamps configuration triggers nic restart, which breaks transmition and reception of network packets for a while. But there is no need to fully restart the device because while configuring hardware timestamps. The code for changing configuration runs after all of the initialisation, when the NIC is actually up and running. This patch changes the code that ioctl will only update configuration registers and will not trigger carrier status change, but in case of timestamps for all rx packetes it fallbacks to close()/open() sequnce because of synchronization issues in the hardware. Tested on BCM57504.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +7 -3
@@ -505,9 +505,13 @@ static int bnxt_hwrm_ptp_cfg(struct bnxt *bp) ptp->tstamp_filters = flags;if (netif_running (bp->dev)) { - rc =bnxt_close_nic (bp, false, false); -if (!rc) - rc =bnxt_open_nic (bp, false, false); +if (ptp->rx_filter ==HWTSTAMP_FILTER_ALL ) { + rc =bnxt_close_nic (bp, false, false); +if (!rc) + rc =bnxt_open_nic (bp, false, false); + }else { +bnxt_ptp_cfg_tstamp_filters (bp); + }if (!rc && !ptp->tstamp_filters) rc = -EIO ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 597/717 r8152: Rate limit overflow messages
In reply to Greg Kroah-HartmanFrom: Andrew Gaul <[email protected]>
[ Upstream commit 93e2be344a7db169b7119de21ac1bf253b8c6907 ]
My system shows almost 10 million of these messages over a 24-hour period which pollutes my logs.
--- drivers/net/usb/r8152.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/usb/r8152.c +3 -1
@@ -1874,7 +1874,9 @@ static void intr_callback(struct urb *urb) "Stop submitting intr, status %d\n", status);return ;case -EOVERFLOW : -netif_info (tp, intr, tp->netdev,"intr status -EOVERFLOW\n" ); +if (net_ratelimit ()) +netif_info (tp, intr, tp->netdev, +"intr status -EOVERFLOW\n" ); goto resubmit;/* -EPIPE: should clear the halt */ default :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 588/717 wifi: rt2x00: set VGC gain for both chains of MT7620
In reply to Greg Kroah-HartmanFrom: Daniel Golle <[email protected]>
[ Upstream commit 0e09768c085709e10ece3b68f6ac921d3f6a9caa ]
Set bbp66 for all chains of the MT7620.
--- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +2 -1
@@ -5645,7 +5645,8 @@ static inline void rt2800_set_vgc(struct rt2x00_dev *rt2x00dev,if (qual->vgc_level != vgc_level) {if (rt2x00_rt (rt2x00dev,RT3572 ) ||rt2x00_rt (rt2x00dev,RT3593 ) || -rt2x00_rt (rt2x00dev,RT3883 )) { +rt2x00_rt (rt2x00dev,RT3883 ) || +rt2x00_rt (rt2x00dev,RT6352 )) {rt2800_bbp_write_with_rx_chain (rt2x00dev,66 , vgc_level); }else if (rt2x00_rt (rt2x00dev,RT5592 )) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 567/717 x86/apic: Dont disable x2APIC if locked
In reply to Greg Kroah-HartmanFrom: Daniel Sneddon <[email protected]>
[ Upstream commit b8d1d163604bd1e600b062fb00de5dc42baa355f ]
The APIC supports two modes, legacy APIC (or xAPIC), and Extended APIC (or x2APIC). X2APIC mode is mostly compatible with legacy APIC, but it disables the memory-mapped APIC interface in favor of one that uses MSRs. The APIC mode is controlled by the EXT bit in the APIC MSR.
The MMIO/xAPIC interface has some problems, most notably the APIC LEAK [1]. This bug allows an attacker to use the APIC MMIO interface to extract data from the SGX enclave.
Introduce support for a new feature that will allow the BIOS to lock the APIC in x2APIC mode. If the APIC is locked in x2APIC mode and the kernel tries to disable the APIC or revert to legacy APIC mode a GP fault will occur.
Introduce support for a new MSR (IA32_XAPIC_DISABLE_STATUS) and handle the new locked mode when the LEGACY_XAPIC_DISABLED bit is set by preventing the kernel from trying to disable the x2APIC.
On platforms with the IA32_XAPIC_DISABLE_STATUS MSR, if SGX or TDX are enabled the LEGACY_XAPIC_DISABLED will be set by the BIOS. If legacy APIC is required, then it SGX and TDX need to be disabled in the BIOS.
[1]: https://aepicleak.com/aepicleak.pdf
--- .../admin-guide/kernel-parameters.txt | 4 ++ arch/x86/Kconfig | 7 ++- arch/x86/include/asm/cpu.h | 2 + arch/x86/include/asm/msr-index.h | 13 ++++++ arch/x86/kernel/apic/apic.c | 44 +++++++++++++++++-- 5 files changed, 65 insertions(+), 5 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +4 -0
@@ -3765,6 +3765,10 @@ nox2apic [X86-64,APIC] Do not enable x2APIC mode. + NOTE: this parameter will be ignored on systems with the + LEGACY_XAPIC_DISABLED bit set in the + IA32_XAPIC_DISABLE_STATUS MSR. + nps_mtm_hs_ctr= [KNL,ARC] This parameter sets the maximum duration, in cycles, each HW thread of the CTOP can run
arch/x86/Kconfig +6 -1
@@ -450,6 +450,11 @@ config X86_X2APIC This allows 32-bit apic IDs (so it can support very large systems), and accesses the local apic via MSRs not via mmio. + Some Intel systems circa 2022 and later are locked into x2APIC mode + and can not fall back to the legacy APIC modes if SGX or TDX are + enabled in the BIOS. They will be unable to boot without enabling + this option. + If you don't know what to do here, say N. config X86_MPPARSE
@@ -1930,7 +1935,7 @@ endchoice config X86_SGX bool "Software Guard eXtensions (SGX)" - depends on X86_64 && CPU_SUP_INTEL + depends on X86_64 && CPU_SUP_INTEL && X86_X2APIC depends on CRYPTO=y depends on CRYPTO_SHA256=y select SRCU
arch/x86/include/asm/cpu.h +2 -0
@@ -94,4 +94,6 @@ static inline bool intel_cpu_signatures_match(unsigned int s1, unsigned int p1, return p1 & p2; } +extern u64 x86_read_arch_cap_msr (void ); +#endif /* _ASM_X86_CPU_H */
arch/x86/include/asm/msr-index.h +13 -0
@@ -155,6 +155,11 @@* Return Stack Buffer Predictions. */ +#define ARCH_CAP_XAPIC_DISABLE BIT(21)/* +* IA32_XAPIC_DISABLE_STATUS MSR +* supported +*/ +#define MSR_IA32_FLUSH_CMD 0x0000010b#define L1D_FLUSH BIT(0)/* * Writeback and invalidate the
@@ -1046,4 +1051,12 @@#define MSR_IA32_HW_FEEDBACK_PTR 0x17d0#define MSR_IA32_HW_FEEDBACK_CONFIG 0x17d1 +/* x2APIC locked status */ +#define MSR_IA32_XAPIC_DISABLE_STATUS 0xBD +#define LEGACY_XAPIC_DISABLED BIT(0)/* +* x2APIC mode is locked and +* disabling x2APIC will cause +* a #GP +*/ +#endif /* _ASM_X86_MSR_INDEX_H */
arch/x86/kernel/apic/apic.c +40 -4
86 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 379/717 RDMA/mlx5: Dont compare mkey tags in DEVX indirect mkey
In reply to Greg Kroah-HartmanFrom: Aharon Landau <[email protected]>
[ Upstream commit 13ad1125b941a5f257d9d3ae70485773abd34792 ]
According to the ib spec:
If the CI supports the Base Memory Management Extensions defined in this specification, the L_Key format must consist of:
24 bit index in the most significant bits of the R_Key, and 8 bit key in the least significant bits of the R_Key
Through a successful Allocate L_Key verb invocation, the CI must let the consumer own the key portion of the returned R_Key
Therefore, when creating a mkey using DEVX, the consumer is allowed to change the key part. The kernel should compare only the index part of a R_Key to determine equality with another R_Key.
Adding capability in order not to break backward compatibility.
--- drivers/infiniband/hw/mlx5/main.c | 3 +++ drivers/infiniband/hw/mlx5/odp.c | 3 ++- include/uapi/rdma/mlx5-abi.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/main.c +3 -0
@@ -1826,6 +1826,9 @@ static int set_ucontext_resp(struct ib_ucontext *uctx,if (MLX5_CAP_GEN (dev->mdev, drain_sigerr)) resp->comp_mask |=MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_SQD2RTS ; + resp->comp_mask |= +MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_MKEY_UPDATE_TAG ; +return 0 ; }
drivers/infiniband/hw/mlx5/odp.c +2 -1
@@ -795,7 +795,8 @@ static bool mkey_is_eq(struct mlx5_ib_mkey *mmkey, u32 key) {if (!mmkey)return false; -if (mmkey->type ==MLX5_MKEY_MW ) +if (mmkey->type ==MLX5_MKEY_MW || + mmkey->type ==MLX5_MKEY_INDIRECT_DEVX )return mlx5_base_mkey (mmkey->key) ==mlx5_base_mkey (key);return mmkey->key == key; }
include/uapi/rdma/mlx5-abi.h +1 -0
@@ -104,6 +104,7 @@ enum mlx5_ib_alloc_ucontext_resp_mask {MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_ECE =1UL <<2 ,MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_SQD2RTS =1UL <<3 ,MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_REAL_TIME_TS =1UL <<4 , + MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_MKEY_UPDATE_TAG = 1UL << 5, }; enum mlx5_user_cmds_supp_uhw {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 602/717 gpu: lontium-lt9611: Fix NULL pointer dereference in lt9611_connector_init()
In reply to Greg Kroah-HartmanFrom: Zeng Jingxiang <[email protected]>
[ Upstream commit ef8886f321c5dab8124b9153d25afa2a71d05323 ]
A NULL check for bridge->encoder shows that it may be NULL, but it already been dereferenced on all paths leading to the check.
812 if (!bridge->encoder) {
Dereference the pointer bridge->encoder.
810 drm_connector_attach_encoder(<9611->connector, bridge->encoder);
--- drivers/gpu/drm/bridge/lontium-lt9611.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/lontium-lt9611.c +2 -1
@@ -807,13 +807,14 @@ static int lt9611_connector_init(struct drm_bridge *bridge, struct lt9611 *lt961drm_connector_helper_add (<9611->connector, <9611_bridge_connector_helper_funcs); -drm_connector_attach_encoder (<9611->connector, bridge->encoder);if (!bridge->encoder) {DRM_ERROR ("Parent encoder object not found" );return -ENODEV ; } +drm_connector_attach_encoder (<9611->connector, bridge->encoder); +return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 563/717 tcp: annotate data-race around tcp_md5sig_pool_populated
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit aacd467c0a576e5e44d2de4205855dc0fe43f6fb ]
tcp_md5sig_pool_populated can be read while another thread changes its value.
The race has no consequence because allocations are protected with tcp_md5sig_mutex.
This patch adds READ_ONCE() and WRITE_ONCE() to document the race and silence KCSAN.
--- net/ipv4/tcp.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
net/ipv4/tcp.c +10 -4
@@ -4349,12 +4349,16 @@ static void __tcp_alloc_md5sig_pool(void)* to memory. See smp_rmb() in tcp_get_md5sig_pool() */ smp_wmb (); - tcp_md5sig_pool_populated = true; +/* Paired with READ_ONCE() from tcp_alloc_md5sig_pool() +* and tcp_get_md5sig_pool(). +*/ +WRITE_ONCE (tcp_md5sig_pool_populated, true); }bool tcp_alloc_md5sig_pool (void ) { -if (unlikely (!tcp_md5sig_pool_populated)) { +/* Paired with WRITE_ONCE() from __tcp_alloc_md5sig_pool() */ +if (unlikely (!READ_ONCE (tcp_md5sig_pool_populated))) {mutex_lock (&tcp_md5sig_mutex);if (!tcp_md5sig_pool_populated) {
@@ -4365,7 +4369,8 @@ bool tcp_alloc_md5sig_pool(void)mutex_unlock (&tcp_md5sig_mutex); } -return tcp_md5sig_pool_populated; +/* Paired with WRITE_ONCE() from __tcp_alloc_md5sig_pool() */ +return READ_ONCE (tcp_md5sig_pool_populated); }EXPORT_SYMBOL (tcp_alloc_md5sig_pool);
@@ -4381,7 +4386,8 @@ struct tcp_md5sig_pool *tcp_get_md5sig_pool(void) {local_bh_disable (); -if (tcp_md5sig_pool_populated) { +/* Paired with WRITE_ONCE() from __tcp_alloc_md5sig_pool() */ +if (READ_ONCE (tcp_md5sig_pool_populated)) {/* coupled with smp_wmb() in __tcp_alloc_md5sig_pool() */ smp_rmb ();return this_cpu_ptr (&tcp_md5sig_pool);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 603/717 drm/amd/display: fix overflow on MIN_I64 definition
In reply to Greg Kroah-HartmanFrom: David Gow <[email protected]>
[ Upstream commit 6ae0632d17759852c07e2d1e0a31c728eb6ba246 ]
The definition of MIN_I64 in bw_fixed.c can cause gcc to whinge about integer overflow, because it is treated as a positive value, which is then negated. The temporary positive value is not necessarily representable.
This causes the following warning:../drivers/gpu/drm/amd/amdgpu/../display/dc/dml/calcs/bw_fixed.c:30:19:
warning: integer overflow in expression ‘-9223372036854775808’ of type ‘long long int’ results in ‘-9223372036854775808’ [-Woverflow]
30 | (int64_t)(-(1LL << 63))
| ^
Writing out (-MAX_I64 - 1) works instead.
--- drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c +3 -3
@@ -26,12 +26,12 @@#include "bw_fixed.h" -#define MIN_I64 \ - (int64_t)(-(1LL << 63)) -#define MAX_I64 \ (int64_t)((1ULL << 63) - 1) +#define MIN_I64 \ + (-MAX_I64 - 1) +#define FRACTIONAL_PART_MASK \ ((1ULL << BW_FIXED_BITS_PER_FRACTIONAL_PART) - 1)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 605/717 platform/x86: pmc_atom: Improve quirk message to be less cryptic
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 32c9b75640aeb1b144f9e2963c1640f4cef7c6f2 ]
Not everyone can get what "critclks" means in the message, improve it to make less cryptic.
--- drivers/platform/x86/pmc_atom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/pmc_atom.c +1 -1
@@ -354,7 +354,7 @@ static bool pmc_clk_is_critical = true;static int dmi_callback (const struct dmi_system_id *d) { -pr_info ("%s critclks quirk enabled\n" , d->ident); +pr_info ("%s: PMC critical clocks quirk enabled\n" , d->ident);return 1 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 442/717 RDMA/cm: Use SLID in the work completion as the DLID in responder side
In reply to Greg Kroah-HartmanFrom: Mark Zhang <[email protected]>
[ Upstream commit b7d95040c13f61a4a6a859c5355faf583eff9658 ]
The responder should always use WC's SLID as the dlid, to follow the IB SPEC section "13.5.4.2 COMMON RESPONSE ACTIONS":
A responder always takes the following actions in constructing a response packet:
- The SLID of the received packet is used as the DLID in the response packet.
--- drivers/infiniband/core/cm.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/infiniband/core/cm.c +7 -7
@@ -1632,14 +1632,13 @@ static void cm_path_set_rec_type(struct ib_device *ib_device, u32 port_num,static void cm_format_path_lid_from_req (struct cm_req_msg *req_msg,struct sa_path_rec *primary_path, -struct sa_path_rec *alt_path) +struct sa_path_rec *alt_path, +struct ib_wc *wc) {u32 lid;if (primary_path->rec_type !=SA_PATH_REC_TYPE_OPA ) { -sa_path_set_dlid (primary_path, -IBA_GET (CM_REQ_PRIMARY_LOCAL_PORT_LID , - req_msg)); +sa_path_set_dlid (primary_path, wc->slid);sa_path_set_slid (primary_path,IBA_GET (CM_REQ_PRIMARY_REMOTE_PORT_LID , req_msg));
@@ -1676,7 +1675,8 @@ static void cm_format_path_lid_from_req(struct cm_req_msg *req_msg,static void cm_format_paths_from_req (struct cm_req_msg *req_msg,struct sa_path_rec *primary_path, -struct sa_path_rec *alt_path) +struct sa_path_rec *alt_path, +struct ib_wc *wc) { primary_path->dgid = *IBA_GET_MEM_PTR (CM_REQ_PRIMARY_LOCAL_PORT_GID , req_msg);
@@ -1734,7 +1734,7 @@ static void cm_format_paths_from_req(struct cm_req_msg *req_msg,if (sa_path_is_roce (alt_path)) alt_path->roce.route_resolved = false; } -cm_format_path_lid_from_req (req_msg, primary_path, alt_path); +cm_format_path_lid_from_req (req_msg, primary_path, alt_path, wc); }static u16 cm_get_bth_pkey (struct cm_work *work)
@@ -2148,7 +2148,7 @@ static int cm_req_handler(struct cm_work *work)if (cm_req_has_alt_path (req_msg)) work->path[1 ].rec_type = work->path[0 ].rec_type;cm_format_paths_from_req (req_msg, &work->path[0 ], - &work->path[1 ]); + &work->path[1 ], work->mad_recv_wc->wc);if (cm_id_priv->av.ah_attr.type ==RDMA_AH_ATTR_TYPE_ROCE )sa_path_set_dmac (&work->path[0 ], cm_id_priv->av.ah_attr.roce.dmac);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 557/717 wifi: brcmfmac: fix invalid address access when enabling SCAN log level
In reply to Greg Kroah-HartmanFrom: Wright Feng <[email protected]>
[ Upstream commit aa666b68e73fc06d83c070d96180b9010cf5a960 ]
The variable i is changed when setting random MAC address and causes invalid address access when printing the value of pi->reqs[i]->reqid.
We replace reqs index with ri to fix the issue.
[ 136.726473] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000000 [ 136.737365] Mem abort info: [ 136.740172] ESR = 0x96000004 [ 136.743359] Exception class = DABT (current EL), IL = 32 bits [ 136.749294] SET = 0, FnV = 0 [ 136.752481] EA = 0, S1PTW = 0 [ 136.755635] Data abort info: [ 136.758514] ISV = 0, ISS = 0x00000004 [ 136.762487] CM = 0, WnR = 0 [ 136.765522] user pgtable: 4k pages, 48-bit VAs, pgdp = 000000005c4e2577 [ 136.772265] [0000000000000000] pgd=0000000000000000 [ 136.777160] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 136.782732] Modules linked in: brcmfmac(O) brcmutil(O) cfg80211(O) compat(O) [ 136.789788] Process wificond (pid: 3175, stack limit = 0x00000000053048fb) [ 136.796664] CPU: 3 PID: 3175 Comm: wificond Tainted: G O 4.19.42-00001-g531a5f5 #1 [ 136.805532] Hardware name: Freescale i.MX8MQ EVK (DT) [ 136.810584] pstate: 60400005 (nZCv daif +PAN -UAO) [ 136.815429] pc : brcmf_pno_config_sched_scans+0x6cc/0xa80 [brcmfmac] [ 136.821811] lr : brcmf_pno_config_sched_scans+0x67c/0xa80 [brcmfmac] [ 136.828162] sp : ffff00000e9a3880 [ 136.831475] x29: ffff00000e9a3890 x28: ffff800020543400 [ 136.836786] x27: ffff8000b1008880 x26: ffff0000012bf6a0 [ 136.842098] x25: ffff80002054345c x24: ffff800088d22400 [ 136.847409] x23: ffff0000012bf638 x22: ffff0000012bf6d8 [ 136.852721] x21: ffff8000aced8fc0 x20: ffff8000ac164400 [ 136.858032] x19: ffff00000e9a3946 x18: 0000000000000000 [ 136.863343] x17: 0000000000000000 x16: 0000000000000000 [ 136.868655] x15: ffff0000093f3b37 x14: 0000000000000050 [ 136.873966] x13: 0000000000003135 x12: 0000000000000000 [ 136.879277] x11: 0000000000000000 x10: ffff000009a61888 [ 136.884589] x9 : 000000000000000f x8 : 0000000000000008 [ 136.889900] x7 : 303a32303d726464 x6 : ffff00000a1f957d [ 136.895211] x5 : 0000000000000000 x4 : ffff00000e9a3942 [ 136.900523] x3 : 0000000000000000 x2 : ffff0000012cead8 [ 136.905834] x1 : ffff0000012bf6d8 x0 : 0000000000000000 [ 136.911146] Call trace: [ 136.913623] brcmf_pno_config_sched_scans+0x6cc/0xa80 [brcmfmac] [ 136.919658] brcmf_pno_start_sched_scan+0xa4/0x118 [brcmfmac] [ 136.925430] brcmf_cfg80211_sched_scan_start+0x80/0xe0 [brcmfmac] [ 136.931636] nl80211_start_sched_scan+0x140/0x308 [cfg80211] [ 136.937298] genl_rcv_msg+0x358/0x3f4 [ 136.940960] netlink_rcv_skb+0xb4/0x118 [ 136.944795] genl_rcv+0x34/0x48 [ 136.947935] netlink_unicast+0x264/0x300 [ 136.951856] netlink_sendmsg+0x2e4/0x33c [ 136.955781] __sys_sendto+0x120/0x19c
--- .../net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +6 -6
@@ -158,12 +158,12 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi)struct brcmf_pno_macaddr_le pfn_mac;u8 *mac_addr =NULL ;u8 *mac_mask =NULL ; -int err, i; +int err, i, ri; -for (i =0 ; i < pi->n_reqs; i++) -if (pi->reqs[i]->flags &NL80211_SCAN_FLAG_RANDOM_ADDR ) { - mac_addr = pi->reqs[i]->mac_addr; - mac_mask = pi->reqs[i]->mac_addr_mask; +for (ri =0 ; ri < pi->n_reqs; ri++) +if (pi->reqs[ri]->flags &NL80211_SCAN_FLAG_RANDOM_ADDR ) { + mac_addr = pi->reqs[ri]->mac_addr; + mac_mask = pi->reqs[ri]->mac_addr_mask;break ; }
@@ -185,7 +185,7 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi) pfn_mac.mac[0 ] |=0x02 ;brcmf_dbg (SCAN ,"enabling random mac: reqid=%llu mac=%pM\n" , - pi->reqs[i]->reqid, pfn_mac.mac); + pi->reqs[ri]->reqid, pfn_mac.mac); err =brcmf_fil_iovar_data_set (ifp,"pfn_macaddr" , &pfn_mac,sizeof (pfn_mac));if (err)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 600/717 drm: Prevent drm_copy_field() to attempt copying a NULL pointer
In reply to Greg Kroah-HartmanFrom: Javier Martinez Canillas <[email protected]>
[ Upstream commit f6ee30407e883042482ad4ad30da5eaba47872ee ]
There are some struct drm_driver fields that are required by drivers since drm_copy_field() attempts to copy them to user-space via DRM_IOCTL_VERSION.
But it can be possible that a driver has a bug and did not set some of the fields, which leads to drm_copy_field() attempting to copy a NULL pointer:
[ +10.395966] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000000
[ +0.010955] Mem abort info: [ +0.002835] ESR = 0x0000000096000004 [ +0.003872] EC = 0x25: DABT (current EL), IL = 32 bits [ +0.005395] SET = 0, FnV = 0 [ +0.003113] EA = 0, S1PTW = 0 [ +0.003182] FSC = 0x04: level 0 translation fault [ +0.004964] Data abort info: [ +0.002919] ISV = 0, ISS = 0x00000004 [ +0.003886] CM = 0, WnR = 0 [ +0.003040] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000115dad000 [ +0.006536] [0000000000000000] pgd=0000000000000000, p4d=0000000000000000 [ +0.006925] Internal error: Oops: 96000004 [#1] SMP ... [ +0.011113] pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ +0.007061] pc : __pi_strlen+0x14/0x150 [ +0.003895] lr : drm_copy_field+0x30/0x1a4 [ +0.004156] sp : ffff8000094b3a50 [ +0.003355] x29: ffff8000094b3a50 x28: ffff8000094b3b70 x27: 0000000000000040 [ +0.007242] x26: ffff443743c2ba00 x25: 0000000000000000 x24: 0000000000000040 [ +0.007243] x23: ffff443743c2ba00 x22: ffff8000094b3b70 x21: 0000000000000000 [ +0.007241] x20: 0000000000000000 x19: ffff8000094b3b90 x18: 0000000000000000 [ +0.007241] x17: 0000000000000000 x16: 0000000000000000 x15: 0000aaab14b9af40 [ +0.007241] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 [ +0.007239] x11: 0000000000000000 x10: 0000000000000000 x9 : ffffa524ad67d4d8 [ +0.007242] x8 : 0101010101010101 x7 : 7f7f7f7f7f7f7f7f x6 : 6c6e6263606e7141 [ +0.007239] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000 [ +0.007241] x2 : 0000000000000000 x1 : ffff8000094b3b90 x0 : 0000000000000000 [ +0.007240] Call trace: [ +0.002475] __pi_strlen+0x14/0x150 [ +0.003537] drm_version+0x84/0xac [ +0.003448] drm_ioctl_kernel+0xa8/0x16c [ +0.003975] drm_ioctl+0x270/0x580 [ +0.003448] __arm64_sys_ioctl+0xb8/0xfc [ +0.003978] invoke_syscall+0x78/0x100 [ +0.003799] el0_svc_common.constprop.0+0x4c/0xf4 [ +0.004767] do_el0_svc+0x38/0x4c [ +0.003357] el0_svc+0x34/0x100 [ +0.003185] el0t_64_sync_handler+0x11c/0x150 [ +0.004418] el0t_64_sync+0x190/0x194 [ +0.003716] Code: 92402c04 b200c3e8 f13fc09f 5400088c (a9400c02) [ +0.006180] ---[ end trace 0000000000000000 ]---
--- drivers/gpu/drm/drm_ioctl.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_ioctl.c +6 -0
@@ -474,6 +474,12 @@ static int drm_copy_field(char __user *buf, size_t *buf_len, const char *value) {size_t len; +/* don't attempt to copy a NULL pointer */ +if (WARN_ONCE (!value,"BUG: the value to copy was not set!" )) { + *buf_len =0 ; +return 0 ; + } +/* don't overflow userbuf */ len =strlen (value);if (len > *buf_len)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 606/717 drm: bridge: dw_hdmi: only trigger hotplug event on link change
In reply to Greg Kroah-HartmanFrom: Lucas Stach <[email protected]>
[ Upstream commit da09daf881082266e4075657fac53c7966de8e4d ]
There are two events that signal a real change of the link state: HPD going high means the sink is newly connected or wants the source to re-read the EDID, RX sense going low is a indication that the link has been disconnected.
Ignore the other two events that also trigger interrupts, but don't need immediate attention: HPD going low does not necessarily mean the link has been lost and should not trigger a immediate read of the status. RX sense going high also does not require a detect cycle, as HPD going high is the right point in time to read the EDID.
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +8 -5
@@ -3095,6 +3095,7 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) {struct dw_hdmi *hdmi = dev_id;u8 intr_stat, phy_int_pol, phy_pol_mask, phy_stat; +enum drm_connector_status status = connector_status_unknown; intr_stat =hdmi_readb (hdmi,HDMI_IH_PHY_STAT0 ); phy_int_pol =hdmi_readb (hdmi,HDMI_PHY_POL0 );
@@ -3133,13 +3134,15 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)cec_notifier_phys_addr_invalidate (hdmi->cec_notifier);mutex_unlock (&hdmi->cec_notifier_mutex); } - } -if (intr_stat &HDMI_IH_PHY_STAT0_HPD ) { -enum drm_connector_status status = phy_int_pol &HDMI_PHY_HPD - ? connector_status_connected - : connector_status_disconnected; +if (phy_stat &HDMI_PHY_HPD ) + status = connector_status_connected; + +if (!(phy_stat & (HDMI_PHY_HPD |HDMI_PHY_RX_SENSE ))) + status = connector_status_disconnected; + } +if (status != connector_status_unknown) {dev_dbg (hdmi->dev,"EVENT=%s\n" , status == connector_status_connected ?"plugin" :"plugout" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 604/717 udmabuf: Set ubuf->sg = NULL if the creation of sg table fails
In reply to Greg Kroah-HartmanFrom: Vivek Kasireddy <[email protected]>
[ Upstream commit d9c04a1b7a15b5e74b2977461d9511e497f05d8f ]
When userspace tries to map the dmabuf and if for some reason (e.g. OOM) the creation of the sg table fails, ubuf->sg needs to be set to NULL. Otherwise, when the userspace subsequently closes the dmabuf fd, we'd try to erroneously free the invalid sg table from release_udmabuf resulting in the following crash reported by syzbot:
general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] CPU: 0 PID: 3609 Comm: syz-executor487 Not tainted 5.19.0-syzkaller-13930-g7ebfc85e2cd7 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022 RIP: 0010:dma_unmap_sgtable include/linux/dma-mapping.h:378 [inline] RIP: 0010:put_sg_table drivers/dma-buf/udmabuf.c:89 [inline] RIP: 0010:release_udmabuf+0xcb/0x4f0 drivers/dma-buf/udmabuf.c:114 Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 2b 04 00 00 48 8d 7d 0c 4c 8b 63 30 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 14 02 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 e2 RSP: 0018:ffffc900037efd30 EFLAGS: 00010246 RAX: dffffc0000000000 RBX: ffffffff8cb67800 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff84ad27e0 RDI: 0000000000000000 RBP: fffffffffffffff4 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000000 R11: 000000000008c07c R12: ffff88801fa05000 R13: ffff888073db07e8 R14: ffff888025c25440 R15: 0000000000000000 FS: 0000555555fc4300(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fc1c0ce06e4 CR3: 00000000715e6000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> dma_buf_release+0x157/0x2d0 drivers/dma-buf/dma-buf.c:78 __dentry_kill+0x42b/0x640 fs/dcache.c:612 dentry_kill fs/dcache.c:733 [inline] dput+0x806/0xdb0 fs/dcache.c:913 __fput+0x39c/0x9d0 fs/file_table.c:333 task_work_run+0xdd/0x1a0 kernel/task_work.c:177 ptrace_notify+0x114/0x140 kernel/signal.c:2353 ptrace_report_syscall include/linux/ptrace.h:420 [inline] ptrace_report_syscall_exit include/linux/ptrace.h:482 [inline] syscall_exit_work kernel/entry/common.c:249 [inline] syscall_exit_to_user_mode_prepare+0x129/0x280 kernel/entry/common.c:276 __syscall_exit_to_user_mode_work kernel/entry/common.c:281 [inline] syscall_exit_to_user_mode+0x9/0x50 kernel/entry/common.c:294 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fc1c0c35b6b Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24
0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44
RSP: 002b:00007ffd78a06090 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000007 RCX: 00007fc1c0c35b6b
RDX: 0000000020000280 RSI: 0000000040086200 RDI: 0000000000000006
RBP: 0000000000000007 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000293 R12: 000000000000000c
R13: 0000000000000003 R14: 00007fc1c0cfe4a0 R15: 00007ffd78a06140
</TASK> Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:dma_unmap_sgtable include/linux/dma-mapping.h:378 [inline] RIP: 0010:put_sg_table drivers/dma-buf/udmabuf.c:89 [inline] RIP: 0010:release_udmabuf+0xcb/0x4f0 drivers/dma-buf/udmabuf.c:114
--- drivers/dma-buf/udmabuf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/dma-buf/udmabuf.c +6 -3
@@ -124,17 +124,20 @@ static int begin_cpu_udmabuf(struct dma_buf *buf, {struct udmabuf *ubuf = buf->priv;struct device *dev = ubuf->device->this_device; +int ret =0 ;if (!ubuf->sg) { ubuf->sg =get_sg_table (dev, buf, direction); -if (IS_ERR (ubuf->sg)) -return PTR_ERR (ubuf->sg); +if (IS_ERR (ubuf->sg)) { + ret =PTR_ERR (ubuf->sg); + ubuf->sg =NULL ; + } }else {dma_sync_sg_for_cpu (dev, ubuf->sg->sgl, ubuf->sg->nents, direction); } -return 0 ; +return ret; } static int end_cpu_udmabuf(struct dma_buf *buf,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 611/717 drm: panel-orientation-quirks: Add quirk for Anbernic Win600
In reply to Greg Kroah-HartmanFrom: Maya Matuszczyk <[email protected]>
[ Upstream commit 770e19076065e079a32f33eb11be2057c87f1cde ]
This device is another x86 gaming handheld, and as (hopefully) there is only one set of DMI IDs it's using DMI_EXACT_MATCH
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -128,6 +128,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "One S1003"), }, .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* Anbernic Win600 */ + .matches = { +DMI_EXACT_MATCH (DMI_BOARD_VENDOR ,"Anbernic" ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Win600"), + }, + .driver_data = (void *)&lcd720x1280_rightside_up, }, { /* Asus T100HA */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 616/717 ALSA: intel-dspconfig: add ES8336 support for AlderLake-PS
In reply to Greg Kroah-HartmanFrom: Muralidhar Reddy <[email protected]>
[ Upstream commit 9db1c9fa214ef41d098633ff40a87284ca6e1870 ]
added quirks for ESS8336 for AlderLake-PS
--- sound/hda/intel-dsp-config.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/hda/intel-dsp-config.c +5 -0
@@ -422,6 +422,11 @@ static const struct config_entry config_table[] = { .device = 0x51cd, },/* Alderlake-PS */ + { + .flags = FLAG_SOF, + .device = 0x51c9, + .codec_hid = &essx_83x6, + }, { .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = 0x51c9,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 241/717 wifi: mt76: sdio: poll sta stat when device transmits data
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit a323e5f041dd11af5e3de19ed7ea95a97d588c11 ]
It is not meaningful to poll sta stat when there is no data traffic. So polling sta stat when the device has transmitted data instead to save CPU power.
That implies that it is unallowed the stat_work to work while MCU is being initialized in the really early stage to fix the possible time to time MCU initialization failure.
--- drivers/net/wireless/mediatek/mt76/sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/sdio.c +1 -1
@@ -480,7 +480,7 @@ static void mt76s_status_worker(struct mt76_worker *w)if (ndata_frames >0 ) resched = true; -if (dev->drv->tx_status_data && +if (dev->drv->tx_status_data && ndata_frames >0 && !test_and_set_bit (MT76_READING_STATS , &dev->phy.state) && !test_bit (MT76_STATE_SUSPEND , &dev->phy.state))ieee80211_queue_work (dev->hw, &dev->sdio.stat_work);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 610/717 drm/vc4: vec: Fix timings for VEC modes
In reply to Greg Kroah-HartmanFrom: Mateusz Kwiatkowski <[email protected]>
[ Upstream commit 30d7565be96b3946c18a1ce3fd538f7946839092 ]
This commit fixes vertical timings of the VEC (composite output) modes to accurately represent the 525-line ("NTSC") and 625-line ("PAL") ITU-R standards.
Previous timings were actually defined as 502 and 601 lines, resulting in non-standard 62.69 Hz and 52 Hz signals being generated, respectively.
--- drivers/gpu/drm/vc4/vc4_vec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vc4/vc4_vec.c +2 -2
@@ -256,7 +256,7 @@ static void vc4_vec_ntsc_j_mode_set(struct vc4_vec *vec)static const struct drm_display_mode ntsc_mode = {DRM_MODE ("720x480" ,DRM_MODE_TYPE_DRIVER ,13500 ,720 ,720 +14 ,720 +14 +64 ,720 +14 +64 +60 ,0 , -480 ,480 +3 ,480 +3 +3 ,480 +3 +3 +16 ,0 , +480 ,480 +7 ,480 +7 +6 ,525 ,0 ,DRM_MODE_FLAG_INTERLACE ) };
@@ -278,7 +278,7 @@ static void vc4_vec_pal_m_mode_set(struct vc4_vec *vec)static const struct drm_display_mode pal_mode = {DRM_MODE ("720x576" ,DRM_MODE_TYPE_DRIVER ,13500 ,720 ,720 +20 ,720 +20 +64 ,720 +20 +64 +60 ,0 , -576 ,576 +2 ,576 +2 +3 ,576 +2 +3 +20 ,0 , +576 ,576 +4 ,576 +4 +6 ,625 ,0 ,DRM_MODE_FLAG_INTERLACE ) };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 363/717 soc/tegra: fuse: Drop Kconfig dependency on TEGRA20_APB_DMA
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit 2254182807fc09ba9dec9a42ef239e373796f1b2 ]
The DMA subsystem could be entirely disabled in Kconfig and then the TEGRA20_APB_DMA option isn't available too. Hence kernel configuration fails if DMADEVICES Kconfig option is disabled due to the unsatisfiable dependency.
The FUSE driver isn't a critical driver and currently it only provides NVMEM interface to userspace which isn't known to be widely used, and thus, it's fine if FUSE driver fails to load.
Let's remove the erroneous Kconfig dependency and let the FUSE driver to fail the probing if DMA is unavailable.
--- drivers/soc/tegra/Kconfig | 1 - 1 file changed, 1 deletion(-)
drivers/soc/tegra/Kconfig +0 -1
@@ -136,7 +136,6 @@ config SOC_TEGRA_FUSE def_bool y depends on ARCH_TEGRA select SOC_BUS - select TEGRA20_APB_DMA if ARCH_TEGRA_2x_SOC config SOC_TEGRA_FLOWCTRL bool
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 67/717 drm/virtio: Check whether transferred 2D BO is shmem
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
commit e473216b42aa1fd9fc6b94b608b42c210c655908 upstream.
Transferred 2D BO always must be a shmem BO. Add check for that to prevent NULL dereference if userspace passes a VRAM BO.
--- drivers/gpu/drm/virtio/virtgpu_vq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_vq.c +1 -1
@@ -595,7 +595,7 @@ void virtio_gpu_cmd_transfer_to_host_2d(bool use_dma_api = !virtio_has_dma_quirk (vgdev->vdev);struct virtio_gpu_object_shmem *shmem =to_virtio_gpu_shmem (bo); -if (use_dma_api) +if (virtio_gpu_is_shmem (bo) && use_dma_api)dma_sync_sgtable_for_device (vgdev->vdev->dev.parent, shmem->pages,DMA_TO_DEVICE );
Greg Kroah-Hartman
maintainerPATCH 612/717 drm: panel-orientation-quirks: Add quirk for Aya Neo Air
In reply to Greg Kroah-HartmanFrom: Maya Matuszczyk <[email protected]>
[ Upstream commit e10ea7b9b90219da305a16b3c1252169715a807b ]
Yet another x86 gaming handheld.
This one has many SKUs with quite a few of DMI strings, so let's just use a catchall, just as with Aya Neo Next.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +12 -0
@@ -103,6 +103,12 @@ static const struct drm_dmi_panel_orientation_data lcd800x1280_rightside_up = { .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, }; +static const struct drm_dmi_panel_orientation_data lcd1080x1920_leftside_up = { + .width =1080 , + .height =1920 , + .orientation =DRM_MODE_PANEL_ORIENTATION_LEFT_UP , +}; +static const struct drm_dmi_panel_orientation_data lcd1200x1920_rightside_up = { .width =1200 , .height =1920 ,
@@ -158,6 +164,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AYA NEO 2021"), }, .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* AYA NEO AIR */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"AYANEO" ), + DMI_MATCH(DMI_BOARD_NAME, "AIR"), + }, + .driver_data = (void *)&lcd1080x1920_leftside_up, }, { /* AYA NEO NEXT */ .matches = { DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 593/717 bpf: Adjust kprobe_multi entry_ip for CONFIG_X86_KERNEL_IBT
In reply to Greg Kroah-HartmanFrom: Jiri Olsa <[email protected]>
[ Upstream commit c09eb2e578eb1668bbc84dc07e8d8bd6f04b9a02 ]
Martynas reported bpf_get_func_ip returning +4 address when CONFIG_X86_KERNEL_IBT option is enabled.
When CONFIG_X86_KERNEL_IBT is enabled we'll have endbr instruction at the function entry, which screws return value of bpf_get_func_ip() helper that should return the function address.
There's short term workaround for kprobe_multi bpf program made by Alexei [1], but we need this fixup also for bpf_get_attach_cookie, that returns cookie based on the entry_ip value.
Moving the fixup in the fprobe handler, so both bpf_get_func_ip and bpf_get_attach_cookie get expected function address when CONFIG_X86_KERNEL_IBT option is enabled.
Also renaming kprobe_multi_link_handler entry_ip argument to fentry_ip so it's clearer this is an ftrace __fentry__ ip.
[1] commit 7f0059b58f02 ("selftests/bpf: Fix kprobe_multi test.")
--- kernel/trace/bpf_trace.c | 20 +++++++++++++++++-- .../selftests/bpf/progs/kprobe_multi.c | 4 +--- 2 files changed, 19 insertions(+), 5 deletions(-)
kernel/trace/bpf_trace.c +18 -2
@@ -1026,6 +1026,22 @@ static const struct bpf_func_proto bpf_get_func_ip_proto_tracing = { .arg1_type = ARG_PTR_TO_CTX, }; +#ifdef CONFIG_X86_KERNEL_IBT +static unsigned long get_entry_ip (unsigned long fentry_ip) +{ +u32 instr; + +/* Being extra safe in here in case entry ip is on the page-edge. */ +if (get_kernel_nofault (instr, (u32 *) fentry_ip -1 )) +return fentry_ip; +if (is_endbr (instr)) + fentry_ip -=ENDBR_INSN_SIZE ; +return fentry_ip; +} +#else +#define get_entry_ip (fentry_ip) fentry_ip +#endif + BPF_CALL_1(bpf_get_func_ip_kprobe, struct pt_regs *, regs) {struct kprobe *kp =kprobe_running ();
@@ -2414,13 +2430,13 @@ kprobe_multi_link_prog_run(struct bpf_kprobe_multi_link *link, }static void -kprobe_multi_link_handler (struct fprobe *fp,unsigned long entry_ip, +kprobe_multi_link_handler (struct fprobe *fp,unsigned long fentry_ip,struct pt_regs *regs) {struct bpf_kprobe_multi_link *link; link = container_of(fp, struct bpf_kprobe_multi_link, fp); -kprobe_multi_link_prog_run (link, entry_ip, regs); +kprobe_multi_link_prog_run (link,get_entry_ip (fentry_ip), regs); }static int symbols_cmp_r (const void *a,const void *b,const void *priv)
tools/testing/selftests/bpf/progs/kprobe_multi.c +1 -3
@@ -36,15 +36,13 @@ __u64 kretprobe_test6_result = 0;__u64 kretprobe_test7_result =0 ;__u64 kretprobe_test8_result =0 ; -extern bool CONFIG_X86_KERNEL_IBT __kconfig __weak; -static void kprobe_multi_check (void *ctx,bool is_return) {if (bpf_get_current_pid_tgid () >>32 != pid)return ;__u64 cookie = test_cookie ?bpf_get_attach_cookie (ctx) :0 ; -__u64 addr =bpf_get_func_ip (ctx) - (CONFIG_X86_KERNEL_IBT ?4 :0 ); +__u64 addr =bpf_get_func_ip (ctx);#define SET (__var, __addr, __cookie) ({ \ if (((const void *) addr == __addr) && \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 391/717 HSI: omap_ssi: Fix refcount leak in ssi_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 9a2ea132df860177b33c9fd421b26c4e9a0a9396 ]
When returning or breaking early from a for_each_available_child_of_node() loop, we need to explicitly call of_node_put() on the child node to possibly release the node.
--- drivers/hsi/controllers/omap_ssi_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/hsi/controllers/omap_ssi_core.c +1 -0
@@ -524,6 +524,7 @@ static int ssi_probe(struct platform_device *pd)if (!childpdev) { err = -ENODEV ;dev_err (&pd->dev,"failed to create ssi controller port\n" ); +of_node_put (child); goto out3; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 450/717 phy: qualcomm: call clk_disable_unprepare in the error handling
In reply to Greg Kroah-HartmanFrom: Dongliang Mu <[email protected]>
[ Upstream commit c3966ced8eb8dc53b6c8d7f97d32cc8a2107d83e ]
Smatch reports the following error:
drivers/phy/qualcomm/phy-qcom-usb-hsic.c:82 qcom_usb_hsic_phy_power_on()
warn: 'uphy->cal_clk' from clk_prepare_enable() not released on lines:
58.drivers/phy/qualcomm/phy-qcom-usb-hsic.c:82 qcom_usb_hsic_phy_power_on()
warn: 'uphy->cal_sleep_clk' from clk_prepare_enable() not released on
lines: 58.drivers/phy/qualcomm/phy-qcom-usb-hsic.c:82 qcom_usb_hsic_phy_power_on()
warn: 'uphy->phy_clk' from clk_prepare_enable() not released on lines:
58.
Fix this by calling proper clk_disable_unprepare calls.
--- drivers/phy/qualcomm/phy-qcom-usb-hsic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/phy/qualcomm/phy-qcom-usb-hsic.c +4 -2
@@ -54,8 +54,10 @@ static int qcom_usb_hsic_phy_power_on(struct phy *phy)/* Configure pins for HSIC functionality */ pins_default =pinctrl_lookup_state (uphy->pctl,PINCTRL_STATE_DEFAULT ); -if (IS_ERR (pins_default)) -return PTR_ERR (pins_default); +if (IS_ERR (pins_default)) { + ret =PTR_ERR (pins_default); + goto err_ulpi; + } ret =pinctrl_select_state (uphy->pctl, pins_default);if (ret)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 38/717 fs: dlm: fix invalid derefence of sb_lvbptr
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
commit 7175e131ebba47afef47e6ac4d5bab474d1e6e49 upstream.
I experience issues when putting a lkbsb on the stack and have sb_lvbptr field to a dangled pointer while not using DLM_LKF_VALBLK. It will crash with the following kernel message, the dangled pointer is here 0xdeadbeef as example:
[ 102.749317] BUG: unable to handle page fault for address: 00000000deadbeef [ 102.749320] #PF: supervisor read access in kernel mode [ 102.749323] #PF: error_code(0x0000) - not-present page [ 102.749325] PGD 0 P4D 0 [ 102.749332] Oops: 0000 [#1] PREEMPT SMP PTI [ 102.749336] CPU: 0 PID: 1567 Comm: lock_torture_wr Tainted: G W 5.19.0-rc3+ #1565 [ 102.749343] Hardware name: Red Hat KVM/RHEL-AV, BIOS 1.16.0-2.module+el8.7.0+15506+033991b0 04/01/2014 [ 102.749344] RIP: 0010:memcpy_erms+0x6/0x10 [ 102.749353] Code: cc cc cc cc eb 1e 0f 1f 00 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 f3 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 89 d1 <f3> a4 c3 0f 1f 80 00 00 00 00 48 89 f8 48 83 fa 20 72 7e 40 38 fe [ 102.749355] RSP: 0018:ffff97a58145fd08 EFLAGS: 00010202 [ 102.749358] RAX: ffff901778b77070 RBX: 0000000000000000 RCX: 0000000000000040 [ 102.749360] RDX: 0000000000000040 RSI: 00000000deadbeef RDI: ffff901778b77070 [ 102.749362] RBP: ffff97a58145fd10 R08: ffff901760b67a70 R09: 0000000000000001 [ 102.749364] R10: ffff9017008e2cb8 R11: 0000000000000001 R12: ffff901760b67a70 [ 102.749366] R13: ffff901760b78f00 R14: 0000000000000003 R15: 0000000000000001 [ 102.749368] FS: 0000000000000000(0000) GS:ffff901876e00000(0000) knlGS:0000000000000000 [ 102.749372] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 102.749374] CR2: 00000000deadbeef CR3: 000000017c49a004 CR4: 0000000000770ef0 [ 102.749376] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 102.749378] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 102.749379] PKRU: 55555554 [ 102.749381] Call Trace: [ 102.749382] <TASK> [ 102.749383] ? send_args+0xb2/0xd0 [ 102.749389] send_common+0xb7/0xd0 [ 102.749395] _unlock_lock+0x2c/0x90 [ 102.749400] unlock_lock.isra.56+0x62/0xa0 [ 102.749405] dlm_unlock+0x21e/0x330 [ 102.749411] ? lock_torture_stats+0x80/0x80 [dlm_locktorture] [ 102.749416] torture_unlock+0x5a/0x90 [dlm_locktorture] [ 102.749419] ? preempt_count_sub+0xba/0x100 [ 102.749427] lock_torture_writer+0xbd/0x150 [dlm_locktorture] [ 102.786186] kthread+0x10a/0x130 [ 102.786581] ? kthread_complete_and_exit+0x20/0x20 [ 102.787156] ret_from_fork+0x22/0x30 [ 102.787588] </TASK> [ 102.787855] Modules linked in: dlm_locktorture torture rpcsec_gss_krb5 intel_rapl_msr intel_rapl_common kvm_intel iTCO_wdt iTCO_vendor_support kvm vmw_vsock_virtio_transport qxl irqbypass vmw_vsock_virtio_transport_common drm_ttm_helper crc32_pclmul joydev crc32c_intel ttm vsock virtio_scsi virtio_balloon snd_pcm drm_kms_helper virtio_console snd_timer snd drm soundcore syscopyarea i2c_i801 sysfillrect sysimgblt i2c_smbus pcspkr fb_sys_fops lpc_ich serio_raw [ 102.792536] CR2: 00000000deadbeef [ 102.792930] ---[ end trace 0000000000000000 ]---
This patch fixes the issue by checking also on DLM_LKF_VALBLK on exflags is set when copying the lvbptr array instead of if it's just null which fixes for me the issue.
I think this patch can fix other dlm users as well, depending how they handle the init, freeing memory handling of sb_lvbptr and don't set DLM_LKF_VALBLK for some dlm_lock() calls. It might a there could be a hidden issue all the time. However with checking on DLM_LKF_VALBLK the user always need to provide a sb_lvbptr non-null value. There might be more intelligent handling between per ls lvblen, DLM_LKF_VALBLK and non-null to report the user the way how DLM API is used is wrong but can be added for later, this will only fix the current behaviour.
--- fs/dlm/lock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/dlm/lock.c +1 -1
@@ -3672,7 +3672,7 @@ static void send_args(struct dlm_rsb *r,case cpu_to_le32 (DLM_MSG_REQUEST_REPLY ):case cpu_to_le32 (DLM_MSG_CONVERT_REPLY ):case cpu_to_le32 (DLM_MSG_GRANT ): -if (!lkb->lkb_lvbptr) +if (!lkb->lkb_lvbptr || !(lkb->lkb_exflags &DLM_LKF_VALBLK ))break ;memcpy (ms->m_extra, lkb->lkb_lvbptr, r->res_ls->ls_lvblen);break ;
Greg Kroah-Hartman
maintainerPATCH 62/717 nvme-multipath: fix possible hang in live ns resize with ANA access
In reply to Greg Kroah-HartmanFrom: Sagi Grimberg <[email protected]>
commit 72e3b8883a36e80ebfa41015c7b6926ce31ace05 upstream.
When we revalidate paths as part of ns size change (as of commit e7d65803e2bb), it is possible that during the path revalidation, the only paths that is IO capable (i.e. optimized/non-optimized) are the ones that ns resize was not yet informed to the host, which will cause inflight requests to be requeued (as we have available paths but none are IO capable). These requests on the requeue list are waiting for someone to resubmit them at some point.
The IO capable paths will eventually notify the ns resize change to the host, but there is nothing that will kick the requeue list to resubmit the queued requests.
Fix this by always kicking the requeue list, and if no IO capable path exists, these requests will be queued again.
A typical log that indicates that IOs are requeued:
--
nvme nvme1: creating 4 I/O queues.
nvme nvme1: new ctrl: "testnqn1"
nvme nvme2: creating 4 I/O queues.
nvme nvme2: mapped 4/0/0 default/read/poll queues. nvme nvme2: new ctrl: NQN "testnqn1", addr 127.0.0.1:8009 nvme nvme1: rescanning namespaces.
nvme1n1: detected capacity change from 2097152 to 4194304 block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O nvme nvme2: rescanning namespaces.
--
--- drivers/nvme/host/multipath.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/host/multipath.c +1 -0
@@ -182,6 +182,7 @@ void nvme_mpath_revalidate_paths(structfor_each_node (node)rcu_assign_pointer (head->current_path[node],NULL ); +kblockd_schedule_work (&head->requeue_work); }static bool nvme_path_is_disabled (struct nvme_ns *ns)
Greg Kroah-Hartman
maintainerPATCH 598/717 drm/nouveau/nouveau_bo: fix potential memory leak in nouveau_bo_alloc()
In reply to Greg Kroah-HartmanFrom: Jianglei Nie <[email protected]>
[ Upstream commit 6dc548745d5b5102e3c53dc5097296ac270b6c69 ]
nouveau_bo_alloc() allocates a memory chunk for "nvbo" with kzalloc(). When some error occurs, "nvbo" should be released. But when WARN_ON(pi < 0)) equals true, the function return ERR_PTR without releasing the "nvbo", which will lead to a memory leak.
We should release the "nvbo" with kfree() if WARN_ON(pi < 0)) equals true.
--- drivers/gpu/drm/nouveau/nouveau_bo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_bo.c +3 -1
@@ -281,8 +281,10 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain,break ; } -if (WARN_ON (pi <0 )) +if (WARN_ON (pi <0 )) { +kfree (nvbo);return ERR_PTR (-EINVAL ); + }/* Disable compression if suitable settings couldn't be found. */ if (nvbo->comp && !vmm->page[pi].comp) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 615/717 platform/x86: msi-laptop: Change DMI match / alias strings to fix module autoloading
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 2a2565272a3628e45d61625e36ef17af7af4e3de ]
On a MSI S270 with Fedora 37 x86_64 / systemd-251.4 the module does not properly autoload.
This is likely caused by issues with how systemd-udevd handles the single quote char (') which is part of the sys_vendor / chassis_vendor strings on this laptop. As a workaround remove the single quote char + everything behind it from the sys_vendor + chassis_vendor matches. This fixes the module not autoloading.
--- drivers/platform/x86/msi-laptop.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/platform/x86/msi-laptop.c +3 -5
@@ -596,11 +596,10 @@ static const struct dmi_system_id msi_dmi_table[] __initconst = { { .ident = "MSI S270", .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"MICRO-STAR INT'L CO.,LTD" ), +DMI_MATCH (DMI_SYS_VENDOR ,"MICRO-STAR INT" ),DMI_MATCH (DMI_PRODUCT_NAME ,"MS-1013" ),DMI_MATCH (DMI_PRODUCT_VERSION ,"0131" ), -DMI_MATCH (DMI_CHASSIS_VENDOR , -"MICRO-STAR INT'L CO.,LTD" ) +DMI_MATCH (DMI_CHASSIS_VENDOR ,"MICRO-STAR INT" ) }, .driver_data = &quirk_old_ec_model, .callback = dmi_check_cb
@@ -633,8 +632,7 @@ static const struct dmi_system_id msi_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"NOTEBOOK" ),DMI_MATCH (DMI_PRODUCT_NAME ,"SAM2000" ),DMI_MATCH (DMI_PRODUCT_VERSION ,"0131" ), -DMI_MATCH (DMI_CHASSIS_VENDOR , -"MICRO-STAR INT'L CO.,LTD" ) +DMI_MATCH (DMI_CHASSIS_VENDOR ,"MICRO-STAR INT" ) }, .driver_data = &quirk_old_ec_model, .callback = dmi_check_cb
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 607/717 drm/amdgpu: Skip the program of MMMC_VM_AGP_* in SRIOV on MMHUB v3_0_0
In reply to Greg Kroah-HartmanFrom: Yifan Zha <[email protected]>
[ Upstream commit c1026c6f319724dc88fc08d9d9d35bcbdf492b42 ]
[Why]
VF should not program these registers, the value were defined in the host.
[How]
Skip writing them in SRIOV environment and program them on host side.
--- drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c +5 -5
@@ -169,17 +169,17 @@ static void mmhub_v3_0_init_system_aperture_regs(struct amdgpu_device *adev)uint64_t value;uint32_t tmp; -/* Disable AGP. */ -WREG32_SOC15 (MMHUB ,0 , regMMMC_VM_AGP_BASE,0 ); -WREG32_SOC15 (MMHUB ,0 , regMMMC_VM_AGP_TOP,0 ); -WREG32_SOC15 (MMHUB ,0 , regMMMC_VM_AGP_BOT,0x00FFFFFF ); -if (!amdgpu_sriov_vf (adev)) {/* * the new L1 policy will block SRIOV guest from writing * these regs, and they will be programed at host. * so skip programing these regs. */ +/* Disable AGP. */ +WREG32_SOC15 (MMHUB ,0 , regMMMC_VM_AGP_BASE,0 ); +WREG32_SOC15 (MMHUB ,0 , regMMMC_VM_AGP_TOP,0 ); +WREG32_SOC15 (MMHUB ,0 , regMMMC_VM_AGP_BOT,0x00FFFFFF ); +/* Program the system aperture low logical page number. */ WREG32_SOC15 (MMHUB ,0 , regMMMC_VM_SYSTEM_APERTURE_LOW_ADDR, adev->gmc.vram_start >>18 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 590/717 wifi: rt2x00: correctly set BBP register 86 for MT7620
In reply to Greg Kroah-HartmanFrom: Daniel Golle <[email protected]>
[ Upstream commit c9aada64fe6493461127f1522d7e2f01792d2424 ]
Instead of 0 set the correct value for BBP register 86 for MT7620.
--- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +4 -1
@@ -4164,7 +4164,10 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,rt2800_bbp_write (rt2x00dev,62 ,0x37 - rt2x00dev->lna_gain);rt2800_bbp_write (rt2x00dev,63 ,0x37 - rt2x00dev->lna_gain);rt2800_bbp_write (rt2x00dev,64 ,0x37 - rt2x00dev->lna_gain); -rt2800_bbp_write (rt2x00dev,86 ,0 ); +if (rt2x00_rt (rt2x00dev,RT6352 )) +rt2800_bbp_write (rt2x00dev,86 ,0x38 ); +else +rt2800_bbp_write (rt2x00dev,86 ,0 ); }if (rf->channel <=14 ) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 467/717 mfd: fsl-imx25: Fix an error handling path in mx25_tsadc_setup_irq()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 3fa9e4cfb55da512ebfd57336fde468830719298 ]
If devm_of_platform_populate() fails, some resources need to be released.
Introduce a mx25_tsadc_unset_irq() function that undoes mx25_tsadc_setup_irq() and call it both from the new error handling path of the probe and in the remove function.
--- drivers/mfd/fsl-imx25-tsadc.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-)
drivers/mfd/fsl-imx25-tsadc.c +24 -8
@@ -84,6 +84,19 @@ static int mx25_tsadc_setup_irq(struct platform_device *pdev,return 0 ; } +static int mx25_tsadc_unset_irq (struct platform_device *pdev) +{ +struct mx25_tsadc *tsadc =platform_get_drvdata (pdev); +int irq =platform_get_irq (pdev,0 ); + +if (irq) { +irq_set_chained_handler_and_data (irq,NULL ,NULL ); +irq_domain_remove (tsadc->domain); + } + +return 0 ; +} +static void mx25_tsadc_setup_clk (struct platform_device *pdev,struct mx25_tsadc *tsadc) {
@@ -171,18 +184,21 @@ static int mx25_tsadc_probe(struct platform_device *pdev)platform_set_drvdata (pdev, tsadc); -return devm_of_platform_populate (dev); + ret =devm_of_platform_populate (dev); +if (ret) + goto err_irq; + +return 0 ; + +err_irq: +mx25_tsadc_unset_irq (pdev); + +return ret; }static int mx25_tsadc_remove (struct platform_device *pdev) { -struct mx25_tsadc *tsadc =platform_get_drvdata (pdev); -int irq =platform_get_irq (pdev,0 ); - -if (irq) { -irq_set_chained_handler_and_data (irq,NULL ,NULL ); -irq_domain_remove (tsadc->domain); - } +mx25_tsadc_unset_irq (pdev);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 577/717 wifi: ath11k: mhi: fix potential memory leak in ath11k_mhi_register()
In reply to Greg Kroah-HartmanFrom: Jianglei Nie <[email protected]>
[ Upstream commit 43e7c3505ec70db3d3c6458824d5fa40f62e3e7b ]
mhi_alloc_controller() allocates a memory space for mhi_ctrl. When gets some error, mhi_ctrl should be freed with mhi_free_controller(). But when ath11k_mhi_read_addr_from_dt() fails, the function returns without calling mhi_free_controller(), which will lead to a memory leak.
We can fix it by calling mhi_free_controller() when ath11k_mhi_read_addr_from_dt() fails.
--- drivers/net/wireless/ath/ath11k/mhi.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/net/wireless/ath/ath11k/mhi.c +10 -7
@@ -402,8 +402,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci) ret =ath11k_mhi_get_msi (ab_pci);if (ret) {ath11k_err (ab,"failed to get msi for mhi\n" ); -mhi_free_controller (mhi_ctrl); -return ret; + goto free_controller; }if (!test_bit (ATH11K_FLAG_MULTI_MSI_VECTORS , &ab->dev_flags))
@@ -412,7 +411,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)if (test_bit (ATH11K_FLAG_FIXED_MEM_RGN , &ab->dev_flags)) { ret =ath11k_mhi_read_addr_from_dt (mhi_ctrl);if (ret <0 ) -return ret; + goto free_controller; }else { mhi_ctrl->iova_start =0 ; mhi_ctrl->iova_stop =0xFFFFFFFF ;
@@ -440,18 +439,22 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)default :ath11k_err (ab,"failed assign mhi_config for unknown hw rev %d\n" , ab->hw_rev); -mhi_free_controller (mhi_ctrl); -return -EINVAL ; + ret = -EINVAL ; + goto free_controller; } ret =mhi_register_controller (mhi_ctrl, ath11k_mhi_config);if (ret) {ath11k_err (ab,"failed to register to mhi bus, err = %d\n" , ret); -mhi_free_controller (mhi_ctrl); -return ret; + goto free_controller; }return 0 ; + +free_controller: +mhi_free_controller (mhi_ctrl); + ab_pci->mhi_ctrl =NULL ; +return ret; }void ath11k_mhi_unregister (struct ath11k_pci *ab_pci)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 617/717 ASoC: SOF: pci: Change DMI match info to support all Chrome platforms
In reply to Greg Kroah-HartmanFrom: Jairaj Arava <[email protected]>
[ Upstream commit c1c1fc8103f794a10c5c15e3c17879caf4f42c8f ]
In some Chrome platforms if OEM's use their own string as SYS_VENDOR than "Google", it leads to firmware load failure from intel/sof/community path.
Hence, changing SYS_VENDOR to PRODUCT_FAMILY in which "Google" is used as common prefix and is supported in all Chrome platforms.
--- sound/soc/sof/sof-pci-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sof/sof-pci-dev.c +1 -1
@@ -138,7 +138,7 @@ static const struct dmi_system_id community_key_platforms[] = { .ident = "Google Chromebooks", .callback = chromebook_use_community_key, .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Google"), + DMI_MATCH(DMI_PRODUCT_FAMILY, "Google"), } }, {},
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 35/717 i2c: designware: Fix handling of real but unexpected device interrupts
In reply to Greg Kroah-HartmanFrom: Jarkko Nikula <[email protected]>
commit 301c8f5c32c8fb79c67539bc23972dc3ef48024c upstream.
Commit c7b79a752871 ("mfd: intel-lpss: Add Intel Alder Lake PCH-S PCI IDs") caused a regression on certain Gigabyte motherboards for Intel Alder Lake-S where system crashes to NULL pointer dereference in i2c_dw_xfer_msg() when system resumes from S3 sleep state ("deep").
I was able to debug the issue on Gigabyte Z690 AORUS ELITE and made following notes:
- Issue happens when resuming from S3 but not when resuming from "s2idle"
- PCI device 00:15.0 == i2c_designware.0 is already in D0 state when system enters into pci_pm_resume_noirq() while all other i2c_designware PCI devices are in D3. Devices were runtime suspended and in D3 prior entering into suspend
- Interrupt comes after pci_pm_resume_noirq() when device interrupts are re-enabled
- According to register dump the interrupt really comes from the i2c_designware.0. Controller is enabled, I2C target address register points to a one detectable I2C device address 0x60 and the DW_IC_RAW_INTR_STAT register START_DET, STOP_DET, ACTIVITY and TX_EMPTY bits are set indicating completed I2C transaction.
My guess is that the firmware uses this controller to communicate with an on-board I2C device during resume but does not disable the controller before giving control to an operating system.
I was told the UEFI update fixes this but never the less it revealed the driver is not ready to handle TX_EMPTY (or RX_FULL) interrupt when device is supposed to be idle and state variables are not set (especially the dev->msgs pointer which may point to NULL or stale old data).
Introduce a new software status flag STATUS_ACTIVE indicating when the controller is active in driver point of view. Now treat all interrupts that occur when is not set as unexpected and mask all interrupts from the controller.
--- drivers/i2c/busses/i2c-designware-core.h | 7 +++++-- drivers/i2c/busses/i2c-designware-master.c | 13 +++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-designware-core.h +5 -2
@@ -126,8 +126,9 @@* status codes */ #define STATUS_IDLE 0x0 -#define STATUS_WRITE_IN_PROGRESS 0x1 -#define STATUS_READ_IN_PROGRESS 0x2 +#define STATUS_ACTIVE 0x1 +#define STATUS_WRITE_IN_PROGRESS 0x2 +#define STATUS_READ_IN_PROGRESS 0x4/* * operation modes
@@ -334,12 +335,14 @@ void i2c_dw_disable_int(struct dw_i2c_destatic inline void __i2c_dw_enable (struct dw_i2c_dev *dev) { + dev->status |=STATUS_ACTIVE ;regmap_write (dev->map,DW_IC_ENABLE ,1 ); }static inline void __i2c_dw_disable_nowait (struct dw_i2c_dev *dev) {regmap_write (dev->map,DW_IC_ENABLE ,0 ); + dev->status &= ~STATUS_ACTIVE ; }void __i2c_dw_disable (struct dw_i2c_dev *dev);
drivers/i2c/busses/i2c-designware-master.c +13 -0
@@ -716,6 +716,19 @@ static int i2c_dw_irq_handler_master(stru32 stat; stat =i2c_dw_read_clear_intrbits (dev); + +if (!(dev->status &STATUS_ACTIVE )) { +/* +* Unexpected interrupt in driver point of view. State +* variables are either unset or stale so acknowledge and +* disable interrupts for suppressing further interrupts if +* interrupt really came from this HW (E.g. firmware has left +* the HW active). +*/ +regmap_write (dev->map,DW_IC_INTR_MASK ,0 ); +return 0 ; + } +if (stat &DW_IC_INTR_TX_ABRT ) { dev->cmd_err |=DW_IC_ERR_TX_ABRT ; dev->status =STATUS_IDLE ;
Greg Kroah-Hartman
maintainerPATCH 595/717 Bluetooth: L2CAP: Fix user-after-free
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 35fcbc4243aad7e7d020b7c1dfb14bb888b20a4f ]
This uses l2cap_chan_hold_unless_zero() after calling __l2cap_get_chan_blah() to prevent the following trace:
Bluetooth: l2cap_core.c:static void l2cap_chan_destroy(struct kref *kref)
Bluetooth: chan 0000000023c4974d
Bluetooth: parent 00000000ae861c08
==================================================================
BUG: KASAN: use-after-free in __mutex_waiter_is_first kernel/locking/mutex.c:191 [inline] BUG: KASAN: use-after-free in __mutex_lock_common kernel/locking/mutex.c:671 [inline] BUG: KASAN: use-after-free in __mutex_lock+0x278/0x400 kernel/locking/mutex.c:729 Read of size 8 at addr ffff888006a49b08 by task kworker/u3:2/389
--- net/bluetooth/l2cap_core.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/bluetooth/l2cap_core.c +7 -0
@@ -4308,6 +4308,12 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn, } } + chan =l2cap_chan_hold_unless_zero (chan); +if (!chan) { + err = -EBADSLT ; + goto unlock; + } + err =0 ;l2cap_chan_lock (chan);
@@ -4337,6 +4343,7 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn, }l2cap_chan_unlock (chan); +l2cap_chan_put (chan); unlock:mutex_unlock (&conn->chan_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 465/717 fsi: core: Check error number after calling ida_simple_get
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 35af9fb49bc5c6d61ef70b501c3a56fe161cce3e ]
If allocation fails, the ida_simple_get() will return error number. So master->idx could be error number and be used in dev_set_name(). Therefore, it should be better to check it and return error if fails, like the ida_simple_get() in __fsi_get_new_minor().
--- drivers/fsi/fsi-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/fsi/fsi-core.c +3 -0
@@ -1314,6 +1314,9 @@ int fsi_master_register(struct fsi_master *master)mutex_init (&master->scan_lock); master->idx =ida_simple_get (&master_ida,0 ,INT_MAX ,GFP_KERNEL ); +if (master->idx <0 ) +return master->idx; +dev_set_name (&master->dev,"fsi%d" , master->idx); master->dev.class = &fsi_master_class;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 618/717 ASoC: SOF: add quirk to override topology mclk_id
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit d136949dd8e2e309dc2f186507486b71cbe9acdb ]
Some Intel-based platforms rely on a topology file that hard-codes the use of MCLK0. This is incorrect in 10% of the cases. Rather than generating yet another set of topology files, this patch adds a kernel module parameter to override the topology value.
In hindsight, we should never have allowed mclks to be specified in topology, this is a hardware-level information that should not have been visible in the topology.
Future patches will try to set this value automagically, e.g. by parsing the NHLT content.
--- sound/soc/sof/intel/hda.c | 11 +++++++++++ sound/soc/sof/ipc3-topology.c | 7 +++++++ sound/soc/sof/sof-priv.h | 4 ++++ 3 files changed, 22 insertions(+)
sound/soc/sof/intel/hda.c +11 -0
@@ -376,6 +376,10 @@ static int dmic_num_override = -1;module_param_named (dmic_num, dmic_num_override, int,0444 );MODULE_PARM_DESC (dmic_num,"SOF HDA DMIC number" ); +static int mclk_id_override =-1 ; +module_param_named (mclk_id, mclk_id_override, int,0444 ); +MODULE_PARM_DESC (mclk_id,"SOF SSP mclk_id" ); +#if IS_ENABLED (CONFIG_SND_SOC_SOF_HDA )static bool hda_codec_use_common_hdmi =IS_ENABLED (CONFIG_SND_HDA_CODEC_HDMI );module_param_named (use_common_hdmi, hda_codec_use_common_hdmi, bool,0444 );
@@ -1433,6 +1437,13 @@ struct snd_soc_acpi_mach *hda_machine_select(struct snd_sof_dev *sdev) sof_pdata->tplg_filename = tplg_filename; } + +/* check if mclk_id should be modified from topology defaults */ +if (mclk_id_override >=0 ) { +dev_info (sdev->dev,"Overriding topology with MCLK %d from kernel_parameter\n" , mclk_id_override); + sdev->mclk_id_override = true; + sdev->mclk_id_quirk = mclk_id_override; + } }/*
sound/soc/sof/ipc3-topology.c +7 -0
@@ -1233,6 +1233,7 @@ static int sof_link_afe_load(struct snd_soc_component *scomp, struct snd_sof_daistatic int sof_link_ssp_load (struct snd_soc_component *scomp,struct snd_sof_dai_link *slink,struct sof_ipc_dai_config *config,struct snd_sof_dai *dai) { +struct snd_sof_dev *sdev =snd_soc_component_get_drvdata (scomp);struct snd_soc_tplg_hw_config *hw_config = slink->hw_configs;struct sof_dai_private_data *private = dai->private;u32 size =sizeof (*config);
@@ -1257,6 +1258,12 @@ static int sof_link_ssp_load(struct snd_soc_component *scomp, struct snd_sof_dai config[i].hdr.size = size; +if (sdev->mclk_id_override) { +dev_dbg (scomp->dev,"tplg: overriding topology mclk_id %d by quirk %d\n" , + config[i].ssp.mclk_id, sdev->mclk_id_quirk); + config[i].ssp.mclk_id = sdev->mclk_id_quirk; + } +/* copy differentiating hw configs to ipc structs */ config[i].ssp.mclk_rate =le32_to_cpu (hw_config[i].mclk_rate); config[i].ssp.bclk_rate =le32_to_cpu (hw_config[i].bclk_rate);
sound/soc/sof/sof-priv.h +4 -0
@@ -585,6 +585,10 @@ struct snd_sof_dev {/* to protect the ipc_rx_handler_list and dsp_state_handler_list list */ struct mutex client_event_handler_mutex; +/* quirks to override topology values */ +bool mclk_id_override; +u16 mclk_id_quirk;/* same size as in IPC3 definitions */ +void *private;/* core does not touch this */ };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 613/717 platform/chrome: cros_ec: Notify the PM of wake events during resume
In reply to Greg Kroah-HartmanFrom: Jameson Thies <[email protected]>
[ Upstream commit 8edd2752b0aa498b3a61f3caee8f79f7e0567fad ]
cros_ec_handle_event in the cros_ec driver can notify the PM of wake events. When a device is suspended, cros_ec_handle_event will not check MKBP events. Instead, received MKBP events are checked during resume by cros_ec_report_events_during_suspend. But cros_ec_report_events_during_suspend cannot notify the PM if received events are wake events, causing wake events to not be reported if received while the device is suspended.
Update cros_ec_report_events_during_suspend to notify the PM of wake events during resume by calling pm_wakeup_event.
--- drivers/platform/chrome/cros_ec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/platform/chrome/cros_ec.c +7 -1
@@ -352,10 +352,16 @@ EXPORT_SYMBOL(cros_ec_suspend);static void cros_ec_report_events_during_suspend (struct cros_ec_device *ec_dev) { +bool wake_event; +while (ec_dev->mkbp_event_supported && -cros_ec_get_next_event (ec_dev,NULL ,NULL ) >0 ) +cros_ec_get_next_event (ec_dev, &wake_event,NULL ) >0 ) {blocking_notifier_call_chain (&ec_dev->event_notifier,1 , ec_dev); + +if (wake_event &&device_may_wakeup (ec_dev->dev)) +pm_wakeup_event (ec_dev->dev,0 ); + } }/**
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 631/717 ARM: dts: imx6q: add missing properties for sram
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit b11d083c5dcec7c42fe982c854706d404ddd3a5f ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6q.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/imx6q.dtsi +3 -0
@@ -163,6 +163,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x40000>; + ranges = <0 0x00900000 0x40000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 112/717 f2fs: fix wrong continue condition in GC
In reply to Greg Kroah-HartmanFrom: Jaegeuk Kim <[email protected]>
commit 605b0a778aa2599aa902ae639b8e9937c74b869b upstream.
We should decrease the frozen counter.
--- fs/f2fs/gc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
fs/f2fs/gc.c +4 -8
@@ -97,14 +97,10 @@ static int gc_thread_func(void *data)*/ if (sbi->gc_mode ==GC_URGENT_HIGH ) {spin_lock (&sbi->gc_urgent_high_lock); -if (sbi->gc_urgent_high_limited) { -if (!sbi->gc_urgent_high_remaining) { - sbi->gc_urgent_high_limited = false; -spin_unlock (&sbi->gc_urgent_high_lock); - sbi->gc_mode =GC_NORMAL ; -continue ; - } - sbi->gc_urgent_high_remaining--; +if (sbi->gc_urgent_high_limited && + !sbi->gc_urgent_high_remaining--) { + sbi->gc_urgent_high_limited = false; + sbi->gc_mode =GC_NORMAL ; }spin_unlock (&sbi->gc_urgent_high_lock); }
Greg Kroah-Hartman
maintainerPATCH 634/717 ARM: dts: imx6sl: add missing properties for sram
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit 60c9213a1d9941a8b33db570796c3f9be8984974 ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6sl.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/imx6sl.dtsi +3 -0
@@ -115,6 +115,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SL_CLK_OCRAM>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 636/717 ARM: dts: imx6sx: add missing properties for sram
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit 415432c008b2bce8138841356ba444631cabaa50 ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6sx.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/boot/dts/imx6sx.dtsi +6 -0
@@ -164,12 +164,18 @@ ocram_s: sram@8f8000 { compatible = "mmio-sram"; reg = <0x008f8000 0x4000>; + ranges = <0 0x008f8000 0x4000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SX_CLK_OCRAM_S>; }; ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SX_CLK_OCRAM>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 640/717 arm64: dts: imx8mm-kontron: Use the VSELECT signal to switch SD card IO voltage
In reply to Greg Kroah-HartmanFrom: Frieder Schrempf <[email protected]>
[ Upstream commit eef2c0217e02b6c7ed5b10b82ea944127145e113 ]
It turns out that it is not necessary to declare the VSELECT signal as GPIO and let the PMIC driver set it to a fixed high level. This switches the voltage between 3.3V and 1.8V by setting the PMIC register for LDO5 accordingly.
Instead we can do it like other boards already do and simply mux the VSELECT signal of the USDHC interface to the pin. This makes sure that the correct voltage is selected by setting the PMIC's SD_VSEL input to high or low accordingly.
--- arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts | 3 +++ arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts +3 -0
@@ -321,6 +321,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d0 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d0 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; };
@@ -333,6 +334,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d4 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d4 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; };
@@ -345,6 +347,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d6 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d6 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; }; };
arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi +0 -2
@@ -86,7 +86,6 @@ pinctrl-0 = <&pinctrl_pmic>; interrupt-parent = <&gpio1>; interrupts = <0 IRQ_TYPE_LEVEL_LOW>; - sd-vsel-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; regulators { reg_vdd_soc: BUCK1 {
@@ -229,7 +228,6 @@ pinctrl_pmic: pmicgrp { fsl,pins = < MX8MM_IOMUXC_GPIO1_IO00_GPIO1_IO0 0x141 - MX8MM_IOMUXC_GPIO1_IO04_GPIO1_IO4 0x141 >; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 642/717 btrfs: dump extra info if one free space cache has more bitmaps than it should
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
[ Upstream commit 62cd9d4474282a1eb84f945955c56cbfc42e1ffe ]
There is an internal report on hitting the following ASSERT() in recalculate_thresholds():
ASSERT(ctl->total_bitmaps <= max_bitmaps);
Above @max_bitmaps is calculated using the following variables:
- bytes_per_bg
8 * 4096 * 4096 (128M) for x86_64/x86.
- block_group->length
The length of the block group.
@max_bitmaps is the rounded up value of block_group->length / 128M.
Normally one free space cache should not have more bitmaps than above value, but when it happens the ASSERT() can be triggered if CONFIG_BTRFS_ASSERT is also enabled.
But the ASSERT() itself won't provide enough info to know which is going wrong.
Is the bg too small thus it only allows one bitmap?
Or is there something else wrong?
So although I haven't found extra reports or crash dump to do further investigation, add the extra info to make it more helpful to debug.
--- fs/btrfs/free-space-cache.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/btrfs/free-space-cache.c +6 -0
@@ -693,6 +693,12 @@ static void recalculate_thresholds(struct btrfs_free_space_ctl *ctl) max_bitmaps =max_t (u64, max_bitmaps,1 ); +if (ctl->total_bitmaps > max_bitmaps) +btrfs_err (block_group->fs_info, +"invalid free space control: bg start=%llu len=%llu total_bitmaps=%u unit=%u max_bitmaps=%llu bytes_per_bg=%llu" , + block_group->start, block_group->length, + ctl->total_bitmaps, ctl->unit, max_bitmaps, + bytes_per_bg);ASSERT (ctl->total_bitmaps <= max_bitmaps);/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 645/717 btrfs: dont print information about space cache or tree every remount
In reply to Greg Kroah-HartmanFrom: Maciej S. Szmigiero <[email protected]>
[ Upstream commit dbecac26630014d336a8e5ea67096ff18210fb9c ]
btrfs currently prints information about space cache or free space tree being in use on every remount, regardless whether such remount actually enabled or disabled one of these features.
This is actually unnecessary since providing remount options changing the state of these features will explicitly print the appropriate notice.
Let's instead print such unconditional information just on an initial mount to avoid filling the kernel log when, for example, laptop-mode-tools remount the fs on some events.
--- fs/btrfs/super.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
fs/btrfs/super.c +7 -4
@@ -625,6 +625,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,int saved_compress_level;bool saved_compress_force;int no_compress =0 ; +const bool remounting =test_bit (BTRFS_FS_STATE_REMOUNTING , &info->fs_state);if (btrfs_fs_compat_ro (info,FREE_SPACE_TREE ))btrfs_set_opt (info->mount_opt,FREE_SPACE_TREE );
@@ -1136,10 +1137,12 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, }if (!ret) ret =btrfs_check_mountopts_zoned (info); -if (!ret &&btrfs_test_opt (info,SPACE_CACHE )) -btrfs_info (info,"disk space caching is enabled" ); -if (!ret &&btrfs_test_opt (info,FREE_SPACE_TREE )) -btrfs_info (info,"using free space tree" ); +if (!ret && !remounting) { +if (btrfs_test_opt (info,SPACE_CACHE )) +btrfs_info (info,"disk space caching is enabled" ); +if (btrfs_test_opt (info,FREE_SPACE_TREE )) +btrfs_info (info,"using free space tree" ); + }return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 632/717 ARM: dts: imx6dl: add missing properties for sram
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit f5848b95633d598bacf0500e0108dc5961af88c0 ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6dl.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/imx6dl.dtsi +3 -0
@@ -84,6 +84,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 647/717 ARM: 9233/1: stacktrace: Skip frame pointer boundary check for call_with_stack()
In reply to Greg Kroah-HartmanFrom: Li Huafei <[email protected]>
[ Upstream commit 5854e4d8530e6ed4c2532a71a6b0474e199d44dd ]
When using the frame pointer unwinder, it was found that the stack trace output of stack_trace_save() is incomplete if the stack contains call_with_stack():
[0x7f00002c] dump_stack_task+0x2c/0x90 [hrtimer]
[0x7f0000a0] hrtimer_hander+0x10/0x18 [hrtimer]
[0x801a67f0] __hrtimer_run_queues+0x1b0/0x3b4
[0x801a7350] hrtimer_run_queues+0xc4/0xd8
[0x801a597c] update_process_times+0x3c/0x88
[0x801b5a98] tick_periodic+0x50/0xd8
[0x801b5bf4] tick_handle_periodic+0x24/0x84
[0x8010ffc4] twd_handler+0x38/0x48
[0x8017d220] handle_percpu_devid_irq+0xa8/0x244
[0x80176e9c] generic_handle_domain_irq+0x2c/0x3c
[0x8052e3a8] gic_handle_irq+0x7c/0x90
[0x808ab15c] generic_handle_arch_irq+0x60/0x80
[0x8051191c] call_with_stack+0x1c/0x20
For the frame pointer unwinder, unwind_frame() checks stackframe::fp by stackframe::sp. Since call_with_stack() switches the SP from one stack to another, stackframe::fp and stackframe: :sp will point to different stacks, so we can no longer check stackframe::fp by stackframe::sp. Skip checking stackframe::fp at this point to avoid this problem.
--- arch/arm/kernel/stacktrace.c | 40 ++++++++++++++++++++++++++++------ arch/arm/lib/call_with_stack.S | 2 ++ 2 files changed, 35 insertions(+), 7 deletions(-)
arch/arm/kernel/stacktrace.c +33 -7
@@ -9,6 +9,8 @@#include <asm/stacktrace.h> #include <asm/traps.h> +#include "reboot.h" +#if defined(CONFIG_FRAME_POINTER ) && !defined(CONFIG_ARM_UNWIND )/* * Unwind the current stack frame and store the new register values in the
@@ -39,29 +41,53 @@* Note that with framepointer enabled, even the leaf functions have the same * prologue and epilogue, therefore we can ignore the LR value in this case. */ -int notrace unwind_frame(struct stackframe *frame) + +extern unsigned long call_with_stack_end; + +static int frame_pointer_check (struct stackframe *frame) {unsigned long high, low;unsigned long fp = frame->fp; +unsigned long pc = frame->pc; + +/* +* call_with_stack() is the only place we allow SP to jump from one +* stack to another, with FP and SP pointing to different stacks, +* skipping the FP boundary check at this point. +*/ +if (pc >= (unsigned long )&call_with_stack && + pc < (unsigned long )&call_with_stack_end) +return 0 ;/* only go to a higher address on the stack */ low = frame->sp; high =ALIGN (low,THREAD_SIZE ); -#ifdef CONFIG_CC_IS_CLANG /* check current frame pointer is within bounds */ +#ifdef CONFIG_CC_IS_CLANG if (fp < low +4 || fp > high -4 )return -EINVAL ; - - frame->sp = frame->fp; - frame->fp =READ_ONCE_NOCHECK (*(unsigned long *)(fp)); - frame->pc =READ_ONCE_NOCHECK (*(unsigned long *)(fp +4 ));#else -/* check current frame pointer is within bounds */ if (fp < low +12 || fp > high -4 )return -EINVAL ; +#endif + +return 0 ; +} + +int notrace unwind_frame(struct stackframe *frame) +{ +unsigned long fp = frame->fp; + +if (frame_pointer_check (frame)) +return -EINVAL ;/* restore the registers from the stack frame */ +#ifdef CONFIG_CC_IS_CLANG + frame->sp = frame->fp; + frame->fp =READ_ONCE_NOCHECK (*(unsigned long *)(fp)); + frame->pc =READ_ONCE_NOCHECK (*(unsigned long *)(fp +4 )); +#else frame->fp =READ_ONCE_NOCHECK (*(unsigned long *)(fp -12 )); frame->sp =READ_ONCE_NOCHECK (*(unsigned long *)(fp -8 )); frame->pc =READ_ONCE_NOCHECK (*(unsigned long *)(fp -4 ));
arch/arm/lib/call_with_stack.S +2 -0
@@ -46,4 +46,6 @@ UNWIND( .setfp fpreg, sp ) pop {fpreg, pc} UNWIND( .fnend ) #endif + .globl call_with_stack_end +call_with_stack_end: ENDPROC(call_with_stack)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 623/717 drm/meson: explicitly remove aggregate driver at module unload time
In reply to Greg Kroah-HartmanFrom: Adrián Larumbe <[email protected]>
[ Upstream commit 8616f2a0589a80e08434212324250eb22f6a66ce ]
Because component_master_del wasn't being called when unloading the meson_drm module, the aggregate device would linger forever in the global aggregate_devices list. That means when unloading and reloading the meson_dw_hdmi module, component_add would call into try_to_bring_up_aggregate_device and find the unbound meson_drm aggregate device.
This would in turn dereference some of the aggregate_device's struct entries which point to memory automatically freed by the devres API when unbinding the aggregate device from meson_drv_unbind, and trigger an use-after-free bug:
[ +0.000014] ============================================================= [ +0.000007] BUG: KASAN: use-after-free in find_components+0x468/0x500 [ +0.000017] Read of size 8 at addr ffff000006731688 by task modprobe/2536 [ +0.000018] CPU: 4 PID: 2536 Comm: modprobe Tainted: G C O 5.19.0-rc6-lrmbkasan+ #1 [ +0.000010] Hardware name: Hardkernel ODROID-N2Plus (DT) [ +0.000008] Call trace: [ +0.000005] dump_backtrace+0x1ec/0x280 [ +0.000011] show_stack+0x24/0x80 [ +0.000007] dump_stack_lvl+0x98/0xd4 [ +0.000010] print_address_description.constprop.0+0x80/0x520 [ +0.000011] print_report+0x128/0x260 [ +0.000007] kasan_report+0xb8/0xfc [ +0.000007] __asan_report_load8_noabort+0x3c/0x50 [ +0.000009] find_components+0x468/0x500 [ +0.000008] try_to_bring_up_aggregate_device+0x64/0x390 [ +0.000009] __component_add+0x1dc/0x49c [ +0.000009] component_add+0x20/0x30 [ +0.000008] meson_dw_hdmi_probe+0x28/0x34 [meson_dw_hdmi] [ +0.000013] platform_probe+0xd0/0x220 [ +0.000008] really_probe+0x3ac/0xa80 [ +0.000008] __driver_probe_device+0x1f8/0x400 [ +0.000008] driver_probe_device+0x68/0x1b0 [ +0.000008] __driver_attach+0x20c/0x480 [ +0.000009] bus_for_each_dev+0x114/0x1b0 [ +0.000007] driver_attach+0x48/0x64 [ +0.000009] bus_add_driver+0x390/0x564 [ +0.000007] driver_register+0x1a8/0x3e4 [ +0.000009] __platform_driver_register+0x6c/0x94 [ +0.000007] meson_dw_hdmi_platform_driver_init+0x30/0x1000 [meson_dw_hdmi] [ +0.000014] do_one_initcall+0xc4/0x2b0 [ +0.000008] do_init_module+0x154/0x570 [ +0.000010] load_module+0x1a78/0x1ea4 [ +0.000008] __do_sys_init_module+0x184/0x1cc [ +0.000008] __arm64_sys_init_module+0x78/0xb0 [ +0.000008] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000009] do_el0_svc+0x50/0x70 [ +0.000008] el0_svc+0x68/0x1a0 [ +0.000009] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190
[ +0.000014] Allocated by task 902: [ +0.000007] kasan_save_stack+0x2c/0x5c [ +0.000009] __kasan_kmalloc+0x90/0xd0 [ +0.000007] __kmalloc_node+0x240/0x580 [ +0.000010] memcg_alloc_slab_cgroups+0xa4/0x1ac [ +0.000010] memcg_slab_post_alloc_hook+0xbc/0x4c0 [ +0.000008] kmem_cache_alloc_node+0x1d0/0x490 [ +0.000009] __alloc_skb+0x1d4/0x310 [ +0.000010] alloc_skb_with_frags+0x8c/0x620 [ +0.000008] sock_alloc_send_pskb+0x5ac/0x6d0 [ +0.000010] unix_dgram_sendmsg+0x2e0/0x12f0 [ +0.000010] sock_sendmsg+0xcc/0x110 [ +0.000007] sock_write_iter+0x1d0/0x304 [ +0.000008] new_sync_write+0x364/0x460 [ +0.000007] vfs_write+0x420/0x5ac [ +0.000008] ksys_write+0x19c/0x1f0 [ +0.000008] __arm64_sys_write+0x78/0xb0 [ +0.000007] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0x1a8/0x260 [ +0.000009] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000008] el0t_64_sync_handler+0x11c/0x150 [ +0.000008] el0t_64_sync+0x18c/0x190
[ +0.000013] Freed by task 2509: [ +0.000008] kasan_save_stack+0x2c/0x5c [ +0.000007] kasan_set_track+0x2c/0x40 [ +0.000008] kasan_set_free_info+0x28/0x50 [ +0.000008] ____kasan_slab_free+0x128/0x1d4 [ +0.000008] __kasan_slab_free+0x18/0x24 [ +0.000007] slab_free_freelist_hook+0x108/0x230 [ +0.000010] kfree+0x110/0x35c [ +0.000008] release_nodes+0xf0/0x16c [ +0.000008] devres_release_all+0xfc/0x180 [ +0.000008] device_unbind_cleanup+0x24/0x164 [ +0.000008] device_release_driver_internal+0x3e8/0x5b0 [ +0.000010] driver_detach+0xac/0x1b0 [ +0.000008] bus_remove_driver+0x158/0x29c [ +0.000008] driver_unregister+0x70/0xb0 [ +0.000009] platform_driver_unregister+0x20/0x2c [ +0.000007] 0xffff800003722d98 [ +0.000012] __do_sys_delete_module+0x288/0x400 [ +0.000009] __arm64_sys_delete_module+0x5c/0x80 [ +0.000008] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000008] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190
[ +0.000013] Last potentially related work creation: [ +0.000007] kasan_save_stack+0x2c/0x5c [ +0.000007] __kasan_record_aux_stack+0xb8/0xf0 [ +0.000009] kasan_record_aux_stack_noalloc+0x14/0x20 [ +0.000008] insert_work+0x54/0x290 [ +0.000009] __queue_work+0x48c/0xd24 [ +0.000008] queue_work_on+0x90/0x11c [ +0.000008] call_usermodehelper_exec+0x188/0x404 [ +0.000010] kobject_uevent_env+0x5a8/0x794 [ +0.000010] kobject_uevent+0x14/0x20 [ +0.000008] driver_register+0x230/0x3e4 [ +0.000009] __platform_driver_register+0x6c/0x94 [ +0.000007] gxbb_driver_init+0x28/0x34 [ +0.000010] do_one_initcall+0xc4/0x2b0 [ +0.000008] do_initcalls+0x20c/0x24c [ +0.000010] kernel_init_freeable+0x22c/0x278 [ +0.000009] kernel_init+0x3c/0x170 [ +0.000008] ret_from_fork+0x10/0x20
[ +0.000013] The buggy address belongs to the object at ffff000006731600
which belongs to the cache kmalloc-256 of size 256
[ +0.000009] The buggy address is located 136 bytes inside of
256-byte region [ffff000006731600, ffff000006731700)
[ +0.000015] The buggy address belongs to the physical page: [ +0.000008] page:fffffc000019cc00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff000006730a00 pfn:0x6730 [ +0.000011] head:fffffc000019cc00 order:2 compound_mapcount:0 compound_pincount:0 [ +0.000008] flags: 0xffff00000010200(slab|head|node=0|zone=0|lastcpupid=0xffff) [ +0.000016] raw: 0ffff00000010200 fffffc00000c3d08 fffffc0000ef2b08 ffff000000002680 [ +0.000009] raw: ffff000006730a00 0000000000150014 00000001ffffffff 0000000000000000 [ +0.000006] page dumped because: kasan: bad access detected
[ +0.000011] Memory state around the buggy address: [ +0.000007] ffff000006731580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ +0.000007] ffff000006731600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] >ffff000006731680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ^ [ +0.000006] ffff000006731700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ +0.000007] ffff000006731780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ +0.000006] ==================================================================
Fix by adding 'remove' driver callback for meson-drm, and explicitly deleting the aggregate device.
--- drivers/gpu/drm/meson/meson_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/meson/meson_drv.c +8 -0
@@ -493,6 +493,13 @@ static int meson_drv_probe(struct platform_device *pdev)return 0 ; }; +static int meson_drv_remove (struct platform_device *pdev) +{ +component_master_del (&pdev->dev, &meson_drv_master_ops); + +return 0 ; +} +static struct meson_drm_match_data meson_drm_gxbb_data = { .compat =VPU_COMPATIBLE_GXBB , };
@@ -530,6 +537,7 @@ static const struct dev_pm_ops meson_drv_pm_ops = {static struct platform_driver meson_drm_platform_driver = { .probe = meson_drv_probe, + .remove = meson_drv_remove, .shutdown = meson_drv_shutdown, .driver = { .name ="meson-drm" ,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 624/717 drm/meson: remove drm bridges at aggregate driver unbind time
In reply to Greg Kroah-HartmanFrom: Adrián Larumbe <[email protected]>
[ Upstream commit 09847723c12fc2753749cec3939a02ee92dac468 ]
drm bridges added by meson_encoder_hdmi_init and meson_encoder_cvbs_init were not manually removed at module unload time, which caused dangling references to freed memory to remain linked in the global bridge_list.
When loading the driver modules back in, the same functions would again call drm_bridge_add, and when traversing the global bridge_list, would end up peeking into freed memory.
Once again KASAN revealed the problem:
[ +0.000095] ============================================================= [ +0.000008] BUG: KASAN: use-after-free in __list_add_valid+0x9c/0x120 [ +0.000018] Read of size 8 at addr ffff00003da291f0 by task modprobe/2483
[ +0.000018] CPU: 3 PID: 2483 Comm: modprobe Tainted: G C O 5.19.0-rc6-lrmbkasan+ #1 [ +0.000011] Hardware name: Hardkernel ODROID-N2Plus (DT) [ +0.000008] Call trace: [ +0.000006] dump_backtrace+0x1ec/0x280 [ +0.000012] show_stack+0x24/0x80 [ +0.000008] dump_stack_lvl+0x98/0xd4 [ +0.000011] print_address_description.constprop.0+0x80/0x520 [ +0.000011] print_report+0x128/0x260 [ +0.000008] kasan_report+0xb8/0xfc [ +0.000008] __asan_report_load8_noabort+0x3c/0x50 [ +0.000009] __list_add_valid+0x9c/0x120 [ +0.000009] drm_bridge_add+0x6c/0x104 [drm] [ +0.000165] dw_hdmi_probe+0x1900/0x2360 [dw_hdmi] [ +0.000022] meson_dw_hdmi_bind+0x520/0x814 [meson_dw_hdmi] [ +0.000014] component_bind+0x174/0x520 [ +0.000012] component_bind_all+0x1a8/0x38c [ +0.000010] meson_drv_bind_master+0x5e8/0xb74 [meson_drm] [ +0.000032] meson_drv_bind+0x20/0x2c [meson_drm] [ +0.000027] try_to_bring_up_aggregate_device+0x19c/0x390 [ +0.000010] component_master_add_with_match+0x1c8/0x284 [ +0.000009] meson_drv_probe+0x274/0x280 [meson_drm] [ +0.000026] platform_probe+0xd0/0x220 [ +0.000009] really_probe+0x3ac/0xa80 [ +0.000009] __driver_probe_device+0x1f8/0x400 [ +0.000009] driver_probe_device+0x68/0x1b0 [ +0.000009] __driver_attach+0x20c/0x480 [ +0.000008] bus_for_each_dev+0x114/0x1b0 [ +0.000009] driver_attach+0x48/0x64 [ +0.000008] bus_add_driver+0x390/0x564 [ +0.000009] driver_register+0x1a8/0x3e4 [ +0.000009] __platform_driver_register+0x6c/0x94 [ +0.000008] meson_drm_platform_driver_init+0x3c/0x1000 [meson_drm] [ +0.000027] do_one_initcall+0xc4/0x2b0 [ +0.000011] do_init_module+0x154/0x570 [ +0.000011] load_module+0x1a78/0x1ea4 [ +0.000008] __do_sys_init_module+0x184/0x1cc [ +0.000009] __arm64_sys_init_module+0x78/0xb0 [ +0.000009] invoke_syscall+0x74/0x260 [ +0.000009] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000012] el0t_64_sync_handler+0x11c/0x150 [ +0.000008] el0t_64_sync+0x18c/0x190
[ +0.000016] Allocated by task 879: [ +0.000008] kasan_save_stack+0x2c/0x5c [ +0.000011] __kasan_kmalloc+0x90/0xd0 [ +0.000007] __kmalloc+0x278/0x4a0 [ +0.000011] mpi_resize+0x13c/0x1d0 [ +0.000011] mpi_powm+0xd24/0x1570 [ +0.000009] rsa_enc+0x1a4/0x30c [ +0.000009] pkcs1pad_verify+0x3f0/0x580 [ +0.000009] public_key_verify_signature+0x7a8/0xba4 [ +0.000010] public_key_verify_signature_2+0x40/0x60 [ +0.000008] verify_signature+0xb4/0x114 [ +0.000008] pkcs7_validate_trust_one.constprop.0+0x3b8/0x574 [ +0.000009] pkcs7_validate_trust+0xb8/0x15c [ +0.000008] verify_pkcs7_message_sig+0xec/0x1b0 [ +0.000012] verify_pkcs7_signature+0x78/0xac [ +0.000007] mod_verify_sig+0x110/0x190 [ +0.000009] module_sig_check+0x114/0x1e0 [ +0.000009] load_module+0xa0/0x1ea4 [ +0.000008] __do_sys_init_module+0x184/0x1cc [ +0.000008] __arm64_sys_init_module+0x78/0xb0 [ +0.000008] invoke_syscall+0x74/0x260 [ +0.000009] el0_svc_common.constprop.0+0x1a8/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000009] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190
[ +0.000013] Freed by task 2422: [ +0.000008] kasan_save_stack+0x2c/0x5c [ +0.000009] kasan_set_track+0x2c/0x40 [ +0.000007] kasan_set_free_info+0x28/0x50 [ +0.000009] ____kasan_slab_free+0x128/0x1d4 [ +0.000008] __kasan_slab_free+0x18/0x24 [ +0.000007] slab_free_freelist_hook+0x108/0x230 [ +0.000010] kfree+0x110/0x35c [ +0.000008] release_nodes+0xf0/0x16c [ +0.000009] devres_release_group+0x180/0x270 [ +0.000008] take_down_aggregate_device+0xcc/0x160 [ +0.000010] component_del+0x18c/0x360 [ +0.000009] meson_dw_hdmi_remove+0x28/0x40 [meson_dw_hdmi] [ +0.000013] platform_remove+0x64/0xb0 [ +0.000008] device_remove+0xb8/0x154 [ +0.000009] device_release_driver_internal+0x398/0x5b0 [ +0.000009] driver_detach+0xac/0x1b0 [ +0.000009] bus_remove_driver+0x158/0x29c [ +0.000008] driver_unregister+0x70/0xb0 [ +0.000009] platform_driver_unregister+0x20/0x2c [ +0.000007] meson_dw_hdmi_platform_driver_exit+0x1c/0x30 [meson_dw_hdmi] [ +0.000012] __do_sys_delete_module+0x288/0x400 [ +0.000009] __arm64_sys_delete_module+0x5c/0x80 [ +0.000009] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000008] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190
[ +0.000013] The buggy address belongs to the object at ffff00003da29000
which belongs to the cache kmalloc-1k of size 1024
[ +0.000008] The buggy address is located 496 bytes inside of
1024-byte region [ffff00003da29000, ffff00003da29400)
[ +0.000015] The buggy address belongs to the physical page: [ +0.000009] page:fffffc0000f68a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3da28 [ +0.000012] head:fffffc0000f68a00 order:3 compound_mapcount:0 compound_pincount:0 [ +0.000009] flags: 0xffff00000010200(slab|head|node=0|zone=0|lastcpupid=0xffff) [ +0.000019] raw: 0ffff00000010200 fffffc0000eb5c08 fffffc0000d96608 ffff000000002a80 [ +0.000008] raw: 0000000000000000 00000000000a000a 00000001ffffffff 0000000000000000 [ +0.000008] page dumped because: kasan: bad access detected
[ +0.000011] Memory state around the buggy address: [ +0.000009] ffff00003da29080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ffff00003da29100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] >ffff00003da29180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ^ [ +0.000008] ffff00003da29200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000006] ffff00003da29280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ==================================================================
Fix by keeping track of which encoders were initialised in the meson_drm structure and manually removing their bridges at aggregate driver's unbind time.
--- drivers/gpu/drm/meson/meson_drv.c | 4 ++++ drivers/gpu/drm/meson/meson_drv.h | 7 +++++++ drivers/gpu/drm/meson/meson_encoder_cvbs.c | 13 +++++++++++++ drivers/gpu/drm/meson/meson_encoder_cvbs.h | 1 + drivers/gpu/drm/meson/meson_encoder_hdmi.c | 13 +++++++++++++ drivers/gpu/drm/meson/meson_encoder_hdmi.h | 1 + 6 files changed, 39 insertions(+)
drivers/gpu/drm/meson/meson_drv.c +4 -0
@@ -390,6 +390,10 @@ static void meson_drv_unbind(struct device *dev)drm_atomic_helper_shutdown (drm);free_irq (priv->vsync_irq, drm);drm_dev_put (drm); + +meson_encoder_hdmi_remove (priv); +meson_encoder_cvbs_remove (priv); +component_unbind_all (dev, drm);if (priv->afbcd.ops)
drivers/gpu/drm/meson/meson_drv.h +7 -0
@@ -25,6 +25,12 @@ enum vpu_compatible { VPU_COMPATIBLE_G12A = 3, }; +enum { +MESON_ENC_CVBS =0 , +MESON_ENC_HDMI , +MESON_ENC_LAST , +}; +struct meson_drm_match_data {enum vpu_compatible compat;struct meson_afbcd_ops *afbcd_ops;
@@ -51,6 +57,7 @@ struct meson_drm {struct drm_crtc *crtc;struct drm_plane *primary_plane;struct drm_plane *overlay_plane; +void *encoders[MESON_ENC_LAST ];const struct meson_drm_soc_limits *limits;
drivers/gpu/drm/meson/meson_encoder_cvbs.c +13 -0
@@ -281,5 +281,18 @@ int meson_encoder_cvbs_init(struct meson_drm *priv) }drm_connector_attach_encoder (connector, &meson_encoder_cvbs->encoder); + priv->encoders[MESON_ENC_CVBS ] = meson_encoder_cvbs; +return 0 ; } + +void meson_encoder_cvbs_remove (struct meson_drm *priv) +{ +struct meson_encoder_cvbs *meson_encoder_cvbs; + +if (priv->encoders[MESON_ENC_CVBS ]) { + meson_encoder_cvbs = priv->encoders[MESON_ENC_CVBS ]; +drm_bridge_remove (&meson_encoder_cvbs->bridge); +drm_bridge_remove (meson_encoder_cvbs->next_bridge); + } +}
drivers/gpu/drm/meson/meson_encoder_cvbs.h +1 -0
@@ -25,5 +25,6 @@ struct meson_cvbs_mode {extern struct meson_cvbs_mode meson_cvbs_modes[MESON_CVBS_MODES_COUNT ];int meson_encoder_cvbs_init (struct meson_drm *priv); +void meson_encoder_cvbs_remove (struct meson_drm *priv);#endif /* __MESON_VENC_CVBS_H */
drivers/gpu/drm/meson/meson_encoder_hdmi.c +13 -0
@@ -446,6 +446,8 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) meson_encoder_hdmi->cec_notifier = notifier; } + priv->encoders[MESON_ENC_HDMI ] = meson_encoder_hdmi; +dev_dbg (priv->dev,"HDMI encoder initialized\n" );return 0 ;
@@ -454,3 +456,14 @@ int meson_encoder_hdmi_init(struct meson_drm *priv)of_node_put (remote);return ret; } + +void meson_encoder_hdmi_remove (struct meson_drm *priv) +{ +struct meson_encoder_hdmi *meson_encoder_hdmi; + +if (priv->encoders[MESON_ENC_HDMI ]) { + meson_encoder_hdmi = priv->encoders[MESON_ENC_HDMI ]; +drm_bridge_remove (&meson_encoder_hdmi->bridge); +drm_bridge_remove (meson_encoder_hdmi->next_bridge); + } +}
drivers/gpu/drm/meson/meson_encoder_hdmi.h +1 -0
@@ -8,5 +8,6 @@#define __MESON_ENCODER_HDMI_Hint meson_encoder_hdmi_init (struct meson_drm *priv); +void meson_encoder_hdmi_remove (struct meson_drm *priv);#endif /* __MESON_ENCODER_HDMI_H */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 648/717 ARM: 9234/1: stacktrace: Avoid duplicate saving of exception PC value
In reply to Greg Kroah-HartmanFrom: Li Huafei <[email protected]>
[ Upstream commit 752ec621ef5c30777958cc5eb5f1cf394f7733f4 ]
Because an exception stack frame is not created in the exception entry, save_trace() does special handling for the exception PC, but this is only needed when CONFIG_FRAME_POINTER_UNWIND=y. When CONFIG_ARM_UNWIND=y, unwind annotations have been added to the exception entry and save_trace() will repeatedly save the exception PC:
[0x7f000090] hrtimer_hander+0x8/0x10 [hrtimer]
[0x8019ec50] __hrtimer_run_queues+0x18c/0x394
[0x8019f760] hrtimer_run_queues+0xbc/0xd0
[0x8019def0] update_process_times+0x34/0x80
[0x801ad2a4] tick_periodic+0x48/0xd0
[0x801ad3dc] tick_handle_periodic+0x1c/0x7c
[0x8010f2e0] twd_handler+0x30/0x40
[0x80177620] handle_percpu_devid_irq+0xa0/0x23c
[0x801718d0] generic_handle_domain_irq+0x24/0x34
[0x80502d28] gic_handle_irq+0x74/0x88
[0x8085817c] generic_handle_arch_irq+0x58/0x78
[0x80100ba8] __irq_svc+0x88/0xc8
[0x80108114] arch_cpu_idle+0x38/0x3c
[0x80108114] arch_cpu_idle+0x38/0x3c <==== duplicate saved exception PC
[0x80861bf8] default_idle_call+0x38/0x130
[0x8015d5cc] do_idle+0x150/0x214
[0x8015d978] cpu_startup_entry+0x18/0x1c
[0x808589c0] rest_init+0xd8/0xdc
[0x80c00a44] arch_post_acpi_subsys_init+0x0/0x8We can move the special handling of the exception PC in save_trace() to the unwind_frame() of the frame pointer unwinder.
--- arch/arm/include/asm/stacktrace.h | 6 +++++ arch/arm/kernel/return_address.c | 1 + arch/arm/kernel/stacktrace.c | 44 +++++++++++++++++++++---------- 3 files changed, 37 insertions(+), 14 deletions(-)
arch/arm/include/asm/stacktrace.h +6 -0
@@ -21,6 +21,9 @@ struct stackframe {struct llist_node *kr_cur;struct task_struct *tsk;#endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER +bool ex_frame; +#endif }; static __always_inline
@@ -34,6 +37,9 @@ void arm_get_current_stackframe(struct pt_regs *regs, struct stackframe *frame) frame->kr_cur =NULL ; frame->tsk = current;#endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER + frame->ex_frame =in_entry_text (frame->pc); +#endif }extern int unwind_frame (struct stackframe *frame);
arch/arm/kernel/return_address.c +1 -0
@@ -47,6 +47,7 @@ void *return_address(unsigned int level) frame.kr_cur =NULL ; frame.tsk = current;#endif + frame.ex_frame = false;walk_stackframe (&frame, save_return_addr, &data);
arch/arm/kernel/stacktrace.c +30 -14
80 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 651/717 media: cx88: Fix a null-ptr-deref bug in buffer_prepare()
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 2b064d91440b33fba5b452f2d1b31f13ae911d71 ]
When the driver calls cx88_risc_buffer() to prepare the buffer, the function call may fail, resulting in a empty buffer and null-ptr-deref later in buffer_queue().
The following log can reveal it:
[ 41.822762] general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN PTI [ 41.824488] KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] [ 41.828027] RIP: 0010:buffer_queue+0xc2/0x500 [ 41.836311] Call Trace: [ 41.836945] __enqueue_in_driver+0x141/0x360 [ 41.837262] vb2_start_streaming+0x62/0x4a0 [ 41.838216] vb2_core_streamon+0x1da/0x2c0 [ 41.838516] __vb2_init_fileio+0x981/0xbc0 [ 41.839141] __vb2_perform_fileio+0xbf9/0x1120 [ 41.840072] vb2_fop_read+0x20e/0x400 [ 41.840346] v4l2_read+0x215/0x290 [ 41.840603] vfs_read+0x162/0x4c0
Fix this by checking the return value of cx88_risc_buffer()
[hverkuil: fix coding style issues]
--- drivers/media/pci/cx88/cx88-vbi.c | 9 +++--- drivers/media/pci/cx88/cx88-video.c | 43 +++++++++++++++-------------- 2 files changed, 26 insertions(+), 26 deletions(-)
drivers/media/pci/cx88/cx88-vbi.c +4 -5
@@ -144,11 +144,10 @@ static int buffer_prepare(struct vb2_buffer *vb)return -EINVAL ;vb2_set_plane_payload (vb,0 , size); -cx88_risc_buffer (dev->pci, &buf->risc, sgt->sgl, -0 ,VBI_LINE_LENGTH * lines, -VBI_LINE_LENGTH ,0 , - lines); -return 0 ; +return cx88_risc_buffer (dev->pci, &buf->risc, sgt->sgl, +0 ,VBI_LINE_LENGTH * lines, +VBI_LINE_LENGTH ,0 , + lines); }static void buffer_finish (struct vb2_buffer *vb)
drivers/media/pci/cx88/cx88-video.c +22 -21
70 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 599/717 drm: Use size_t type for len variable in drm_copy_field()
In reply to Greg Kroah-HartmanFrom: Javier Martinez Canillas <[email protected]>
[ Upstream commit 94dc3471d1b2b58b3728558d0e3f264e9ce6ff59 ]
The strlen() function returns a size_t which is an unsigned int on 32-bit arches and an unsigned long on 64-bit arches. But in the drm_copy_field() function, the strlen() return value is assigned to an 'int len' variable.
Later, the len variable is passed as copy_from_user() third argument that is an unsigned long parameter as well.
In theory, this can lead to an integer overflow via type conversion. Since the assignment happens to a signed int lvalue instead of a size_t lvalue.
In practice though, that's unlikely since the values copied are set by DRM drivers and not controlled by userspace. But using a size_t for len is the correct thing to do anyways.
--- drivers/gpu/drm/drm_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_ioctl.c +1 -1
@@ -472,7 +472,7 @@ EXPORT_SYMBOL(drm_invalid_op);*/ static int drm_copy_field (char __user *buf,size_t *buf_len,const char *value) { -int len; +size_t len;/* don't overflow userbuf */ len =strlen (value);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 626/717 drm/amd/display: Remove interface for periodic interrupt 1
In reply to Greg Kroah-HartmanFrom: Aric Cyr <[email protected]>
[ Upstream commit 97d8d6f075bd8f988589be02b91f6fa644d0b0b8 ]
[why]
Only a single VLINE interrupt is available so interface should not expose the second one which is used by DMU firmware.
[how]
Remove references to periodic_interrupt1 and VLINE1 from DC interfaces.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 16 +++------ drivers/gpu/drm/amd/display/dc/dc_stream.h | 6 ++-- .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 35 ++++++------------- .../amd/display/dc/dcn10/dcn10_hw_sequencer.h | 3 +- .../gpu/drm/amd/display/dc/inc/hw_sequencer.h | 8 +---- 5 files changed, 18 insertions(+), 50 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +4 -12
@@ -2632,11 +2632,8 @@ static void copy_stream_update_to_stream(struct dc *dc,if (update->abm_level) stream->abm_level = *update->abm_level; -if (update->periodic_interrupt0) - stream->periodic_interrupt0 = *update->periodic_interrupt0; - -if (update->periodic_interrupt1) - stream->periodic_interrupt1 = *update->periodic_interrupt1; +if (update->periodic_interrupt) + stream->periodic_interrupt = *update->periodic_interrupt;if (update->gamut_remap) stream->gamut_remap_matrix = *update->gamut_remap;
@@ -2723,13 +2720,8 @@ static void commit_planes_do_stream_update(struct dc *dc,if (!pipe_ctx->top_pipe && !pipe_ctx->prev_odm_pipe && pipe_ctx->stream == stream) { -if (stream_update->periodic_interrupt0 && - dc->hwss.setup_periodic_interrupt) - dc->hwss.setup_periodic_interrupt (dc, pipe_ctx,VLINE0 ); - -if (stream_update->periodic_interrupt1 && - dc->hwss.setup_periodic_interrupt) - dc->hwss.setup_periodic_interrupt (dc, pipe_ctx,VLINE1 ); +if (stream_update->periodic_interrupt && dc->hwss.setup_periodic_interrupt) + dc->hwss.setup_periodic_interrupt (dc, pipe_ctx); if ((stream_update->hdr_static_metadata && !stream->use_dynamic_meta) || stream_update->vrr_infopacket ||
drivers/gpu/drm/amd/display/dc/dc_stream.h +2 -4
@@ -200,8 +200,7 @@ struct dc_stream_state {/* DMCU info */ unsigned int abm_level; -struct periodic_interrupt_config periodic_interrupt0; -struct periodic_interrupt_config periodic_interrupt1; +struct periodic_interrupt_config periodic_interrupt;/* from core_stream struct */ struct dc_context *ctx;
@@ -268,8 +267,7 @@ struct dc_stream_update {struct dc_info_packet *hdr_static_metadata;unsigned int *abm_level; -struct periodic_interrupt_config *periodic_interrupt0; -struct periodic_interrupt_config *periodic_interrupt1; +struct periodic_interrupt_config *periodic_interrupt;struct dc_info_packet *vrr_infopacket;struct dc_info_packet *vsc_infopacket;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +10 -25
@@ -3623,7 +3623,7 @@ void dcn10_calc_vupdate_position( {const struct dc_crtc_timing *dc_crtc_timing = &pipe_ctx->stream->timing;int vline_int_offset_from_vupdate = - pipe_ctx->stream->periodic_interrupt0.lines_offset; + pipe_ctx->stream->periodic_interrupt.lines_offset;int vupdate_offset_from_vsync = dc->hwss.get_vupdate_offset_from_vsync (pipe_ctx);int start_position;
@@ -3648,18 +3648,10 @@ void dcn10_calc_vupdate_position(static void dcn10_cal_vline_position (struct dc *dc,struct pipe_ctx *pipe_ctx, -enum vline_select vline,uint32_t *start_line,uint32_t *end_line) { -enum vertical_interrupt_ref_point ref_point =INVALID_POINT ; - -if (vline ==VLINE0 ) - ref_point = pipe_ctx->stream->periodic_interrupt0.ref_point; -else if (vline ==VLINE1 ) - ref_point = pipe_ctx->stream->periodic_interrupt1.ref_point; - -switch (ref_point) { +switch (pipe_ctx->stream->periodic_interrupt.ref_point) {case START_V_UPDATE : dcn10_calc_vupdate_position( dc,
@@ -3668,7 +3660,9 @@ static void dcn10_cal_vline_position( end_line);break ;case START_V_SYNC : -// Suppose to do nothing because vsync is 0; +// vsync is line 0 so start_line is just the requested line offset + *start_line = pipe_ctx->stream->periodic_interrupt.lines_offset; + *end_line = *start_line +2 ;break ;default :ASSERT (0 );
@@ -3678,24 +3672,15 @@ static void dcn10_cal_vline_position(void dcn10_setup_periodic_interrupt (struct dc *dc, -struct pipe_ctx *pipe_ctx, -enum vline_select vline) +struct pipe_ctx *pipe_ctx) {struct timing_generator *tg = pipe_ctx->stream_res.tg; +uint32_t start_line =0 ; +uint32_t end_line =0 ; -if (vline ==VLINE0 ) { -uint32_t start_line =0 ; -uint32_t end_line =0 ; +dcn10_cal_vline_position (dc, pipe_ctx, &start_line, &end_line); -dcn10_cal_vline_position (dc, pipe_ctx, vline, &start_line, &end_line); - - tg->funcs->setup_vertical_interrupt0 (tg, start_line, end_line); - - }else if (vline ==VLINE1 ) { - pipe_ctx->stream_res.tg->funcs->setup_vertical_interrupt1 ( - tg, - pipe_ctx->stream->periodic_interrupt1.lines_offset); - } + tg->funcs->setup_vertical_interrupt0 (tg, start_line, end_line); }void dcn10_setup_vupdate_interrupt (struct dc *dc,struct pipe_ctx *pipe_ctx)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h +1 -2
@@ -175,8 +175,7 @@ void dcn10_set_cursor_attribute(struct pipe_ctx *pipe_ctx);void dcn10_set_cursor_sdr_white_level (struct pipe_ctx *pipe_ctx);void dcn10_setup_periodic_interrupt (struct dc *dc, -struct pipe_ctx *pipe_ctx, -enum vline_select vline); +struct pipe_ctx *pipe_ctx); enum dc_status dcn10_set_clock(struct dc *dc, enum dc_clock_type clock_type, uint32_t clk_khz,
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +1 -7
@@ -32,11 +32,6 @@#include "inc/hw/link_encoder.h" #include "core_status.h" -enum vline_select { -VLINE0 , -VLINE1 -}; -struct pipe_ctx ;struct dc_state ;struct dc_stream_status ;
@@ -116,8 +111,7 @@ struct hw_sequencer_funcs { int group_index, int group_size, struct pipe_ctx *grouped_pipes[]);void (*setup_periodic_interrupt)(struct dc *dc, -struct pipe_ctx *pipe_ctx, -enum vline_select vline); +struct pipe_ctx *pipe_ctx);void (*set_drr)(struct pipe_ctx **pipe_ctx,int num_pipes,struct dc_crtc_timing_adjust adjust); void (*set_static_screen_control)(struct pipe_ctx **pipe_ctx,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 409/717 misc: ocxl: fix possible refcount leak in afu_ioctl()
In reply to Greg Kroah-HartmanFrom: Hangyu Hua <[email protected]>
[ Upstream commit c3b69ba5114c860d730870c03ab4ee45276e5e35 ]
eventfd_ctx_put need to be called to put the refcount that gotten by eventfd_ctx_fdget when ocxl_irq_set_handler fails.
--- drivers/misc/ocxl/file.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/misc/ocxl/file.c +2 -0
@@ -257,6 +257,8 @@ static long afu_ioctl(struct file *file, unsigned int cmd,if (IS_ERR (ev_ctx))return PTR_ERR (ev_ctx); rc =ocxl_irq_set_handler (ctx, irq_id, irq_handler, irq_free, ev_ctx); +if (rc) +eventfd_ctx_put (ev_ctx);break ;case OCXL_IOCTL_GET_METADATA :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 629/717 ARM: dts: imx6: delete interrupts property if interrupts-extended is set
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit c9d38ff7080b2c4fa6786b82210fa13115895aae ]
In most cases this is related to fsl,err006687-workaround-present, which requires a GPIO interrupt next a GIC interrupt.
This fixes the dtbs_check warning:
imx6dl-mba6a.dtb: ethernet@2188000: More than one condition true in oneOf schema:
{'$filename': 'Documentation/devicetree/bindings/net/fsl,fec.yaml',
[...]
--- arch/arm/boot/dts/imx6dl-riotboard.dts | 1 + arch/arm/boot/dts/imx6q-arm2.dts | 1 + arch/arm/boot/dts/imx6q-evi.dts | 1 + arch/arm/boot/dts/imx6q-mccmon6.dts | 1 + arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi | 1 + arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi | 1 + arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi | 1 + arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi | 1 + arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 1 + arch/arm/boot/dts/imx6qdl-tqma6a.dtsi | 1 + arch/arm/boot/dts/imx6qdl-ts7970.dtsi | 1 + 11 files changed, 11 insertions(+)
arch/arm/boot/dts/imx6dl-riotboard.dts +1 -0
@@ -90,6 +90,7 @@ pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii-id"; phy-handle = <&rgmii_phy>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
arch/arm/boot/dts/imx6q-arm2.dts +1 -0
@@ -178,6 +178,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
arch/arm/boot/dts/imx6q-evi.dts +1 -0
@@ -146,6 +146,7 @@ pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
arch/arm/boot/dts/imx6q-mccmon6.dts +1 -0
@@ -100,6 +100,7 @@ pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; status = "okay";
arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi +1 -0
@@ -192,6 +192,7 @@ phy-mode = "rgmii"; phy-handle = <ðphy>; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi +1 -0
@@ -334,6 +334,7 @@ phy-mode = "rgmii"; phy-handle = <ðphy>; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi +1 -0
@@ -263,6 +263,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi +1 -0
@@ -267,6 +267,7 @@ phy-mode = "rgmii"; phy-handle = <ðphy>; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +1 -0
@@ -295,6 +295,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii-id"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
arch/arm/boot/dts/imx6qdl-tqma6a.dtsi +1 -0
@@ -7,6 +7,7 @@ #include <dt-bindings/gpio/gpio.h> &fec { + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
arch/arm/boot/dts/imx6qdl-ts7970.dtsi +1 -0
@@ -192,6 +192,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 638/717 ARM: dts: imx6sx-udoo-neo: dont use multiple blank lines
In reply to Greg Kroah-HartmanFrom: Marcel Ziswiler <[email protected]>
[ Upstream commit fd2dd7077c7498765e7326c1b7f34bde85f1a975 ]
This fixes the following warning:
arch/arm/boot/dts/imx6sx-udoo-neo.dtsi:309: check: Please don't use multiple blank lines
While at it, use tabs indent for some pinctrl entries.
--- arch/arm/boot/dts/imx6sx-udoo-neo.dtsi | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
arch/arm/boot/dts/imx6sx-udoo-neo.dtsi +6 -8
@@ -226,7 +226,7 @@ &iomuxc { pinctrl_bt_reg: btreggrp { fsl,pins = - <MX6SX_PAD_KEY_ROW2__GPIO2_IO_17 0x15059>; + <MX6SX_PAD_KEY_ROW2__GPIO2_IO_17 0x15059>; }; pinctrl_enet1: enet1grp {
@@ -306,7 +306,6 @@ >; }; - pinctrl_uart1: uart1grp { fsl,pins = <MX6SX_PAD_GPIO1_IO04__UART1_DCE_TX 0x1b0b1>,
@@ -347,24 +346,23 @@ pinctrl_otg1_reg: otg1grp { fsl,pins = - <MX6SX_PAD_GPIO1_IO09__GPIO1_IO_9 0x10b0>; + <MX6SX_PAD_GPIO1_IO09__GPIO1_IO_9 0x10b0>; }; - pinctrl_otg2_reg: otg2grp { fsl,pins = - <MX6SX_PAD_NAND_RE_B__GPIO4_IO_12 0x10b0>; + <MX6SX_PAD_NAND_RE_B__GPIO4_IO_12 0x10b0>; }; pinctrl_usb_otg1: usbotg1grp { fsl,pins = - <MX6SX_PAD_GPIO1_IO10__ANATOP_OTG1_ID 0x17059>, - <MX6SX_PAD_GPIO1_IO08__USB_OTG1_OC 0x10b0>; + <MX6SX_PAD_GPIO1_IO10__ANATOP_OTG1_ID 0x17059>, + <MX6SX_PAD_GPIO1_IO08__USB_OTG1_OC 0x10b0>; }; pinctrl_usb_otg2: usbot2ggrp { fsl,pins = - <MX6SX_PAD_QSPI1A_DATA0__USB_OTG2_OC 0x10b0>; + <MX6SX_PAD_QSPI1A_DATA0__USB_OTG2_OC 0x10b0>; }; pinctrl_usdhc2: usdhc2grp {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 666/717 ata: libahci_platform: Sanity check the DT child nodes number
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 3c132ea6508b34956e5ed88d04936983ec230601 ]
Having greater than AHCI_MAX_PORTS (32) ports detected isn't that critical from the further AHCI-platform initialization point of view since exceeding the ports upper limit will cause allocating more resources than will be used afterwards. But detecting too many child DT-nodes doesn't seem right since it's very unlikely to have it on an ordinary platform. In accordance with the AHCI specification there can't be more than 32 ports implemented at least due to having the CAP.NP field of 5 bits wide and the PI register of dword size. Thus if such situation is found the DTB must have been corrupted and the data read from it shouldn't be reliable. Let's consider that as an erroneous situation and halt further resources allocation.
Note it's logically more correct to have the nports set only after the initialization value is checked for being sane. So while at it let's make sure nports is assigned with a correct value.
--- drivers/ata/libahci_platform.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/ata/libahci_platform.c +12 -2
@@ -451,14 +451,24 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev, } } - hpriv->nports = child_nodes =of_get_child_count (dev->of_node); +/* +* Too many sub-nodes most likely means having something wrong with +* the firmware. +*/ + child_nodes =of_get_child_count (dev->of_node); +if (child_nodes >AHCI_MAX_PORTS ) { + rc = -EINVAL ; + goto err_out; + }/* * If no sub-node was found, we still need to set nports to * one in order to be able to use the * ahci_platform_[en|dis]able_[phys|regulators] functions. */ -if (!child_nodes) +if (child_nodes) + hpriv->nports = child_nodes; +else hpriv->nports =1 ; hpriv->phys =devm_kcalloc (dev, hpriv->nports,sizeof (*hpriv->phys),GFP_KERNEL );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 635/717 ARM: dts: imx6sll: add missing properties for sram
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit 7492a83ed9b7a151e2dd11d64b06da7a7f0fa7f9 ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6sll.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/imx6sll.dtsi +3 -0
@@ -115,6 +115,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; }; intc: interrupt-controller@a01000 {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 622/717 drm/meson: reorder driver deinit sequence to fix use-after-free bug
In reply to Greg Kroah-HartmanFrom: Adrián Larumbe <[email protected]>
[ Upstream commit 31c519981eb141c7ec39bfd5be25d35f02edb868 ]
Unloading the driver triggers the following KASAN warning:
[ +0.006275] ============================================================= [ +0.000029] BUG: KASAN: use-after-free in __list_del_entry_valid+0xe0/0x1a0 [ +0.000026] Read of size 8 at addr ffff000020c395e0 by task rmmod/2695
[ +0.000019] CPU: 5 PID: 2695 Comm: rmmod Tainted: G C O 5.19.0-rc6-lrmbkasan+ #1 [ +0.000013] Hardware name: Hardkernel ODROID-N2Plus (DT) [ +0.000008] Call trace: [ +0.000007] dump_backtrace+0x1ec/0x280 [ +0.000013] show_stack+0x24/0x80 [ +0.000008] dump_stack_lvl+0x98/0xd4 [ +0.000011] print_address_description.constprop.0+0x80/0x520 [ +0.000011] print_report+0x128/0x260 [ +0.000007] kasan_report+0xb8/0xfc [ +0.000008] __asan_report_load8_noabort+0x3c/0x50 [ +0.000010] __list_del_entry_valid+0xe0/0x1a0 [ +0.000009] drm_atomic_private_obj_fini+0x30/0x200 [drm] [ +0.000172] drm_bridge_detach+0x94/0x260 [drm] [ +0.000145] drm_encoder_cleanup+0xa4/0x290 [drm] [ +0.000144] drm_mode_config_cleanup+0x118/0x740 [drm] [ +0.000143] drm_mode_config_init_release+0x1c/0x2c [drm] [ +0.000144] drm_managed_release+0x170/0x414 [drm] [ +0.000142] drm_dev_put.part.0+0xc0/0x124 [drm] [ +0.000143] drm_dev_put+0x20/0x30 [drm] [ +0.000142] meson_drv_unbind+0x1d8/0x2ac [meson_drm] [ +0.000028] take_down_aggregate_device+0xb0/0x160 [ +0.000016] component_del+0x18c/0x360 [ +0.000009] meson_dw_hdmi_remove+0x28/0x40 [meson_dw_hdmi] [ +0.000015] platform_remove+0x64/0xb0 [ +0.000009] device_remove+0xb8/0x154 [ +0.000009] device_release_driver_internal+0x398/0x5b0 [ +0.000009] driver_detach+0xac/0x1b0 [ +0.000009] bus_remove_driver+0x158/0x29c [ +0.000009] driver_unregister+0x70/0xb0 [ +0.000008] platform_driver_unregister+0x20/0x2c [ +0.000008] meson_dw_hdmi_platform_driver_exit+0x1c/0x30 [meson_dw_hdmi] [ +0.000012] __do_sys_delete_module+0x288/0x400 [ +0.000011] __arm64_sys_delete_module+0x5c/0x80 [ +0.000009] invoke_syscall+0x74/0x260 [ +0.000009] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000009] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000012] el0t_64_sync_handler+0x11c/0x150 [ +0.000008] el0t_64_sync+0x18c/0x190
[ +0.000018] Allocated by task 0:
[ +0.000007] (stack is not available)
[ +0.000011] Freed by task 2695: [ +0.000008] kasan_save_stack+0x2c/0x5c [ +0.000011] kasan_set_track+0x2c/0x40 [ +0.000008] kasan_set_free_info+0x28/0x50 [ +0.000009] ____kasan_slab_free+0x128/0x1d4 [ +0.000008] __kasan_slab_free+0x18/0x24 [ +0.000007] slab_free_freelist_hook+0x108/0x230 [ +0.000011] kfree+0x110/0x35c [ +0.000008] release_nodes+0xf0/0x16c [ +0.000009] devres_release_group+0x180/0x270 [ +0.000008] component_unbind+0x128/0x1e0 [ +0.000010] component_unbind_all+0x1b8/0x264 [ +0.000009] meson_drv_unbind+0x1a0/0x2ac [meson_drm] [ +0.000025] take_down_aggregate_device+0xb0/0x160 [ +0.000009] component_del+0x18c/0x360 [ +0.000009] meson_dw_hdmi_remove+0x28/0x40 [meson_dw_hdmi] [ +0.000012] platform_remove+0x64/0xb0 [ +0.000008] device_remove+0xb8/0x154 [ +0.000009] device_release_driver_internal+0x398/0x5b0 [ +0.000009] driver_detach+0xac/0x1b0 [ +0.000009] bus_remove_driver+0x158/0x29c [ +0.000008] driver_unregister+0x70/0xb0 [ +0.000008] platform_driver_unregister+0x20/0x2c [ +0.000008] meson_dw_hdmi_platform_driver_exit+0x1c/0x30 [meson_dw_hdmi] [ +0.000011] __do_sys_delete_module+0x288/0x400 [ +0.000010] __arm64_sys_delete_module+0x5c/0x80 [ +0.000008] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000009] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190
[ +0.000014] The buggy address belongs to the object at ffff000020c39000
which belongs to the cache kmalloc-4k of size 4096
[ +0.000008] The buggy address is located 1504 bytes inside of
4096-byte region [ffff000020c39000, ffff000020c3a000)
[ +0.000016] The buggy address belongs to the physical page: [ +0.000009] page:fffffc0000830e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x20c38 [ +0.000013] head:fffffc0000830e00 order:3 compound_mapcount:0 compound_pincount:0 [ +0.000008] flags: 0xffff00000010200(slab|head|node=0|zone=0|lastcpupid=0xffff) [ +0.000019] raw: 0ffff00000010200 fffffc0000fd4808 fffffc0000126208 ffff000000002e80 [ +0.000009] raw: 0000000000000000 0000000000020002 00000001ffffffff 0000000000000000 [ +0.000008] page dumped because: kasan: bad access detected
[ +0.000011] Memory state around the buggy address: [ +0.000008] ffff000020c39480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ffff000020c39500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] >ffff000020c39580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ^ [ +0.000007] ffff000020c39600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ffff000020c39680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000006] ==================================================================
The reason this is happening is unloading meson-dw-hdmi will cause the component API to take down the aggregate device, which in turn will cause all devres-managed memory to be freed, including the struct dw_hdmi allocated in dw_hdmi_probe. This struct embeds a struct drm_bridge that is added at the end of the function, and which is later on picked up in meson_encoder_hdmi_init.
However, when attaching the bridge to the encoder created in meson_encoder_hdmi_init, it's linked to the encoder's bridge chain, from where it never leaves, even after devres_release_group is called when the driver's components are unbound and the embedding structure freed.
Then, when calling drm_dev_put in the aggregate driver's unbind function, drm_bridge_detach is called for every single bridge linked to the encoder, including the one whose memory had already been deallocated.
Fix by calling component_unbind_all after drm_dev_put.
--- drivers/gpu/drm/meson/meson_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/meson/meson_drv.c +1 -1
@@ -388,9 +388,9 @@ static void meson_drv_unbind(struct device *dev)drm_dev_unregister (drm);drm_kms_helper_poll_fini (drm);drm_atomic_helper_shutdown (drm); -component_unbind_all (dev, drm);free_irq (priv->vsync_irq, drm);drm_dev_put (drm); +component_unbind_all (dev, drm);if (priv->afbcd.ops) priv->afbcd.ops->exit (priv);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 535/717 ACPI: APEI: do not add task_work to kernel thread to avoid memory leak
In reply to Greg Kroah-HartmanFrom: Shuai Xue <[email protected]>
[ Upstream commit 415fed694fe11395df56e05022d6e7cee1d39dd3 ]
If an error is detected as a result of user-space process accessing a corrupt memory location, the CPU may take an abort. Then the platform firmware reports kernel via NMI like notifications, e.g. NOTIFY_SEA, NOTIFY_SOFTWARE_DELEGATED, etc.
For NMI like notifications, commit 7f17b4a121d0 ("ACPI: APEI: Kick the memory_failure() queue for synchronous errors") keep track of whether memory_failure() work was queued, and make task_work pending to flush out the queue so that the work is processed before return to user-space.
The code use init_mm to check whether the error occurs in user space:
if (current->mm != &init_mm)
The condition is always true, becase _nobody_ ever has "init_mm" as a real VM any more.
In addition to abort, errors can also be signaled as asynchronous exceptions, such as interrupt and SError. In such case, the interrupted current process could be any kind of thread. When a kernel thread is interrupted, the work ghes_kick_task_work deferred to task_work will never be processed because entry_handler returns to call ret_to_kernel() instead of ret_to_user(). Consequently, the estatus_node alloced from ghes_estatus_pool in ghes_in_nmi_queue_one_entry() will not be freed. After around 200 allocations in our platform, the ghes_estatus_pool will run of memory and ghes_in_nmi_queue_one_entry() returns ENOMEM. As a result, the event failed to be processed.
sdei: event 805 on CPU 113 failed with error: -2
Finally, a lot of unhandled events may cause platform firmware to exceed some threshold and reboot.
The condition should generally just do
if (current->mm)
as described in active_mm.rst documentation.
Then if an asynchronous error is detected when a kernel thread is running, (e.g. when detected by a background scrubber), do not add task_work to it as the original patch intends to do.
--- drivers/acpi/apei/ghes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/apei/ghes.c +1 -1
@@ -985,7 +985,7 @@ static void ghes_proc_in_irq(struct irq_work *irq_work)ghes_estatus_cache_add (generic, estatus); } -if (task_work_pending && current->mm != &init_mm) { +if (task_work_pending && current->mm) { estatus_node->task_work.func = ghes_kick_task_work; estatus_node->task_work_cpu =smp_processor_id (); ret = task_work_add(current, &estatus_node->task_work,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 419/717 dyndbg: let query-modname override actual module name
In reply to Greg Kroah-HartmanFrom: Jim Cromie <[email protected]>
[ Upstream commit e75ef56f74965f426dd819a41336b640ffdd8fbc ]
dyndbg's control-parser: ddebug_parse_query(), requires that search
terms: module, func, file, lineno, are used only once in a query; a thing cannot be named both foo and bar.
The cited commit added an overriding module modname, taken from the module loader, which is authoritative. So it set query.module 1st, which disallowed its use in the query-string.
But now, its useful to allow a module-load to enable classes across a whole (or part of) a subsystem at once.
# enable (dynamic-debug in) drm only modprobe drm dyndbg="class DRM_UT_CORE +p"
# get drm_helper too modprobe drm dyndbg="class DRM_UT_CORE module drm* +p"
# get everything that knows DRM_UT_CORE modprobe drm dyndbg="class DRM_UT_CORE module * +p"
# also for boot-args: drm.dyndbg="class DRM_UT_CORE module * +p"
So convert the override into a default, by filling it only when/after the query-string omitted the module.
NB: the query class FOO handling is forthcoming.
--- lib/dynamic_debug.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
lib/dynamic_debug.c +7 -4
@@ -384,10 +384,6 @@ static int ddebug_parse_query(char *words[], int nwords,return -EINVAL ; } -if (modname) -/* support $modname.dyndbg=<multiple queries> */ - query->module = modname; -for (i =0 ; i < nwords; i +=2 ) {char *keyword = words[i];char *arg = words[i+1 ];
@@ -428,6 +424,13 @@ static int ddebug_parse_query(char *words[], int nwords,if (rc)return rc; } +if (!query->module && modname) +/* +* support $modname.dyndbg=<multiple queries>, when +* not given in the query itself +*/ + query->module = modname; +vpr_info_dq (query,"parsed" );return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 427/717 mtd: rawnand: intel: Remove undocumented compatible string
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 68c02ebaa34d41063ccbbc789a352537ddc3cd8a ]
The "intel,nand-controller" compatible string is not part of the dt-bindings. Remove it from the driver as it's not supposed to be used without any documentation for it.
--- drivers/mtd/nand/raw/intel-nand-controller.c | 1 - 1 file changed, 1 deletion(-)
drivers/mtd/nand/raw/intel-nand-controller.c +0 -1
@@ -723,7 +723,6 @@ static int ebu_nand_remove(struct platform_device *pdev) }static const struct of_device_id ebu_nand_match[] = { - { .compatible ="intel,nand-controller" }, { .compatible ="intel,lgm-ebunand" }, {} };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 609/717 ALSA: usb-audio: Register card at the last interface
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 6392dcd1d0c7034ccf630ec55fc9e5810ecadf3b ]
The USB-audio driver matches per interface, and as default, it registers the card instance at the very first instance. This can be a problem for the devices that have multiple interfaces to be probed, as the udev rule isn't applied properly for the later appearing interfaces. Although we introduced the delayed_register option and the quirks for covering those shortcomings, it's nothing but a workaround for specific devices.
This patch is an another attempt to fix the problem in a more generic way. Now the driver checks the whole USB device descriptor at the very first time when an interface is attached to a sound card. It looks at each matching interface in the descriptor and remembers the last matching one. The snd_card_register() is invoked only when this last interface is probed.
After this change, the quirks for the delayed registration become superfluous, hence they are removed along with the patch. OTOH, the delayed_register option is still kept, as it might be useful for some corner cases (e.g. a special driver overtakes the interface probe from the standard driver, and the last interface probe may miss).
--- sound/usb/card.c | 32 +++++++++++++++++++++++++------- sound/usb/quirks.c | 42 ------------------------------------------ sound/usb/quirks.h | 2 -- sound/usb/usbaudio.h | 1 + 4 files changed, 26 insertions(+), 51 deletions(-)
sound/usb/card.c +25 -7
@@ -690,7 +690,7 @@ static bool get_alias_id(struct usb_devireturn false; } -static bool check_delayed_register_option (struct snd_usb_audio *chip,int iface) +static int check_delayed_register_option (struct snd_usb_audio *chip) {int i;unsigned int id, inum;
@@ -699,14 +699,31 @@ static bool check_delayed_register_optioif (delayed_register[i] &&sscanf (delayed_register[i],"%x:%x" , &id, &inum) ==2 && id == chip->usb_id) -return iface < inum; +return inum; } -return false; +return -1 ; }static const struct usb_device_id usb_audio_ids[];/* defined below */ +/* look for the last interface that matches with our ids and remember it */ +static void find_last_interface (struct snd_usb_audio *chip) +{ +struct usb_host_config *config = chip->dev->actconfig; +struct usb_interface *intf; +int i; + +if (!config) +return ; +for (i =0 ; i < config->desc.bNumInterfaces; i++) { + intf = config->interface[i]; +if (usb_match_id (intf, usb_audio_ids)) + chip->last_iface = intf->altsetting[0 ].desc.bInterfaceNumber; + } +usb_audio_dbg (chip,"Found last interface = %d\n" , chip->last_iface); +} +/* look for the corresponding quirk */ static const struct snd_usb_audio_quirk *get_alias_quirk (struct usb_device *dev,unsigned int id)
@@ -813,6 +830,7 @@ static int usb_audio_probe(struct usb_in err = -ENODEV ; goto __error; } +find_last_interface (chip); }if (chip->num_interfaces >=MAX_CARD_INTERFACES ) {
@@ -862,11 +880,11 @@ static int usb_audio_probe(struct usb_in chip->need_delayed_register = false;/* clear again */ } -/* we are allowed to call snd_card_register() many times, but first -* check to see if a device needs to skip it or do anything special +/* register card if we reach to the last interface or to the specified +* one given via option */ -if (!snd_usb_registration_quirk (chip, ifnum) && - !check_delayed_register_option (chip, ifnum)) { +if (check_delayed_register_option (chip) == ifnum || + chip->last_iface == ifnum) { err =snd_card_register (chip->card);if (err <0 ) goto __error;
sound/usb/quirks.c +0 -42
48 lines not on this page · raw message
sound/usb/quirks.h +0 -2
@@ -48,8 +48,6 @@ void snd_usb_audioformat_attributes_quirstruct audioformat *fp, int stream); -bool snd_usb_registration_quirk (struct snd_usb_audio *chip,int iface); -void snd_usb_init_quirk_flags (struct snd_usb_audio *chip);#endif /* __USBAUDIO_QUIRKS_H */
sound/usb/usbaudio.h +1 -0
@@ -37,6 +37,7 @@ struct snd_usb_audio {unsigned int quirk_flags; unsigned int need_delayed_register:1; /* warn for delayed registration */int num_interfaces; +int last_iface;int num_suspended_intf;int sample_rate_read_error;
Greg Kroah-Hartman
maintainerPATCH 641/717 arm64: dts: imx8mq-librem5: Add bq25895 as max17055s power supply
In reply to Greg Kroah-HartmanFrom: Sebastian Krzyszkowiak <[email protected]>
[ Upstream commit 6effe295e1a87408033c29dbcea9d5a5c8b937d5 ]
This allows the userspace to notice that there's not enough current provided to charge the battery, and also fixes issues with 0% SOC values being considered invalid.
--- arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi +1 -0
@@ -1077,6 +1077,7 @@ interrupts = <20 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_gauge>; + power-supplies = <&bq25895>; maxim,over-heat-temp = <700>; maxim,over-volt = <4500>; maxim,rsns-microohm = <5000>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 643/717 btrfs: scrub: properly report super block errors in system log
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
[ Upstream commit e69bf81c9a339f1b2c041b112a6fbb9f60fc9340 ]
[PROBLEM]
Unlike data/metadata corruption, if scrub detected some error in the super block, the only error message is from the updated device status:
BTRFS info (device dm-1): scrub: started on devid 2
BTRFS error (device dm-1): bdev /dev/mapper/test-scratch2 errs: wr 0, rd 0, flush 0, corrupt 1, gen 0 BTRFS info (device dm-1): scrub: finished on devid 2 with status: 0
This is not helpful at all.
[CAUSE]
Unlike data/metadata error reporting, there is no visible report in kernel dmesg to report supper block errors.
In fact, return value of scrub_checksum_super() is intentionally skipped, thus scrub_handle_errored_block() will never be called for super blocks.
[FIX]
Make super block errors to output an error message, now the full dmesg would looks like this:
BTRFS info (device dm-1): scrub: started on devid 2
BTRFS warning (device dm-1): super block error on device /dev/mapper/test-scratch2, physical 67108864 BTRFS error (device dm-1): bdev /dev/mapper/test-scratch2 errs: wr 0, rd 0, flush 0, corrupt 1, gen 0 BTRFS info (device dm-1): scrub: finished on devid 2 with status: 0
BTRFS info (device dm-1): scrub: started on devid 2
This fix involves:
- Move the super_errors reporting to scrub_handle_errored_block() This allows the device status message to show after the super block error message.
But now we no longer distinguish super block corruption and generation mismatch, now all counted as corruption.
- Properly check the return value from scrub_checksum_super()
- Add extra super block error reporting for scrub_print_warning().
--- fs/btrfs/scrub.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-)
fs/btrfs/scrub.c +12 -21
@@ -731,6 +731,13 @@ static void scrub_print_warning(const char *errstr, struct scrub_block *sblock) dev = sblock->sectors[0 ]->dev; fs_info = sblock->sctx->fs_info; +/* Super block error, no need to search extent tree. */ +if (sblock->sectors[0 ]->flags &BTRFS_EXTENT_FLAG_SUPER ) { +btrfs_warn_in_rcu (fs_info,"%s on device %s, physical %llu" , + errstr,rcu_str_deref (dev->name), + sblock->sectors[0 ]->physical); +return ; + } path =btrfs_alloc_path ();if (!path)return ;
@@ -806,7 +813,7 @@ static inline void scrub_put_recover(struct btrfs_fs_info *fs_info,static int scrub_handle_errored_block (struct scrub_block *sblock_to_check) {struct scrub_ctx *sctx = sblock_to_check->sctx; -struct btrfs_device *dev; +struct btrfs_device *dev = sblock_to_check->sectors[0 ]->dev;struct btrfs_fs_info *fs_info;u64 logical;unsigned int failed_mirror_index;
@@ -827,13 +834,15 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check) fs_info = sctx->fs_info;if (sblock_to_check->sectors[0 ]->flags &BTRFS_EXTENT_FLAG_SUPER ) {/* -* if we find an error in a super block, we just report it. +* If we find an error in a super block, we just report it. * They will get written with the next transaction commit * anyway */ +scrub_print_warning ("super block error" , sblock_to_check);spin_lock (&sctx->stat_lock); ++sctx->stat.super_errors;spin_unlock (&sctx->stat_lock); +btrfs_dev_stat_inc_and_print (dev,BTRFS_DEV_STAT_CORRUPTION_ERRS );return 0 ; } logical = sblock_to_check->sectors[0 ]->logical;
@@ -842,7 +851,6 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check) is_metadata = !(sblock_to_check->sectors[0 ]->flags &BTRFS_EXTENT_FLAG_DATA ); have_csum = sblock_to_check->sectors[0 ]->have_csum; - dev = sblock_to_check->sectors[0 ]->dev;if (!sctx->is_dev_replace &&btrfs_repair_one_zone (fs_info, logical))return 0 ;
@@ -1773,7 +1781,7 @@ static int scrub_checksum(struct scrub_block *sblock)else if (flags &BTRFS_EXTENT_FLAG_TREE_BLOCK ) ret =scrub_checksum_tree_block (sblock);else if (flags &BTRFS_EXTENT_FLAG_SUPER ) - (void )scrub_checksum_super (sblock); + ret =scrub_checksum_super (sblock);else WARN_ON (1 );if (ret)
@@ -1912,23 +1920,6 @@ static int scrub_checksum_super(struct scrub_block *sblock)if (memcmp (calculated_csum, s->csum, sctx->fs_info->csum_size)) ++fail_cor; -if (fail_cor + fail_gen) { -/* -* if we find an error in a super block, we just report it. -* They will get written with the next transaction commit -* anyway -*/ -spin_lock (&sctx->stat_lock); - ++sctx->stat.super_errors; -spin_unlock (&sctx->stat_lock); -if (fail_cor) -btrfs_dev_stat_inc_and_print (sector->dev, -BTRFS_DEV_STAT_CORRUPTION_ERRS ); -else -btrfs_dev_stat_inc_and_print (sector->dev, -BTRFS_DEV_STAT_GENERATION_ERRS ); - } -return fail_cor + fail_gen; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 625/717 drm/dp: Dont rewrite link config when setting phy test pattern
In reply to Greg Kroah-HartmanFrom: Khaled Almahallawy <[email protected]>
[ Upstream commit 7b4d8db657192066bc6f1f6635d348413dac1e18 ]
The sequence for Source DP PHY CTS automation is [2][1]:
1- Emulate successful Link Training(LT)
2- Short HPD and change link rates and number of lanes by LT. (This is same flow for Link Layer CTS)
3- Short HPD and change PHY test pattern and swing/pre-emphasis levels (This step should not trigger LT)
The problem is with DP PHY compliance setup as follow:
[DPTX + on board LTTPR]------Main Link--->[Scope]
^ |
| |
| |
----------Aux Ch------>[Aux Emulator]At step 3, before writing TRAINING_LANEx_SET/LINK_QUAL_PATTERN_SET to declare the pattern/swing requested by scope, we write link config in LINK_BW_SET/LANE_COUNT_SET on a port that has LTTPR. As LTTPR snoops aux transaction, LINK_BW_SET/LANE_COUNT_SET writes indicate a LT will start [Check DP 2.0 E11 -Sec 3.6.8.2 & 3.6.8.6.3], and LTTPR will reset the link and stop sending DP signals to DPTX/Scope causing the measurements to fail. Note that step 3 will not trigger LT and DP link will never recovered by the
Aux Emulator/Scope.
The reset of link can be tested with a monitor connected to LTTPR port simply by writing to LINK_BW_SET or LANE_COUNT_SET as follow
igt/tools/dpcd_reg write --offset=0x100 --value 0x14 --device=2
OR
printf '\x14' | sudo dd of=/dev/drm_dp_aux2 bs=1 count=1 conv=notrunc seek=$((0x100))
This single aux write causes the screen to blank, sending short HPD to DPTX, setting LINK_STATUS_UPDATE = 1 in DPCD 0x204, and triggering LT.
As stated in [1]:
"Before any TX electrical testing can be performed, the link between a DPTX and DPRX (in this case, a piece of test equipment), including all LTTPRs within the path, shall be trained as defined in this Standard."
In addition, changing Phy pattern/Swing/Pre-emphasis (Step 3) uses the same link rate and lane count applied on step 2, so no need to redo LT.
The fix is to not rewrite link config in step 3, and just writes TRAINING_LANEx_SET and LINK_QUAL_PATTERN_SET
[1]: DP 2.0 E11 - 3.6.11.1 LTTPR DPTX_PHY Electrical Compliance
[2]: Configuring UnigrafDPTC Controller - Automation Test Sequence
https://www.keysight.com/us/en/assets/9922-01244/help-files/
D9040DPPC-DisplayPort-Test-Software-Online-Help-latest.chm
--- drivers/gpu/drm/display/drm_dp_helper.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/gpu/drm/display/drm_dp_helper.c +0 -9
@@ -2636,17 +2636,8 @@ int drm_dp_set_phy_test_pattern(struct drm_dp_aux *aux, struct drm_dp_phy_test_params *data, u8 dp_rev) { int err, i; -u8 link_config[2 ];u8 test_pattern; - link_config[0 ] =drm_dp_link_rate_to_bw_code (data->link_rate); - link_config[1 ] = data->num_lanes; -if (data->enhanced_frame_cap) - link_config[1 ] |=DP_LANE_COUNT_ENHANCED_FRAME_EN ; - err =drm_dp_dpcd_write (aux,DP_LINK_BW_SET , link_config,2 ); -if (err <0 ) -return err; - test_pattern = data->phy_pattern;if (dp_rev <0x12 ) { test_pattern = (test_pattern << 2) &
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 627/717 drm/amd/display: polling vid stream status in hpo dp blank
In reply to Greg Kroah-HartmanFrom: Wenjing Liu <[email protected]>
[ Upstream commit e32df0c7ecead95d70ca89f39b1b2b02a59ff691 ]
[why]
vid stream control is double bufferred, if we don't wait for video stream enable set to 0, we may get temporary image corruption showing on the stream when setting PIXEL_TO_SYMBOL_FIFO_ENABLE to 0.
--- .../drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c +3 -3
@@ -150,9 +150,9 @@ static void dcn31_hpo_dp_stream_enc_dp_blank(* 10us*5000=50ms. This covers 41.7ms of minimum 24 Hz mode + * a little more because we may not trust delay accuracy. */ -//REG_WAIT(DP_SYM32_ENC_VID_STREAM_CONTROL, -// VID_STREAM_STATUS, 0, -// 10, 5000); +REG_WAIT (DP_SYM32_ENC_VID_STREAM_CONTROL , +VID_STREAM_STATUS ,0 , +10 ,5000 );/* Disable SDP tranmission */ REG_UPDATE(DP_SYM32_ENC_SDP_CONTROL,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 614/717 platform/x86: hp-wmi: Setting thermal profile fails with 0x06
In reply to Greg Kroah-HartmanFrom: Jorge Lopez <[email protected]>
[ Upstream commit 00b1829294b7c88ecba92c661fbe6fe347b364d2 ]
Error 0x06 (invalid command parameter) is reported by hp-wmi module when reading the current thermal profile and then proceed to set it back. The failing condition occurs in Linux NixOS after user configures the thermal profile to ‘quiet mode’ in Windows. Quiet Fan Mode is supported in Windows but was not supported in hp-wmi module.
This fix adds support for PLATFORM_PROFILE_QUIET in hp-wmi module for HP notebooks other than HP Omen series. Quiet thermal profile is not supported in HP Omen series notebooks.
--- drivers/platform/x86/hp-wmi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/platform/x86/hp-wmi.c +10 -1
@@ -177,7 +177,8 @@ enum hp_thermal_profile_omen_v1 {enum hp_thermal_profile {HP_THERMAL_PROFILE_PERFORMANCE =0x00 ,HP_THERMAL_PROFILE_DEFAULT =0x01 , -HP_THERMAL_PROFILE_COOL =0x02 +HP_THERMAL_PROFILE_COOL =0x02 , +HP_THERMAL_PROFILE_QUIET =0x03 , };#define IS_HWBLOCKED (x) ((x & HPWMI_POWER_FW_OR_HW) != HPWMI_POWER_FW_OR_HW)
@@ -1194,6 +1195,9 @@ static int hp_wmi_platform_profile_get(struct platform_profile_handler *pprof,case HP_THERMAL_PROFILE_COOL : *profile =PLATFORM_PROFILE_COOL ;break ; +case HP_THERMAL_PROFILE_QUIET : + *profile =PLATFORM_PROFILE_QUIET ; +break ;default :return -EINVAL ; }
@@ -1216,6 +1220,9 @@ static int hp_wmi_platform_profile_set(struct platform_profile_handler *pprof,case PLATFORM_PROFILE_COOL : tp =HP_THERMAL_PROFILE_COOL ;break ; +case PLATFORM_PROFILE_QUIET : + tp =HP_THERMAL_PROFILE_QUIET ; +break ;default :return -EOPNOTSUPP ; }
@@ -1263,6 +1270,8 @@ static int thermal_profile_setup(void) platform_profile_handler.profile_get = hp_wmi_platform_profile_get; platform_profile_handler.profile_set = hp_wmi_platform_profile_set; + +set_bit (PLATFORM_PROFILE_QUIET , platform_profile_handler.choices); }set_bit (PLATFORM_PROFILE_COOL , platform_profile_handler.choices);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 661/717 iommu/arm-smmu-v3: Make default domain type of HiSilicon PTT device to identity
In reply to Greg Kroah-HartmanFrom: Yicong Yang <[email protected]>
[ Upstream commit 24b6c7798a0122012ca848ea0d25e973334266b0 ]
The DMA operations of HiSilicon PTT device can only work properly with identical mappings. So add a quirk for the device to force the domain as passthrough.
--- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +21 -0
@@ -2839,6 +2839,26 @@ static int arm_smmu_dev_disable_feature(struct device *dev, } } +/* +* HiSilicon PCIe tune and trace device can be used to trace TLP headers on the +* PCIe link and save the data to memory by DMA. The hardware is restricted to +* use identity mapping only. +*/ +#define IS_HISI_PTT_DEVICE (pdev) ((pdev)->vendor == PCI_VENDOR_ID_HUAWEI && \ + (pdev)->device == 0xa12e) + +static int arm_smmu_def_domain_type (struct device *dev) +{ +if (dev_is_pci (dev)) { +struct pci_dev *pdev =to_pci_dev (dev); + +if (IS_HISI_PTT_DEVICE (pdev)) +return IOMMU_DOMAIN_IDENTITY ; + } + +return 0 ; +} +static struct iommu_ops arm_smmu_ops = { .capable = arm_smmu_capable, .domain_alloc = arm_smmu_domain_alloc,
@@ -2856,6 +2876,7 @@ static struct iommu_ops arm_smmu_ops = { .sva_unbind = arm_smmu_sva_unbind, .sva_get_pasid = arm_smmu_sva_get_pasid, .page_response = arm_smmu_page_response, + .def_domain_type = arm_smmu_def_domain_type, .pgsize_bitmap = -1UL, /* Restricted during device attach */ .owner = THIS_MODULE, .default_domain_ops = &(const struct iommu_domain_ops ) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 628/717 drm/amdkfd: Fix UBSAN shift-out-of-bounds warning
In reply to Greg Kroah-HartmanFrom: Felix Kuehling <[email protected]>
[ Upstream commit b292cafe2dd02d96a07147e4b160927e8399d5cc ]
This was fixed in initialize_cpsch before, but not in initialize_nocpsch. Factor sdma bitmap initialization into a helper function to apply the correct implementation in both cases without duplicating it.
v2: Added a range check
--- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +21 -24
@@ -1232,6 +1232,24 @@ static void init_interrupts(struct device_queue_manager *dqm) dqm->dev->kfd2kgd->init_interrupts (dqm->dev->adev, i); } +static void init_sdma_bitmaps (struct device_queue_manager *dqm) +{ +unsigned int num_sdma_queues = + min_t(unsigned int, sizeof(dqm->sdma_bitmap)*8, +get_num_sdma_queues (dqm)); +unsigned int num_xgmi_sdma_queues = + min_t(unsigned int, sizeof(dqm->xgmi_sdma_bitmap)*8, +get_num_xgmi_sdma_queues (dqm)); + +if (num_sdma_queues) + dqm->sdma_bitmap =GENMASK_ULL (num_sdma_queues-1 ,0 ); +if (num_xgmi_sdma_queues) + dqm->xgmi_sdma_bitmap =GENMASK_ULL (num_xgmi_sdma_queues-1 ,0 ); + + dqm->sdma_bitmap &= ~get_reserved_sdma_queues_bitmap (dqm); +pr_info ("sdma_bitmap: %llx\n" , dqm->sdma_bitmap); +} +static int initialize_nocpsch (struct device_queue_manager *dqm) {int pipe, queue;
@@ -1260,11 +1278,7 @@ static int initialize_nocpsch(struct device_queue_manager *dqm)memset (dqm->vmid_pasid,0 ,sizeof (dqm->vmid_pasid)); - dqm->sdma_bitmap = ~0ULL >> (64 -get_num_sdma_queues (dqm)); - dqm->sdma_bitmap &= ~(get_reserved_sdma_queues_bitmap (dqm)); -pr_info ("sdma_bitmap: %llx\n" , dqm->sdma_bitmap); - - dqm->xgmi_sdma_bitmap = ~0ULL >> (64 -get_num_xgmi_sdma_queues (dqm)); +init_sdma_bitmaps (dqm);return 0 ; }
@@ -1442,9 +1456,6 @@ static int set_sched_resources(struct device_queue_manager *dqm)static int initialize_cpsch (struct device_queue_manager *dqm) { -uint64_t num_sdma_queues; -uint64_t num_xgmi_sdma_queues; -pr_debug ("num of pipes: %d\n" ,get_pipes_per_mec (dqm));mutex_init (&dqm->lock_hidden);
@@ -1453,24 +1464,10 @@ static int initialize_cpsch(struct device_queue_manager *dqm) dqm->active_cp_queue_count =0 ; dqm->gws_queue_count =0 ; dqm->active_runlist = false; - - num_sdma_queues =get_num_sdma_queues (dqm); -if (num_sdma_queues >=BITS_PER_TYPE (dqm->sdma_bitmap)) - dqm->sdma_bitmap =ULLONG_MAX ; -else - dqm->sdma_bitmap = (BIT_ULL (num_sdma_queues) -1 ); - - dqm->sdma_bitmap &= ~(get_reserved_sdma_queues_bitmap (dqm)); -pr_info ("sdma_bitmap: %llx\n" , dqm->sdma_bitmap); - - num_xgmi_sdma_queues =get_num_xgmi_sdma_queues (dqm); -if (num_xgmi_sdma_queues >=BITS_PER_TYPE (dqm->xgmi_sdma_bitmap)) - dqm->xgmi_sdma_bitmap =ULLONG_MAX ; -else - dqm->xgmi_sdma_bitmap = (BIT_ULL (num_xgmi_sdma_queues) -1 ); -INIT_WORK (&dqm->hw_exception_work, kfd_process_hw_exception); +init_sdma_bitmaps (dqm); +return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 653/717 clk: zynqmp: pll: rectify rate rounding in zynqmp_pll_round_rate
In reply to Greg Kroah-HartmanFrom: Quanyang Wang <[email protected]>
[ Upstream commit 30eaf02149ecc3c5815e45d27187bf09e925071d ]
The function zynqmp_pll_round_rate is used to find a most appropriate PLL frequency which the hardware can generate according to the desired frequency. For example, if the desired frequency is 297MHz, considering the limited range from PS_PLL_VCO_MIN (1.5GHz) to PS_PLL_VCO_MAX (3.0GHz) of PLL, zynqmp_pll_round_rate should return 1.872GHz (297MHz * 5).
There are two problems with the current code of zynqmp_pll_round_rate:
1) When the rate is below PS_PLL_VCO_MIN, it can't find a correct rate when the parameter "rate" is an integer multiple of *prate, in other words, if "f" is zero, zynqmp_pll_round_rate won't return a valid frequency which is from PS_PLL_VCO_MIN to PS_PLL_VCO_MAX. For example, *prate is 33MHz and the rate is 660MHz, zynqmp_pll_round_rate will not boost up rate and just return 660MHz, and this will cause clk_calc_new_rates failure since zynqmp_pll_round_rate returns an invalid rate out of its boundaries.
2) Even if the rate is higher than PS_PLL_VCO_MIN, there is still a risk that zynqmp_pll_round_rate returns an invalid rate because the function DIV_ROUND_CLOSEST makes some loss in the fractional part. If the parent clock *prate is 33333333Hz and we want to set the PLL rate to 1.5GHz, this function will return 1499999985Hz by using the formula below:
value = *prate * DIV_ROUND_CLOSEST(rate, *prate)).
This value is also invalid since it's slightly smaller than PS_PLL_VCO_MIN. because DIV_ROUND_CLOSEST makes some loss in the fractional part.
--- drivers/clk/zynqmp/pll.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)
drivers/clk/zynqmp/pll.c +15 -16
@@ -102,26 +102,25 @@ static long zynqmp_pll_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *prate) {u32 fbdiv; -long rate_div, f; +u32 mult, div; -/* Enable the fractional mode if needed */ - rate_div = (rate *FRAC_DIV ) / *prate; - f = rate_div %FRAC_DIV ; -if (f) { -if (rate >PS_PLL_VCO_MAX ) { - fbdiv = rate /PS_PLL_VCO_MAX ; - rate = rate / (fbdiv +1 ); - } -if (rate <PS_PLL_VCO_MIN ) { - fbdiv =DIV_ROUND_UP (PS_PLL_VCO_MIN , rate); - rate = rate * fbdiv; - } -return rate; +/* Let rate fall inside the range PS_PLL_VCO_MIN ~ PS_PLL_VCO_MAX */ +if (rate >PS_PLL_VCO_MAX ) { + div =DIV_ROUND_UP (rate,PS_PLL_VCO_MAX ); + rate = rate / div; + } +if (rate <PS_PLL_VCO_MIN ) { + mult =DIV_ROUND_UP (PS_PLL_VCO_MIN , rate); + rate = rate * mult; } fbdiv =DIV_ROUND_CLOSEST (rate, *prate); - fbdiv =clamp_t (u32, fbdiv,PLL_FBDIV_MIN ,PLL_FBDIV_MAX ); -return *prate * fbdiv; +if (fbdiv <PLL_FBDIV_MIN || fbdiv >PLL_FBDIV_MAX ) { + fbdiv =clamp_t (u32, fbdiv,PLL_FBDIV_MIN ,PLL_FBDIV_MAX ); + rate = *prate * fbdiv; + } + +return rate; }/**
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 652/717 media: platform: fix some double free in meson-ge2d and mtk-jpeg and s5p-mfc
In reply to Greg Kroah-HartmanFrom: Hangyu Hua <[email protected]>
[ Upstream commit c65c3f3a2cbf21ed429d9b9c725bdb5dc6abf4cf ]
video_unregister_device will release device internally. There is no need to call video_device_release after video_unregister_device.
--- drivers/media/platform/amlogic/meson-ge2d/ge2d.c | 1 - drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 1 - drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c | 3 +-- 3 files changed, 1 insertion(+), 4 deletions(-)
drivers/media/platform/amlogic/meson-ge2d/ge2d.c +0 -1
@@ -1030,7 +1030,6 @@ static int ge2d_remove(struct platform_device *pdev)video_unregister_device (ge2d->vfd);v4l2_m2m_release (ge2d->m2m_dev); -video_device_release (ge2d->vfd);v4l2_device_unregister (&ge2d->v4l2_dev);clk_disable_unprepare (ge2d->clk);
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +0 -1
@@ -1411,7 +1411,6 @@ static int mtk_jpeg_remove(struct platform_device *pdev)pm_runtime_disable (&pdev->dev);video_unregister_device (jpeg->vdev); -video_device_release (jpeg->vdev);v4l2_m2m_release (jpeg->m2m_dev);v4l2_device_unregister (&jpeg->v4l2_dev);
drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c +1 -2
@@ -1399,6 +1399,7 @@ static int s5p_mfc_probe(struct platform_device *pdev)/* Deinit MFC if probe had failed */ err_enc_reg:video_unregister_device (dev->vfd_dec); + dev->vfd_dec =NULL ; err_dec_reg:video_device_release (dev->vfd_enc); err_enc_alloc:
@@ -1444,8 +1445,6 @@ static int s5p_mfc_remove(struct platform_device *pdev)video_unregister_device (dev->vfd_enc);video_unregister_device (dev->vfd_dec); -video_device_release (dev->vfd_enc); -video_device_release (dev->vfd_dec);v4l2_device_unregister (&dev->v4l2_dev);s5p_mfc_unconfigure_dma_memory (dev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 663/717 power: supply: adp5061: fix out-of-bounds read in adp5061_get_chg_type()
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit 9d47e01b9d807808224347935562f7043a358054 ]
ADP5061_CHG_STATUS_1_CHG_STATUS is masked with 0x07, which means a length of 8, but adp5061_chg_type array size is 4, may end up reading 4 elements beyond the end of the adp5061_chg_type[] array.
--- drivers/power/supply/adp5061.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/power/supply/adp5061.c +3 -3
@@ -427,11 +427,11 @@ static int adp5061_get_chg_type(struct adp5061_state *st,if (ret <0 )return ret; - chg_type = adp5061_chg_type[ADP5061_CHG_STATUS_1_CHG_STATUS (status1)]; -if (chg_type >ADP5061_CHG_FAST_CV ) + chg_type =ADP5061_CHG_STATUS_1_CHG_STATUS (status1); +if (chg_type >=ARRAY_SIZE (adp5061_chg_type)) val->intval =POWER_SUPPLY_STATUS_UNKNOWN ;else - val->intval = chg_type; + val->intval = adp5061_chg_type[chg_type];return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 665/717 blk-throttle: prevent overflow while calculating wait time
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit 8d6bbaada2e0a65f9012ac4c2506460160e7237a ]
There is a problem found by code review in tg_with_in_bps_limit() that 'bps_limit * jiffy_elapsed_rnd' might overflow. Fix the problem by calling mul_u64_u64_div_u64() instead.
--- block/blk-throttle.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
block/blk-throttle.c +3 -5
@@ -806,7 +806,7 @@ static bool tg_with_in_bps_limit(struct throtl_grp *tg, struct bio *bio, u64 bps_limit, unsigned long *wait) { bool rw = bio_data_dir(bio); -u64 bytes_allowed, extra_bytes, tmp; +u64 bytes_allowed, extra_bytes;unsigned long jiffy_elapsed, jiffy_wait, jiffy_elapsed_rnd;unsigned int bio_size =throtl_bio_data_size (bio);
@@ -824,10 +824,8 @@ static bool tg_with_in_bps_limit(struct throtl_grp *tg, struct bio *bio, jiffy_elapsed_rnd = tg->td->throtl_slice; jiffy_elapsed_rnd =roundup (jiffy_elapsed_rnd, tg->td->throtl_slice); - - tmp = bps_limit * jiffy_elapsed_rnd; -do_div (tmp,HZ ); - bytes_allowed = tmp; + bytes_allowed =mul_u64_u64_div_u64 (bps_limit, (u64 )jiffy_elapsed_rnd, + (u64 )HZ );if (tg->bytes_disp[rw] + bio_size <= bytes_allowed) {if (wait)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 685/717 nvme: handle effects after freeing the request
In reply to Greg Kroah-HartmanFrom: Keith Busch <[email protected]>
[ Upstream commit bc8fb906b0ff9339b4286698cb7cd9cd5b8c53eb ]
If a reset occurs after the scan work attempts to issue a command, the reset may quisce the admin queue, which blocks the scan work's command from dispatching. The scan work will not be able to complete while the queue is quiesced.
Meanwhile, the reset work will cancel all outstanding admin tags and wait until all requests have transitioned to idle, which includes the passthrough request. But the passthrough request won't be set to idle until after the scan_work flushes, so we're deadlocked.
Fix this by handling the end effects after the request has been freed.
--- drivers/nvme/host/core.c | 17 ++++++----------- drivers/nvme/host/ioctl.c | 9 ++++++++- drivers/nvme/host/nvme.h | 4 +++- drivers/nvme/target/passthru.c | 7 ++++++- 4 files changed, 23 insertions(+), 14 deletions(-)
drivers/nvme/host/core.c +6 -11
@@ -1089,8 +1089,8 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns,return effects; } -static void nvme_passthru_end (struct nvme_ctrl *ctrl,u32 effects, -struct nvme_command *cmd,int status) +void nvme_passthru_end (struct nvme_ctrl *ctrl,u32 effects, +struct nvme_command *cmd,int status) {if (effects &NVME_CMD_EFFECTS_CSE_MASK ) {nvme_unfreeze (ctrl);
@@ -1126,21 +1126,16 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects,break ; } } +EXPORT_SYMBOL_NS_GPL (nvme_passthru_end,NVME_TARGET_PASSTHRU ); -int nvme_execute_passthru_rq (struct request *rq) +int nvme_execute_passthru_rq (struct request *rq,u32 *effects) {struct nvme_command *cmd =nvme_req (rq)->cmd;struct nvme_ctrl *ctrl =nvme_req (rq)->ctrl;struct nvme_ns *ns = rq->q->queuedata; -u32 effects; -int ret; - effects =nvme_passthru_start (ctrl, ns, cmd->common.opcode); - ret =nvme_execute_rq (rq, false); -if (effects)/* nothing to be done for zero cmd effects */ -nvme_passthru_end (ctrl, effects, cmd, ret); - -return ret; + *effects =nvme_passthru_start (ctrl, ns, cmd->common.opcode); +return nvme_execute_rq (rq, false); }EXPORT_SYMBOL_NS_GPL (nvme_execute_passthru_rq,NVME_TARGET_PASSTHRU );
drivers/nvme/host/ioctl.c +8 -1
@@ -136,9 +136,11 @@ static int nvme_submit_user_cmd(struct request_queue *q, unsigned bufflen, void __user *meta_buffer, unsigned meta_len, u32 meta_seed, u64 *result, unsigned timeout, bool vec) { + struct nvme_ctrl *ctrl;struct request *req;void *meta =NULL ;struct bio *bio; +u32 effects;int ret; req = nvme_alloc_user_request(q, cmd, ubuffer, bufflen, meta_buffer,
@@ -147,8 +149,9 @@ static int nvme_submit_user_cmd(struct request_queue *q,return PTR_ERR (req); bio = req->bio; + ctrl =nvme_req (req)->ctrl; - ret =nvme_execute_passthru_rq (req); + ret =nvme_execute_passthru_rq (req, &effects);if (result) *result =le64_to_cpu (nvme_req (req)->result.u64);
@@ -158,6 +161,10 @@ static int nvme_submit_user_cmd(struct request_queue *q,if (bio)blk_rq_unmap_user (bio);blk_mq_free_request (req); + +if (effects) +nvme_passthru_end (ctrl, effects, cmd, ret); +return ret; }
drivers/nvme/host/nvme.h +3 -1
@@ -994,7 +994,9 @@ static inline bool nvme_ctrl_sgl_supported(struct nvme_ctrl *ctrl)u32 nvme_command_effects (struct nvme_ctrl *ctrl,struct nvme_ns *ns,u8 opcode); -int nvme_execute_passthru_rq (struct request *rq); +int nvme_execute_passthru_rq (struct request *rq,u32 *effects); +void nvme_passthru_end (struct nvme_ctrl *ctrl,u32 effects, +struct nvme_command *cmd,int status);struct nvme_ctrl *nvme_ctrl_from_file (struct file *file);struct nvme_ns *nvme_find_get_ns (struct nvme_ctrl *ctrl,unsigned nsid);void nvme_put_ns (struct nvme_ns *ns);
drivers/nvme/target/passthru.c +6 -1
@@ -215,9 +215,11 @@ static void nvmet_passthru_execute_cmd_work(struct work_struct *w) { struct nvmet_req *req = container_of(w, struct nvmet_req, p.work);struct request *rq = req->p.rq; +struct nvme_ctrl *ctrl =nvme_req (rq)->ctrl; +u32 effects;int status; - status =nvme_execute_passthru_rq (rq); + status =nvme_execute_passthru_rq (rq, &effects);if (status ==NVME_SC_SUCCESS && req->cmd->common.opcode == nvme_admin_identify) {
@@ -238,6 +240,9 @@ static void nvmet_passthru_execute_cmd_work(struct work_struct *w) req->cqe->result =nvme_req (rq)->result;nvmet_req_complete (req, status);blk_mq_free_request (rq); + +if (effects) +nvme_passthru_end (ctrl, effects, req->cmd, status); } static void nvmet_passthru_req_done(struct request *rq,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 671/717 HSI: ssi_protocol: fix potential resource leak in ssip_pn_open()
In reply to Greg Kroah-HartmanFrom: Jianglei Nie <[email protected]>
[ Upstream commit b28dbcb379e6a7f80262c2732a57681b1ee548ca ]
ssip_pn_open() claims the HSI client's port with hsi_claim_port(). When hsi_register_port_event() gets some error and returns a negetive value, the HSI client's port should be released with hsi_release_port().
Fix it by calling hsi_release_port() when hsi_register_port_event() fails.
--- drivers/hsi/clients/ssi_protocol.c | 1 + 1 file changed, 1 insertion(+)
drivers/hsi/clients/ssi_protocol.c +1 -0
@@ -931,6 +931,7 @@ static int ssip_pn_open(struct net_device *dev)if (err <0 ) {dev_err (&cl->device,"Register HSI port event failed (%d)\n" , err); +hsi_release_port (cl);return err; }dev_dbg (&cl->device,"Configuring SSI port\n" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 694/717 clk: bcm2835: Make peripheral PLLC critical
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 6c5422851d8be8c7451e968fd2e6da41b6109e17 ]
When testing for a series affecting the VEC, it was discovered that turning off and on the VEC clock is crashing the system.
It turns out that, when disabling the VEC clock, it's the only child of the PLLC-per clock which will also get disabled. The source of the crash is PLLC-per being disabled.
It's likely that some other device might not take a clock reference that it actually needs, but it's unclear which at this point. Let's make PLLC-per critical so that we don't have that crash.
--- drivers/clk/bcm/clk-bcm2835.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/bcm/clk-bcm2835.c +1 -1
@@ -1784,7 +1784,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = { .load_mask = CM_PLLC_LOADPER, .hold_mask = CM_PLLC_HOLDPER, .fixed_divider = 1, - .flags = CLK_SET_RATE_PARENT), + .flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT),/* * PLLD is the display PLL, used to drive DSI display panels.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 669/717 soundwire: intel: fix error handling on dai registration issues
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit c6867cda906aadbce5e71efde9c78a26108b2bad ]
The call to intel_register_dai() may fail because of memory allocation issues or problems reported by the ASoC core. In all cases, when a error is thrown the component is not registered, it's invalid to unregister it.
--- drivers/soundwire/intel.c | 1 - 1 file changed, 1 deletion(-)
drivers/soundwire/intel.c +0 -1
@@ -1401,7 +1401,6 @@ int intel_link_startup(struct auxiliary_device *auxdev) ret =intel_register_dai (sdw);if (ret) {dev_err (dev,"DAI registration failed: %d\n" , ret); -snd_soc_unregister_component (dev); goto err_interrupt; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 699/717 mm: hugetlb: fix UAF in hugetlb_handle_userfault
In reply to Greg Kroah-HartmanFrom: Liu Shixin <[email protected]>
commit 958f32ce832ba781ac20e11bb2d12a9352ea28fc upstream.
The vma_lock and hugetlb_fault_mutex are dropped before handling userfault and reacquire them again after handle_userfault(), but reacquire the vma_lock could lead to UAF[1,2] due to the following race,
hugetlb_fault
hugetlb_no_page
/*unlock vma_lock */
hugetlb_handle_userfault
handle_userfault
/* unlock mm->mmap_lock*/
vm_mmap_pgoff
do_mmap
mmap_region
munmap_vma_range
/* clean old vma */
/* lock vma_lock again <--- UAF */
/* unlock vma_lock */Since the vma_lock will unlock immediately after hugetlb_handle_userfault(), let's drop the unneeded lock and unlock in hugetlb_handle_userfault() to fix the issue.
[1] https://lore.kernel.org/linux-mm/[email protected]/
[2] https://lore.kernel.org/linux-mm/[email protected]/
--- mm/hugetlb.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-)
mm/hugetlb.c +17 -20
@@ -5467,7 +5467,6 @@ static inline vm_fault_t hugetlb_handle_ unsigned long addr, unsigned long reason) { -vm_fault_t ret;u32 hash;struct vm_fault vmf = { .vma = vma,
@@ -5485,18 +5484,14 @@ static inline vm_fault_t hugetlb_handle_ };/* -* hugetlb_fault_mutex and i_mmap_rwsem must be -* dropped before handling userfault. Reacquire -* after handling fault to make calling code simpler. +* vma_lock and hugetlb_fault_mutex must be dropped before handling +* userfault. Also mmap_lock will be dropped during handling +* userfault, any vma operation should be careful from here. */ hash =hugetlb_fault_mutex_hash (mapping, idx);mutex_unlock (&hugetlb_fault_mutex_table[hash]);i_mmap_unlock_read (mapping); - ret =handle_userfault (&vmf, reason); -i_mmap_lock_read (mapping); -mutex_lock (&hugetlb_fault_mutex_table[hash]); - -return ret; +return handle_userfault (&vmf, reason); } static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
@@ -5514,6 +5509,7 @@ static vm_fault_t hugetlb_no_page(structspinlock_t *ptl;unsigned long haddr = address &huge_page_mask (h);bool new_page, new_pagecache_page = false; +u32 hash =hugetlb_fault_mutex_hash (mapping, idx);/* * Currently, we are forced to kill the process in the event the
@@ -5524,7 +5520,7 @@ static vm_fault_t hugetlb_no_page(structif (is_vma_resv_set (vma,HPAGE_RESV_UNMAPPED )) {pr_warn_ratelimited ("PID %d killed due to inadequate hugepage pool\n" , current->pid); -return ret; + goto out; }/*
@@ -5541,12 +5537,10 @@ retry: page =find_lock_page (mapping, idx);if (!page) {/* Check for page in userfault range */ -if (userfaultfd_missing (vma)) { - ret =hugetlb_handle_userfault (vma, mapping, idx, +if (userfaultfd_missing (vma)) +return hugetlb_handle_userfault (vma, mapping, idx, flags, haddr, address,VM_UFFD_MISSING ); - goto out; - } page =alloc_huge_page (vma, haddr,0 );if (IS_ERR (page)) {
@@ -5606,10 +5600,9 @@ retry:if (userfaultfd_minor (vma)) {unlock_page (page);put_page (page); - ret =hugetlb_handle_userfault (vma, mapping, idx, +return hugetlb_handle_userfault (vma, mapping, idx, flags, haddr, address,VM_UFFD_MINOR ); - goto out; } }
@@ -5667,6 +5660,8 @@ retry:unlock_page (page); out: +mutex_unlock (&hugetlb_fault_mutex_table[hash]); +i_mmap_unlock_read (mapping);return ret; backout:
@@ -5765,11 +5760,13 @@ vm_fault_t hugetlb_fault(struct mm_struc entry =huge_ptep_get (ptep);/* PTE markers should be handled the same way as none pte */ -if (huge_pte_none_mostly (entry)) { - ret =hugetlb_no_page (mm, vma, mapping, idx, address, ptep, +if (huge_pte_none_mostly (entry)) +/* +* hugetlb_no_page will drop vma lock and hugetlb fault +* mutex internally, which make us return immediately. +*/ +return hugetlb_no_page (mm, vma, mapping, idx, address, ptep, entry, flags); - goto out_mutex; - } ret =0 ;
Greg Kroah-Hartman
maintainerPATCH 346/717 ASoC: mt6660: Fix PM disable depth imbalance in mt6660_i2c_probe
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit b73f11e895e140537e7f8c7251211ccd3ce0782b ]
The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context. We fix it by moving pm_runtime_enable to the endding of mt6660_i2c_probe.
--- sound/soc/codecs/mt6660.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/soc/codecs/mt6660.c +6 -2
@@ -503,13 +503,17 @@ static int mt6660_i2c_probe(struct i2c_client *client)dev_err (chip->dev,"read chip revision fail\n" ); goto probe_fail; } -pm_runtime_set_active (chip->dev); -pm_runtime_enable (chip->dev); ret =devm_snd_soc_register_component (chip->dev, &mt6660_component_driver, &mt6660_codec_dai,1 ); +if (!ret) { +pm_runtime_set_active (chip->dev); +pm_runtime_enable (chip->dev); + } +return ret; + probe_fail:_mt6660_chip_power_on (chip,0 );mutex_destroy (&chip->io_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 523/717 cifs: return correct error in ->calc_signature()
In reply to Greg Kroah-HartmanFrom: Enzo Matsumiya <[email protected]>
[ Upstream commit 09a1f9a168ae1f69f701689429871793174417d2 ]
If an error happens while getting the key or session in the ->calc_signature implementations, 0 (success) is returned. Fix it by returning a proper error code.
Since it seems to be highly unlikely to happen wrap the rc check in unlikely() too.
--- fs/cifs/smb2transport.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
fs/cifs/smb2transport.c +6 -4
@@ -225,9 +225,9 @@ smb2_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server,struct smb_rqst drqst; ses =smb2_find_smb_ses (server,le64_to_cpu (shdr->SessionId)); -if (!ses) { +if (unlikely (!ses)) {cifs_server_dbg (VFS ,"%s: Could not find session\n" , __func__); -return 0 ; +return -ENOENT ; }memset (smb2_signature,0x0 ,SMB2_HMACSHA256_SIZE );
@@ -557,8 +557,10 @@ smb3_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server,u8 key[SMB3_SIGN_KEY_SIZE ]; rc =smb2_get_sign_key (le64_to_cpu (shdr->SessionId), server, key); -if (rc) -return 0 ; +if (unlikely (rc)) { +cifs_server_dbg (VFS ,"%s: Could not get signing key\n" , __func__); +return rc; + }if (allocate_crypto) { rc =cifs_alloc_hash ("cmac(aes)" , &hash, &sdesc);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 524/717 iommu/iova: Fix module config properly
In reply to Greg Kroah-HartmanFrom: Robin Murphy <[email protected]>
[ Upstream commit 4f58330fcc8482aa90674e1f40f601e82f18ed4a ]
IOMMU_IOVA is intended to be an optional library for users to select as and when they desire. Since it can be a module now, this means that built-in code which has chosen not to select it should not fail to link if it happens to have selected as a module by someone else. Replace IS_ENABLED() with IS_REACHABLE() to do the right thing.
--- include/linux/iova.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/iova.h +1 -1
@@ -75,7 +75,7 @@ static inline unsigned long iova_pfn(struct iova_domain *iovad, dma_addr_t iova)return iova >>iova_shift (iovad); } -#if IS_ENABLED (CONFIG_IOMMU_IOVA ) +#if IS_REACHABLE (CONFIG_IOMMU_IOVA )int iova_cache_get (void );void iova_cache_put (void );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 698/717 perf intel-pt: Fix system_wide dummy event for hybrid
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit 6cef7dab3e2e5cb23a13569c3880c0532326748c upstream.
User space tasks can migrate between CPUs, so when tracing selected CPUs, system-wide sideband is still needed, however evlist->core.has_user_cpus is not set in the hybrid case, so check the target cpu_list instead.
--- tools/perf/arch/x86/util/intel-pt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/arch/x86/util/intel-pt.c +1 -1
@@ -871,7 +871,7 @@ static int intel_pt_recording_options(st* User space tasks can migrate between CPUs, so when tracing * selected CPUs, sideband for all CPUs is still needed. */ - need_system_wide_tracking = evlist->core.has_user_cpus && + need_system_wide_tracking = opts->target.cpu_list && !intel_pt_evsel->core.attr.exclude_user; tracking_evsel =evlist__add_aux_dummy (evlist, need_system_wide_tracking);
Greg Kroah-Hartman
maintainerPATCH 506/717 powerpc/pseries/vas: Pass hw_cpu_id to node associativity HCALL
In reply to Greg Kroah-HartmanFrom: Haren Myneni <[email protected]>
[ Upstream commit f3e5d9e53e74d77e711a2c90a91a8b0836a9e0b3 ]
Generally the hypervisor decides to allocate a window on different VAS instances. But if user space wishes to allocate on the current VAS instance where the process is executing, the kernel has to pass associativity domain IDs to allocate VAS window HCALL.
To determine the associativity domain IDs for the current CPU, smp_processor_id() is passed to node associativity HCALL which may return H_P2 (-55) error during DLPAR CPU event. This is because Linux CPU numbers (smp_processor_id()) are not the same as the hypervisor's view of CPU numbers.
Fix the issue by passing hard_smp_processor_id() with VPHN_FLAG_VCPU flag (PAPR 14.11.6.1 H_HOME_NODE_ASSOCIATIVITY).
--- arch/powerpc/platforms/pseries/vas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/pseries/vas.c +1 -1
@@ -332,7 +332,7 @@ static struct vas_window *vas_allocate_window(int vas_id, u64 flags,* So no unpacking needs to be done. */ rc =plpar_hcall9 (H_HOME_NODE_ASSOCIATIVITY , domain, -VPHN_FLAG_VCPU ,smp_processor_id ()); +VPHN_FLAG_VCPU ,hard_smp_processor_id ());if (rc !=H_SUCCESS ) {pr_err ("H_HOME_NODE_ASSOCIATIVITY error: %d\n" , rc); goto out;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 702/717 blk-wbt: fix that rwb->wc is always set to 1 in wbt_init()
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
commit 285febabac4a16655372d23ff43e89ff6f216691 upstream.
commit 8c5035dfbb94 ("blk-wbt: call rq_qos_add() after wb_normal is initialized") moves wbt_set_write_cache() before rq_qos_add(), which is wrong because wbt_rq_qos() is still NULL.
Fix the problem by removing wbt_set_write_cache() and setting 'rwb->wc' directly. Noted that this patch also remove the redundant setting of 'rab->wc'.
--- block/blk-wbt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
block/blk-wbt.c +1 -2
@@ -841,12 +841,11 @@ int wbt_init(struct request_queue *q) rwb->last_comp = rwb->last_issue = jiffies; rwb->win_nsec =RWB_WINDOW_NSEC ; rwb->enable_state =WBT_STATE_ON_DEFAULT ; - rwb->wc =1 ; + rwb->wc =test_bit (QUEUE_FLAG_WC , &q->queue_flags); rwb->rq_depth.default_depth =RWB_DEF_DEPTH ; rwb->min_lat_nsec =wbt_default_latency_nsec (q);wbt_queue_depth_changed (&rwb->rqos); -wbt_set_write_cache (q,test_bit (QUEUE_FLAG_WC , &q->queue_flags));/* * Assign rwb and add the stats callback.
Greg Kroah-Hartman
maintainerPATCH 494/717 powerpc/math_emu/efp: Include module.h
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit cfe0d370e0788625ce0df3239aad07a2506c1796 ]
When building with a recent version of clang, there are a couple of errors around the call to module_init():
arch/powerpc/math-emu/math_efp.c:927:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int] module_init(spe_mathemu_init);
^
int
arch/powerpc/math-emu/math_efp.c:927:13: error: a parameter list without types is only allowed in a function definition
module_init(spe_mathemu_init);
^2 errors generated.
module_init() is a macro, which is not getting expanded because module.h is not included in this file. Add the include so that the macro can expand properly, clearing up the build failure.
--- arch/powerpc/math-emu/math_efp.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/math-emu/math_efp.c +1 -0
@@ -17,6 +17,7 @@#include <linux/types.h> #include <linux/prctl.h> +#include <linux/module.h> #include <linux/uaccess.h> #include <asm/reg.h>
Signature · 1 line
2.35.1