id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
3f05d3bf9422ad33a467933067e7662ea67c001c
Analyze and fix the following issue in the Linux kernel code: tls: Re-present partially-consumed records in tls_sw_read_sock()
Problem Details: The tls_sw_read_sock() loop releases the current skb whether read_actor() consumed the full record or only a prefix. When the actor takes only part of the record and leaves desc->count non-zero, the remainder is lost: skb is neither requeued nor freed, and the next iteration overwrites it during dequeu...
```diff diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index 8e4e57721335..fd8d3c979368 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -2383,7 +2383,7 @@ int tls_sw_read_sock(struct sock *sk, read_descriptor_t *desc, goto read_sock_end; decrypted = 0; - for (;;) { + while (desc->count) { if (!skb_q...
4da7925c124a356fa2dcf45ff4defce19da9e56c
Analyze and fix the following issue in the Linux kernel code: tls: Avoid evaluating freed skb in tls_sw_read_sock() loop
Problem Details: tls_sw_read_sock() ends its receive loop with while (skb), but the else branch in the body calls consume_skb(skb) before the predicate is re-evaluated. A pointer becomes indeterminate when the object it points to reaches end-of-lifetime (C2011 6.2.4p2), and using an indeterminate value is undefined beh...
```diff diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index 964ebc268ee4..8e4e57721335 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -2383,7 +2383,7 @@ int tls_sw_read_sock(struct sock *sk, read_descriptor_t *desc, goto read_sock_end; decrypted = 0; - do { + for (;;) { if (!skb_queue_empty(&ctx->...
8752c396ce3b2136b3d4c906fe103f6efb6782d9
Analyze and fix the following issue in the Linux kernel code: hwspinlock: qcom: avoid uninitialized struct members
Problem Details: The reg_field is allocated on stack, so using the REG_FIELD macro will ensure that unused members do not have uninitialized values. Fixes: 19a0f61224d2 ("hwspinlock: qcom: Add support for Qualcomm HW Mutex block") Link: https://sashiko.dev/#/patchset/20260319105947.6237-1-wsa%2Brenesas%40sang-engineer...
```diff diff --git a/drivers/hwspinlock/qcom_hwspinlock.c b/drivers/hwspinlock/qcom_hwspinlock.c index 0390979fd765..712003a4640c 100644 --- a/drivers/hwspinlock/qcom_hwspinlock.c +++ b/drivers/hwspinlock/qcom_hwspinlock.c @@ -202,7 +202,6 @@ static struct regmap *qcom_hwspinlock_probe_mmio(struct platform_device *pdev...
ecf9fc18e62c58eae1ceb65dab2bccb8a724de2d
Analyze and fix the following issue in the Linux kernel code: remoteproc: qcom: Fix leak when custom dump_segments addition fails
Problem Details: Free allocated minidump_region 'name' in qcom_add_minidump_segments() when failing before adding the region to 'dump_segments'. Otherwise, the 'name' is not tracked and is never freed by qcom_minidump_cleanup(). Return error when adding to 'dump_segments' fails. Cc: stable@vger.kernel.org # v5.11 Fix...
```diff diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c index fd2b6824ad26..e1a955476c9b 100644 --- a/drivers/remoteproc/qcom_common.c +++ b/drivers/remoteproc/qcom_common.c @@ -109,6 +109,7 @@ static int qcom_add_minidump_segments(struct rproc *rproc, struct minidump_subsy struct min...
6ad61d0acd41044a949e84f96a5f8e02284d350f
Analyze and fix the following issue in the Linux kernel code: remoteproc: qcom_q6v5_wcss: drop redundant wcss_q6_bcr_reset
Problem Details: The wcss_q6_bcr_reset used on QCS404, and wcss_q6_reset used on IPQ are the same. "BCR reset" is redundant, and likely a mistake. Use the documented "wcss_q6_reset" instead. Drop ".wcss_q6_reset_required" from the descriptor, since all targets now need it. This changes the bindings expectations, howev...
```diff diff --git a/drivers/remoteproc/qcom_q6v5_wcss.c b/drivers/remoteproc/qcom_q6v5_wcss.c index c27200159a88..b391724cfd08 100644 --- a/drivers/remoteproc/qcom_q6v5_wcss.c +++ b/drivers/remoteproc/qcom_q6v5_wcss.c @@ -96,7 +96,6 @@ struct wcss_data { unsigned int crash_reason_smem; u32 version; bool aon_rese...
506bb8742ea52da13f9f281c5cb2b603ac1931e7
Analyze and fix the following issue in the Linux kernel code: gpu: nova-core: firmware: parse `FalconUCodeDescV2` via `zerocopy`
Problem Details: Now that we have `zerocopy` support, we can avoid some `unsafe` code. For instance, for `FalconUCodeDescV2`, we can replace the `unsafe impl FromBytes` by safely deriving `zerocopy`'s `FromBytes` and then calling `read_from_prefix`. Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Acked-by: Danil...
```diff diff --git a/drivers/gpu/nova-core/firmware.rs b/drivers/gpu/nova-core/firmware.rs index 6c2ab69cb605..ad37994ac15a 100644 --- a/drivers/gpu/nova-core/firmware.rs +++ b/drivers/gpu/nova-core/firmware.rs @@ -48,7 +48,7 @@ fn request_firmware( /// Structure used to describe some firmwares, notably FWSEC-FRTS. ...
29b2a2b99a4dbb9849769162754ed53abbfd40c2
Analyze and fix the following issue in the Linux kernel code: rust: zerocopy-derive: avoid generating non-ASCII identifiers
Problem Details: Linux is built with `-Dnon_ascii_idents`. However, `zerocopy-derive` uses a non-ASCII character (`ẕ`) internally, which in turn triggers the lint when attempting to use derives like `FromBytes`: error: identifier contains non-ASCII characters --> rust/kernel/lib.rs:153:9 | 153 |...
```diff diff --git a/rust/zerocopy-derive/derive/try_from_bytes.rs b/rust/zerocopy-derive/derive/try_from_bytes.rs index ce9c926d5b8e..a3e4a75631a5 100644 --- a/rust/zerocopy-derive/derive/try_from_bytes.rs +++ b/rust/zerocopy-derive/derive/try_from_bytes.rs @@ -457,7 +457,7 @@ fn derive_has_field_struct_union(ctx: &Ct...
70a8d5ada9fabf4a34732b718f9c992195eed2ea
Analyze and fix the following issue in the Linux kernel code: rust: kbuild: show the right `quiet_cmd_rustc_procmacrolibrary`
Problem Details: When Clippy is skipped, `RUSTC` should be shown in `quiet` instead of `CLIPPY` to be accurate and to avoid confusion. Thus do so, matching what we do in `quiet_cmd_rustc_library`. Fixes: 7dbe46c0b11d ("rust: kbuild: add proc macro library support") Reviewed-by: Nicolas Schier <nsc@kernel.org> Link: h...
```diff diff --git a/rust/Makefile b/rust/Makefile index b9e9f512cec3..bec9726f256c 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -517,7 +517,7 @@ $(obj)/exports_bindings_generated.h: $(obj)/bindings.o FORCE $(obj)/exports_kernel_generated.h: $(obj)/kernel.o FORCE $(call if_changed,exports) -quiet_cmd_rustc_pr...
f0e42f0c4337b1f220de1ddd63f47197c7dee4de
Analyze and fix the following issue in the Linux kernel code: ipv6: sit: reload inner IPv6 header after GSO offloads
Problem Details: ipip6_tunnel_xmit() caches the inner IPv6 header pointer at function entry and continues using it after iptunnel_handle_offloads(). For GSO skbs, iptunnel_handle_offloads() calls skb_header_unclone(). When the skb header is cloned, skb_header_unclone() can call pskb_expand_head(), which may move the s...
```diff diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 201347b4e127..b41e231a669b 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -961,6 +961,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, ip_rt_put(rt); goto tx_error; } + iph6 = ipv6_hdr(skb); if (df) { mtu = dst4_mtu(&rt->dst) -...
a7767290e77ca2e926b49f8bfa29daa12262c612
Analyze and fix the following issue in the Linux kernel code: net/mlx5: Use effective affinity mask for IRQ selection
Problem Details: When a sf is created after a CPU has been taken offline, the IRQ pool may contain IRQs with affinity masks that include the offline CPU. Since only online CPUs should be considered for IRQ placement, cpumask_subset() check would fail because the iter_mask contains offline CPUs that are not present in r...
```diff diff --git a/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c b/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c index 994fe83da4be..a0bb8ee44e35 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c @@ -105,9 +105,12 @@ irq_...
b69004f5a6ad32da84d8aa5b23b9c0caafe6252e
Analyze and fix the following issue in the Linux kernel code: net/mlx5e: xsk: Fix DMA and xdp_frame leak on XDP_TX xmit failure
Problem Details: In the XSK branch of mlx5e_xmit_xdp_buff(), when sq->xmit_xdp_frame() returns false (e.g. XDPSQ is full), the function returns without unmapping the DMA address or freeing the xdp_frame allocated by xdp_convert_zc_to_xdp_frame(). The xdpi_fifo push only happens on success, so the completion path cannot...
```diff diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c index d3bab198c99c..d8c7cb8837d7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c @@ -103,9 +103,15 @@ mlx5e_xmit_xdp_buff(struct m...
894e036a24a26a6dd7b17d8d3fb5c53ab48a6074
Analyze and fix the following issue in the Linux kernel code: net/mlx5: Fix slab-out-of-bounds in mlx5_query_nic_vport_mac_list
Problem Details: mlx5_query_nic_vport_mac_list() sizes its firmware command buffer using the PF's log_max_current_uc/mc_list capabilities. When querying a VF vport with a larger configured max (via devlink), the firmware response can overflow this buffer: BUG: KASAN: slab-out-of-bounds in mlx5_query_nic_vport_mac_lis...
```diff diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 7c8311f41232..236f89a6483a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -533,23 +533,16 @@ static void esw_update_...
a2171131ecda1ed61a594a1eb715e75fdad0fef5
Analyze and fix the following issue in the Linux kernel code: net: qrtr: fix refcount saturation and potential UAF in qrtr_port_remove
Problem Details: In qrtr_port_remove(), the socket reference count is decremented via __sock_put() before the port is removed from the qrtr_ports XArray and before the RCU grace period elapses. This breaks the fundamental RCU update paradigm. It exposes a race window where a concurrent RCU reader (such as qrtr_reset_p...
```diff diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c index 7cec6a7859b0..db823177e636 100644 --- a/net/qrtr/af_qrtr.c +++ b/net/qrtr/af_qrtr.c @@ -707,13 +707,13 @@ static void qrtr_port_remove(struct qrtr_sock *ipc) if (port == QRTR_PORT_CTRL) port = 0; - __sock_put(&ipc->sk); - xa_erase(&qrtr_ports, ...
cd1fc0e3c1f67c0c31dfc215e5d9b771133dedc0
Analyze and fix the following issue in the Linux kernel code: fs/proc/task_mmu: do not warn on seeing non-migration pmd entry
Problem Details: Patch series "mm/hmm: A fix and a selftest", v3. Patch 1 fixes a stale warning present from the time when only migration softleaf entries were supported at the PMD level. Patch 2 adds some code into hmm-tests.c which exercises the pagemap path for PMD device-private entries. This patch (of 2): pag...
```diff diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 06fb94a965ff..d32408f7cd5e 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -2129,7 +2129,6 @@ static int pagemap_pmd_range_thp(pmd_t *pmdp, unsigned long addr, flags |= PM_SOFT_DIRTY; if (pmd_swp_uffd_wp(pmd)) flags |= PM_UFFD_WP;...
8198657c74170ea78808d1f1d886c7d35fd3694e
Analyze and fix the following issue in the Linux kernel code: lib/test_hmm: check alloc_page_vma() return value and handle OOM
Problem Details: Check alloc_page_vma() return status for page allocation failures, free allocated pages and return VM_FAULT_OOM on error. Handle return codes of dmirror_devmem_fault_alloc_and_copy(), call migrate_vma_finalize() to remove migration entries from migrate_vma_setup(). Link: https://lore.kernel.org/20260...
```diff diff --git a/lib/test_hmm.c b/lib/test_hmm.c index 35f774ed2d99..9c59d1ceb5b5 100644 --- a/lib/test_hmm.c +++ b/lib/test_hmm.c @@ -1063,6 +1063,25 @@ static vm_fault_t dmirror_devmem_fault_alloc_and_copy(struct migrate_vma *args, /* Try with smaller pages if large allocation fails */ if (!dpage && order...
c13a0316aef5f4b73e8b4bf6943737f836d65e1d
Analyze and fix the following issue in the Linux kernel code: mm/swap, PM: hibernate: fix swapoff race in uswsusp by pinning swap device
Problem Details: Patch series "mm/swap, PM: hibernate: fix swapoff race in uswsusp by pinning swap device", v8. Currently, in the uswsusp path, only the swap type value is retrieved at lookup time without holding a reference. If swapoff races after the type is acquired, subsequent slot allocations operate on a stale s...
```diff diff --git a/include/linux/swap.h b/include/linux/swap.h index 8c43bc3055c9..8f0f68e245ba 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -213,6 +213,7 @@ enum { SWP_PAGE_DISCARD = (1 << 10), /* freed swap page-cluster discards */ SWP_STABLE_WRITES = (1 << 11), /* no overwrite PG_writeback p...
c55dd3b46c1208d6d2ea737a8aefef4aa4c70cb8
Analyze and fix the following issue in the Linux kernel code: vmalloc: fix NULL pointer dereference in is_vm_area_hugepages()
Problem Details: find_vm_area() can return NULL if the given address is not a valid vmalloc area. Check the return value before dereferencing it to avoid a kernel crash. Link: https://lore.kernel.org/20260529014130.671291-1-hui.zhu@linux.dev Fixes: 121e6f3258fe ("mm/vmalloc: hugepage vmalloc mappings") Signed-off-by:...
```diff diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 3b02c0c6b371..d87dc7f77f4e 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -265,7 +265,9 @@ static inline bool is_vm_area_hugepages(const void *addr) * allocated in the vmalloc layer. */ #ifdef CONFIG_HAVE_ARCH_HUG...
cc7a9f6e57c4f71e8e1fee3274b1ae8770f2a743
Analyze and fix the following issue in the Linux kernel code: userfaultfd: build __VMA_UFFD_FLAGS from config-gated masks
Problem Details: The VMA flags bitmap is a single word today: NUM_VMA_FLAG_BITS is BITS_PER_LONG, so on 32-bit vma_flags_t holds only 32 bits. (The bitmap type exists so this can grow past BITS_PER_LONG later; until it does, anything declared above the first word is out of range on 32-bit.) The bit enum nevertheless d...
```diff diff --git a/include/linux/mm.h b/include/linux/mm.h index 0f2612a70fb1..485df9c2dbdd 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -496,6 +496,21 @@ enum { #else #define VM_UFFD_MINOR VM_NONE #endif + +/* + * vma_flags_t masks for the userfaultfd VMA flags. VMA_UFFD_MINOR is gated on + * the s...
8e80af52db652fbc41320eee45a4f73bc029faf2
Analyze and fix the following issue in the Linux kernel code: userfaultfd: gate must_wait writability check on pte_present()
Problem Details: userfaultfd_must_wait() and userfaultfd_huge_must_wait() read the PTE without taking the page table lock and then apply pte_write() / huge_pte_write() to it. Those accessors decode bits from the present encoding only; on a swap or migration entry they read the offset bits that happen to share the same...
```diff diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c index c86daf38d154..246af12bf801 100644 --- a/mm/userfaultfd.c +++ b/mm/userfaultfd.c @@ -2542,6 +2542,15 @@ static inline bool userfaultfd_huge_must_wait(struct userfaultfd_ctx *ctx, /* UFFD PTE markers require userspace to resolve the fault. */ if (pte_is_u...
f7e2c21bd1f57cd5350eecdfdb5d6025ca6afbab
Analyze and fix the following issue in the Linux kernel code: mm/huge_memory: preserve pmd_swp_uffd_wp on device-private PMD downgrade
Problem Details: change_non_present_huge_pmd() rewrites a writable device-private PMD swap entry into a readable one without carrying pmd_swp_uffd_wp() across. The PTE-level change_softleaf_pte() does this correctly; mirror that here, matching what copy_huge_pmd() does for the fork path. Without the carry, a plain mp...
```diff diff --git a/mm/huge_memory.c b/mm/huge_memory.c index da851a5696d5..a5176653ba1f 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2565,6 +2565,8 @@ static void change_non_present_huge_pmd(struct mm_struct *mm, } else if (softleaf_is_device_private_write(entry)) { entry = make_readable_device_priva...
e92d92bbafb264dc0518d52b846a3c07ed8d523f
Analyze and fix the following issue in the Linux kernel code: fs/proc/task_mmu: fix hugetlb self-deadlock in pagemap_scan_pte_hole()
Problem Details: A PAGEMAP_SCAN ioctl requesting PM_SCAN_WP_MATCHING on a hugetlb VMA hangs the calling thread, unkillably, as soon as the scan reaches an unpopulated part of the range: do_pagemap_scan() walk_page_range() walk_hugetlb_range() hugetlb_vma_lock_read() # take the vma lock fo...
```diff diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 1489c67e88f7..06fb94a965ff 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -2977,8 +2977,62 @@ out_unlock: return ret; } + +/* + * Write-protect the unpopulated hugetlb entries covering [addr, end) by + * installing uffd-wp markers inli...
1b074e3270e1c061c829150c742eb83bad4dddd1
Analyze and fix the following issue in the Linux kernel code: fs/proc/task_mmu: use huge_page_size() in pagemap_scan_hugetlb_entry()
Problem Details: The partial-page check compares against HPAGE_SIZE (PMD_SIZE), which is wrong for gigantic hugetlb hstates (e.g. 1G). The walker hands the callback a huge_page_size()-sized range, never start + HPAGE_SIZE, so the comparison always declares it partial and aborts the WP. Compare against the actual hst...
```diff diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index e21a38ac745b..1489c67e88f7 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -2960,7 +2960,7 @@ static int pagemap_scan_hugetlb_entry(pte_t *ptep, unsigned long hmask, if (~categories & PAGE_IS_WRITTEN) goto out_unlock; - if (end != sta...
04718f7c9290f95385f0dd328758753dc1c36dec
Analyze and fix the following issue in the Linux kernel code: fs/proc/task_mmu: fix make_uffd_wp_huge_pte() prot-update race
Problem Details: Patch series "userfaultfd/pagemap: pre-existing fixes". These are pre-existing bug fixes that were carried at the front of the userfaultfd RWP working-set-tracking series up to v5 [1]. Per review feedback that fixes should not sit in the middle of a feature series, they are split out and sent on thei...
```diff diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 1e3a15bf46f4..e21a38ac745b 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -2610,12 +2610,16 @@ static void make_uffd_wp_huge_pte(struct vm_area_struct *vma, if (softleaf_is_hwpoison(entry) || softleaf_is_marker(entry)) return; - if (...
8f7275c174bc5bcc8fc1bec8024e2b3e6fe17f46
Analyze and fix the following issue in the Linux kernel code: lib/test_hmm: fix memory leak in dmirror_migrate_to_system()
Problem Details: Move the kvcalloc() calls after the early return checks to avoid leaking src_pfns and dst_pfns when end < start or mmget_not_zero() fails. Link: https://lore.kernel.org/20260528011336.20797-1-hao.ge@linux.dev Fixes: 775465fd26a3 ("lib/test_hmm: add zone device private THP test infrastructure") Signed-...
```diff diff --git a/lib/test_hmm.c b/lib/test_hmm.c index 63bf77dee987..35f774ed2d99 100644 --- a/lib/test_hmm.c +++ b/lib/test_hmm.c @@ -1111,9 +1111,6 @@ static int dmirror_migrate_to_system(struct dmirror *dmirror, unsigned long *src_pfns; unsigned long *dst_pfns; - src_pfns = kvcalloc(PTRS_PER_PTE, sizeof(*s...
d1aba985984781947ad67c1b44ac64bd498c8f27
Analyze and fix the following issue in the Linux kernel code: zram: drop unused bio parameter from write helpers
Problem Details: After "zram: fix use-after-free in zram_bvec_write_partial()", zram_bvec_write_partial() always passes NULL to zram_read_page() and no longer needs the parent bio. Mirror the read side (zram_bvec_read_partial() has not taken a bio since commit 4e3c87b9421d ("zram: fix synchronous reads")) and drop the...
```diff diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 7917fc7a2a29..fd12604ff8d7 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -2334,7 +2334,7 @@ static int zram_write_page(struct zram *zram, struct page *page, u32 index) * This is a partial IO. R...
3d4f1a54160046d5059ec6c5f2152e054e7b12d7
Analyze and fix the following issue in the Linux kernel code: mm/page_alloc: fix deferred compaction accounting
Problem Details: COMPACT_DEFERRED means compaction did not start because past failures caused the zone to be deferred. try_to_compact_pages() returns the maximum result seen while walking the zonelist, so a final COMPACT_DEFERRED result means no later zone reported that compaction actually ran. __alloc_pages_direct_c...
```diff diff --git a/mm/page_alloc.c b/mm/page_alloc.c index dd2d3d5ac1b1..f7db8f049bd2 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4161,7 +4161,8 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, psi_memstall_leave(&pflags); delayacct_compact_end(); - if (*compact_result == COMPACT_S...
2f5e0477276bb87a407edc75f3d65012e6f63c68
Analyze and fix the following issue in the Linux kernel code: mm: bypass mmap_miss heuristic for VM_EXEC readahead
Problem Details: Patch series "mm: improve large folio readahead for exec memory", v7. Two checks in do_sync_mmap_readahead() limit large-folio readahead: 1. The mmap_miss heuristic is meant to throttle wasteful speculative readahead. It is currently also applied to the VM_EXEC readahead path, which is ta...
```diff diff --git a/mm/filemap.c b/mm/filemap.c index 6bf0b540ef19..58d8ba867b52 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -3340,7 +3340,7 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf) } } - if (!(vm_flags & VM_SEQ_READ)) { + if (!(vm_flags & (VM_SEQ_READ | VM_EXEC))) { /* Avoid b...
ed384eb3a3e121c1d6d5c5d36950fbd286b92026
Analyze and fix the following issue in the Linux kernel code: mm/compaction: respect cpusets when checking retry suitability
Problem Details: should_compact_retry() handles COMPACT_SKIPPED by asking compaction_zonelist_suitable() whether reclaim can make a later compaction attempt worthwhile. That answer is used for the current allocation, so it should follow the same zone eligibility rules as the allocation itself. When cpusets are enable...
```diff diff --git a/include/linux/compaction.h b/include/linux/compaction.h index 173d9c07a895..c829c48d1c71 100644 --- a/include/linux/compaction.h +++ b/include/linux/compaction.h @@ -101,7 +101,7 @@ extern void compaction_defer_reset(struct zone *zone, int order, bool alloc_success); bool compaction_zonelis...
fafaeceb89a5e2e856ff04c2cacb6cae4a2ecb67
Analyze and fix the following issue in the Linux kernel code: mm: switch deferred split shrinker to list_lru
Problem Details: The deferred split queue handles cgroups in a suboptimal fashion. The queue is per-NUMA node or per-cgroup, not the intersection. That means on a cgrouped system, a node-restricted allocation entering reclaim can end up splitting large pages on other nodes: alloc/unmap deferred_spl...
```diff diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 58382e97a66d..c0d223d0c556 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -439,10 +439,10 @@ static inline int split_huge_page(struct page *page) { return split_huge_page_to_list_to_order(page, NULL, 0); } + +int fol...
79a031583ca5bb3d5484178f579fea97706f1ed6
Analyze and fix the following issue in the Linux kernel code: mm: list_lru: fix set_shrinker_bit() call during race with cgroup deletion
Problem Details: Patch series "mm: switch THP shrinker to list_lru", v5. The open-coded deferred split queue has issues. It's not NUMA-aware (when cgroup is enabled), and it's more complicated in the callsites interacting with it. Switching to list_lru fixes the NUMA problem and streamlines things. It also simplifi...
```diff diff --git a/mm/list_lru.c b/mm/list_lru.c index dd29bcf8eb5f..45d1b97737ea 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c @@ -77,14 +77,14 @@ static inline bool lock_list_lru(struct list_lru_one *l, bool irq) } static inline struct list_lru_one * -lock_list_lru_of_memcg(struct list_lru *lru, int nid, struc...
f5cf8c92a2b9fd176d90b6e217ed50fbb5d1f48d
Analyze and fix the following issue in the Linux kernel code: mm/nodemask: correctly describe nodemask operation return types
Problem Details: Commit 0dfe54071d7c8 ("nodemask: Fix return values to be unsigned") changed a number of nodemask operations that used to return int to returning a bool instead. However, it did not update the comment block that described these functions, leaving the documentation incorrect. Fix the comment block to a...
```diff diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index 204c92462f3c..b842aa525546 100644 --- a/include/linux/nodemask.h +++ b/include/linux/nodemask.h @@ -24,23 +24,23 @@ * void nodes_setall(mask) set all bits * void nodes_clear(mask) clear all bits * int node_isset(node, mask) true iff...
5a0082ec20a05ef2378410323a5089a8f1786f4a
Analyze and fix the following issue in the Linux kernel code: net: phy: don't try to setup PHY-driven SFP cages when using genphy
Problem Details: We don't have support for PHY-driver SFP cages with the genphy code. On top of that, it was found by sashiko that running sfp_bus_add_upstream() for genphy deadlocks, as for genphy the PHY probing runs under RTNL, which isn't the case for non-genphy drivers. This problem was reproduced, and does lead...
```diff diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index b48722589f40..1511385b9b36 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -3512,9 +3512,15 @@ static int phy_setup_ports(struct phy_device *phydev) if (ret) return ret; - ret = phy_sfp_probe(ph...
4497f5028675b7e51c4aa59c3f4df01f29424277
Analyze and fix the following issue in the Linux kernel code: net: phy: Clean the phy_ports after unregistering the downstream SFP bus
Problem Details: As reported by sashiko when looking a other patches, we need to ensure that the downstream SFP bus gets unregistered prior to destroying the phy_ports attached to a phy_device, as the SFP code may reference these ports. Let's make sure we follow that ordering in phy_remove(). Fixes: 589e934d2735 ("net...
```diff diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 4ba880446896..b48722589f40 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -3806,11 +3806,11 @@ static int phy_remove(struct device *dev) phydev->state = PHY_DOWN; - phy_cleanup_ports(phydev); - ...
b1e780bb37c641d8291c51d7b4bde33450d18fb4
Analyze and fix the following issue in the Linux kernel code: net: phy: remove phy ports upon probe failure
Problem Details: When phy_probe fails, let's clean the phy_ports that were successfully added already. Suggested-by: Nicolai Buchwitz <nb@tipi-net.de> Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de> Fixes: 589e934d2735 ("net: phy: Introduce PHY ports representation") Signed-off-by: Maxime Chevallier <maxime.chevallier@...
```diff diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 6ccbfacf7d1d..4ba880446896 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -3781,6 +3781,8 @@ out: sfp_bus_del_upstream(phydev->sfp_bus); phydev->sfp_bus = NULL; + phy_cleanup_ports(phydev); + ...
48774e87bbaa0056819d4b52301e4692e50e3252
Analyze and fix the following issue in the Linux kernel code: net: phy: clean the sfp upstream if phy probing fails
Problem Details: Sashiko reported that we don't call sfp_bus_del_upstream() in the probe failure path, so let's add it, otherwise the sfp-bus is left with a dangling 'upstream' field, that may be used later on during SFP events. This issue existed before the generic phylib sfp support, back when drivers were calling p...
```diff diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 3370eb822017..6ccbfacf7d1d 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1718,6 +1718,9 @@ static int phy_sfp_probe(struct phy_device *phydev) ret = sfp_bus_add_upstream(bus, phydev, &sfp_phyde...
c849de7d8757a7af801fc4a4058f71d481d367f2
Analyze and fix the following issue in the Linux kernel code: netdev: fix double-free in netdev_nl_bind_rx_doit()
Problem Details: Sashiko flags that genlmsg_reply() always consumes the skb. The error path calls nlmsg_free(rsp) so we can't jump directly to it. Let's not unbind, just propagate the error to the user. This is the typical way of handling genlmsg_reply() failures. They shouldn't happen unless user does something silly ...
```diff diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c index b8f6076d8007..119eaa6501d5 100644 --- a/net/core/netdev-genl.c +++ b/net/core/netdev-genl.c @@ -1095,8 +1095,6 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info) genlmsg_end(rsp, hdr); err = genlmsg_reply(rsp, info)...
71de0177b28da751f407581a4515cf4d762f6296
Analyze and fix the following issue in the Linux kernel code: net: phonet: free phonet_device after RCU grace period
Problem Details: phonet_device_destroy() removes a phonet_device from the per-net device list with list_del_rcu(), but frees it immediately. RCU readers walking the same list can still hold a pointer to the object after it has been removed, leading to a slab-use-after-free. Use kfree_rcu(), matching the lifetime rule ...
```diff diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c index 86325b7fc1b6..ad44831d6745 100644 --- a/net/phonet/pn_dev.c +++ b/net/phonet/pn_dev.c @@ -108,7 +108,7 @@ static void phonet_device_destroy(struct net_device *dev) for_each_set_bit(addr, pnd->addrs, 64) phonet_address_notify(net, RTM_DELADDR, i...
7c5d41f87f079990bf241359e3c1332d8d10fe87
Analyze and fix the following issue in the Linux kernel code: net: ibm: emac: mal: fix potential system hang in mal_remove()
Problem Details: napi_disable() is not idempotent and calling it on an already-disabled or unenabled NAPI context will cause the kernel to spin indefinitely waiting for the NAPI_STATE_SCHED bit to clear. In mal_remove(), napi_disable() is called unconditionally. If no MACs were registered, NAPI was never enabled. Also...
```diff diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm/emac/mal.c index 83dd7f99d8d5..74526002d52b 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -712,13 +712,13 @@ static void mal_remove(struct platform_device *ofdev) MAL_DBG(mal, "remove" N...
a0130d682222ae21afc395aead7cd2d87e1a8358
Analyze and fix the following issue in the Linux kernel code: net: ibm: emac: Fix use-after-free during device removal
Problem Details: The driver was using devm_register_netdev() which causes unregister_netdev() to be deferred until the devres cleanup phase, which runs after emac_remove() returns. This creates a use-after-free window where: 1. emac_remove() is called, which tears down hardware (cancels work, detaches modules, unre...
```diff diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index 417dfa18daae..4e503b3d0d2d 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3144,7 +3144,7 @@ static int emac_probe(struct platform_device *ofdev) netif_carrier_off(...
8084fc9292c2b9b148c9d19d50710c488652214c
Analyze and fix the following issue in the Linux kernel code: net: ibm: emac: mal: fix unchecked platform_get_irq return values
Problem Details: platform_get_irq() returns a negative errno on failure. Commit c4f5d0454cab5 moved the platform_get_irq() calls and explicitly removed the error checks that were previously present, claiming devm_request_irq() can handle it. However, a negative IRQ number passed to devm_request_irq() fails with -EINVAL...
```diff diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm/emac/mal.c index 7d70056e9008..83dd7f99d8d5 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -635,6 +635,11 @@ static int mal_probe(struct platform_device *ofdev) mal->txeob_irq = platform_...
2365343f4aad3e1b1e7a2e87e98cf66d5e590589
Analyze and fix the following issue in the Linux kernel code: net/mlx4: avoid GCC 10 __bad_copy_from() false positive
Problem Details: mlx4_init_user_cqes() fills a scratch buffer with the CQE initialization pattern and then copies from that buffer to userspace. In the single-copy path, the copy length is array_size(entries, cqe_size), but the scratch buffer is allocated with PAGE_SIZE. GCC 10 does not carry the branch invariant stro...
```diff diff --git a/drivers/net/ethernet/mellanox/mlx4/cq.c b/drivers/net/ethernet/mellanox/mlx4/cq.c index e130e7259275..5c55971abbf0 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cq.c +++ b/drivers/net/ethernet/mellanox/mlx4/cq.c @@ -290,6 +290,7 @@ static void mlx4_cq_free_icm(struct mlx4_dev *dev, int cqn) stat...
f2d70dbd3dcefa8e3c380beff9c31f5f033a4221
Analyze and fix the following issue in the Linux kernel code: iommufd: Destroy the pages content after detaching from dmabuf
Problem Details: Sashiko points out this has gotten out of order, the mutex could still be in use through the dmabuf invalidation callbacks. Don't destroy any of the pages content until the dmabuf is fully detached. Fixes: 71db84a092c3 ("iommufd: Add DMABUF to iopt_pages") Signed-off-by: Jason Gunthorpe <jgg@nvidia.co...
```diff diff --git a/drivers/iommu/iommufd/pages.c b/drivers/iommu/iommufd/pages.c index 7b64002e54b9..03c8379bbc34 100644 --- a/drivers/iommu/iommufd/pages.c +++ b/drivers/iommu/iommufd/pages.c @@ -1656,10 +1656,6 @@ void iopt_release_pages(struct kref *kref) WARN_ON(!RB_EMPTY_ROOT(&pages->domains_itree.rb_root)); ...
f2bb3434544454099a5b6dec213567267b05d79d
Analyze and fix the following issue in the Linux kernel code: net: add pskb_may_pull() to skb_gro_receive_list()
Problem Details: skb_gro_receive_list() calls skb_pull(skb, skb_gro_offset(skb)) without first ensuring the data is in the linear area via pskb_may_pull(). When the skb arrives via napi_gro_frags(), skb_headlen can be 0 (all data in page fragments) while skb_gro_offset is non-zero (after IP+TCP header parsing). The skb...
```diff diff --git a/net/core/gro.c b/net/core/gro.c index a84753983467..35f2f708f010 100644 --- a/net/core/gro.c +++ b/net/core/gro.c @@ -232,6 +232,11 @@ int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb) if (unlikely(p->len + skb->len >= 65536)) return -E2BIG; + if (!pskb_may_pull(skb, skb_gro_o...
6443f4f20bdae726fe01cf5946fba9742a0ffda6
Analyze and fix the following issue in the Linux kernel code: pds_core: quiesce DMA before freeing resources
Problem Details: pdsc_teardown() frees DMA buffers but does not disable bus mastering, leaving the device able to perform DMA after the buffers are freed. This can lead to use-after-free if the device writes to freed memory. Add pci_clear_master() to pdsc_teardown() to disable bus mastering before freeing resources, e...
```diff diff --git a/drivers/net/ethernet/amd/pds_core/core.c b/drivers/net/ethernet/amd/pds_core/core.c index 705cab7b0727..38a2446571af 100644 --- a/drivers/net/ethernet/amd/pds_core/core.c +++ b/drivers/net/ethernet/amd/pds_core/core.c @@ -446,6 +446,8 @@ int pdsc_setup(struct pdsc *pdsc, bool init) { int err; ...
e745cd2c749e557c14a15ac931761c3f58c24489
Analyze and fix the following issue in the Linux kernel code: iommufd: Take dma_resv lock before dma_buf_unpin() in release path
Problem Details: dma_buf_unpin() requires the caller to hold the exporter's dma_resv lock: void dma_buf_unpin(struct dma_buf_attachment *attach) { ... dma_resv_assert_held(dmabuf->resv); ... } iopt_release_pages() calls dma_buf_unpin() without taking that lock, so every iommufd_ioa...
```diff diff --git a/drivers/iommu/iommufd/pages.c b/drivers/iommu/iommufd/pages.c index 9bdb2945afe1..7b64002e54b9 100644 --- a/drivers/iommu/iommufd/pages.c +++ b/drivers/iommu/iommufd/pages.c @@ -1663,7 +1663,9 @@ void iopt_release_pages(struct kref *kref) if (iopt_is_dmabuf(pages) && pages->dmabuf.attach) { st...
2c309a863dd6e609b10caa55a362dc48d2e04564
Analyze and fix the following issue in the Linux kernel code: ip6mr: Free mr_table after RCU grace period.
Problem Details: Since default_device_exit_batch() is called after ->exit_rtnl(), idev->mc_ifc_work could finally call mroute6_is_socket() under RCU while ->exit_rtnl() is running. [0] With CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=n, ip6mr_fib_lookup() does not check if net->ipv6.mrt6 is NULL. If ip6mr_net_exit_batch() set...
```diff diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 8c8ad1753c75..ddbe06397d9c 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -136,16 +136,6 @@ static struct mr_table *__ip6mr_get_table(struct net *net, u32 id) return NULL; } -static struct mr_table *ip6mr_get_table(struct net *net, u32 id) -{ ...
c4f796c4f16ba375b43c608d6bd0f72e20168312
Analyze and fix the following issue in the Linux kernel code: net_sched: sch_fq: convert skb->tstamp if not monotonic
Problem Details: FQ currently assumes skb->tstamp holds monotonic time, as used by TCP. Users with ns_capable CAP_NET_ADMIN can transmit skbs using SO_TXTIME with CLOCK_MONOTONIC, CLOCK_REALTIME or CLOCK_TAI clockids as of commit 80b14dee2bea ("net: Add a new socket option for a future transmit time.") More recently,...
```diff diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c index 33783c9f8e16..7cae082a9847 100644 --- a/net/sched/sch_fq.c +++ b/net/sched/sch_fq.c @@ -537,10 +537,10 @@ static void flow_queue_add(struct fq_flow *flow, struct sk_buff *skb) rb_insert_color(&skb->rbnode, &flow->t_root); } -static bool fq_packet_b...
73f1a618b064884410e7f772467a5f515d6751af
Analyze and fix the following issue in the Linux kernel code: net: ensure SCM_TXTIME delivery time is no older than system boot
Problem Details: Limit input to sane values to avoid having to add tests later in the kernel hot path, e.g., in FQ. SCM_TXTIME timestamps are converted to signed ktime_t when assigned to skb->tstamp. Avoid having negative values overflow into large positive ones when again used as u64, e.g., in FQ time_to_send. For C...
```diff diff --git a/net/core/sock.c b/net/core/sock.c index 4315409c22db..4a8a16793e16 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -3045,12 +3045,42 @@ int __sock_cmsg_send(struct sock *sk, struct cmsghdr *cmsg, sockc->tsflags |= tsflags; break; case SCM_TXTIME: + { + ktime_t tmin; + u64 txtime; + ...
4728f2509f2b66ea72b42cd537664444350ac56f
Analyze and fix the following issue in the Linux kernel code: geneve: Move udp_conf.local_ip6 under CONFIG_IPV6 in geneve_create_sock().
Problem Details: Unlike struct ip_tunnel_key, struct udp_port_cfg does not always define IPv6 address fields. >> drivers/net/geneve.c:778:12: error: no member named 'local_ip6' in 'struct udp_port_cfg' 778 | udp_conf.local_ip6 = info->key.u.ipv6.src; | ~~~~~~~~ ^ Le...
```diff diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index a60e16bbb2c9..23b42466a7c9 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -771,12 +771,15 @@ static struct sock *geneve_create_sock(struct net *net, memset(&udp_conf, 0, sizeof(udp_conf)); +#if IS_ENABLED(CONFIG_IPV6) if (ip...
fd9490bdd4536a8e0911578f62164176b9000552
Analyze and fix the following issue in the Linux kernel code: pinctrl: PINCTRL_STMFX should depend on CONFIG_OF
Problem Details: Commit e785c990adcc ("pinctrl: Kconfig: drop unneeded dependencies on OF_GPIO") removed a redundant dependecy on CONFIG_OF_GPIO for several pinctrl drivers, but this change also removed a dependency on CONFIG_OF for some of those drivers. Normally, this wouldn't be a problem, but PINCTRL_STMFX also se...
```diff diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index de1554809eec..3624cfe4f2a2 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig @@ -558,6 +558,7 @@ config PINCTRL_ST config PINCTRL_STMFX tristate "STMicroelectronics STMFX GPIO expander pinctrl driver" + depends on OF de...
388d2fe16283d68e4be8c5317809a4a218ebeace
Analyze and fix the following issue in the Linux kernel code: dt-bindings: pinctrl: realtek,rtd1625: Fix input voltage property name
Problem Details: The property 'input-voltage-microvolt' is a typo. Rename it to 'input-threshold-voltage-microvolt' to align with the standard pin configuration defined in pincfg-node.yaml and parsed by pinconf-generic.c. Fixes: f6ea7004e926 ("dt-bindings: pinctrl: realtek: Add RTD1625 pinctrl binding") Signed-off-by:...
```diff diff --git a/Documentation/devicetree/bindings/pinctrl/realtek,rtd1625-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/realtek,rtd1625-pinctrl.yaml index 9562a043707e..adc5955a2047 100644 --- a/Documentation/devicetree/bindings/pinctrl/realtek,rtd1625-pinctrl.yaml +++ b/Documentation/devicetree/binding...
5d39580f68e6ddeedd15e587282207489dfb3da2
Analyze and fix the following issue in the Linux kernel code: tcp: restrict SO_ATTACH_FILTER to priv users
Problem Details: This patch restricts the use of SO_ATTACH_FILTER (cBPF) on TCP sockets to users with CAP_NET_ADMIN capability. This blocks potential side-channel attack where an unprivileged application attaches a filter to leak TCP sequence/acknowledgment numbers. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off...
```diff diff --git a/net/core/sock.c b/net/core/sock.c index d097025c116a..cab041b57d28 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1465,6 +1465,11 @@ set_sndbuf: case SO_ATTACH_FILTER: { struct sock_fprog fprog; + if (sk_is_tcp(sk) && + !sockopt_ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN))...
69397c92de77525f70aa43cf3a47256cef409382
Analyze and fix the following issue in the Linux kernel code: KVM: x86/mmu: Recursively zap orphaned nested TDP shadow pages on emulated writes
Problem Details: Recursively zap orphaned nested TDP shadow pages when emulating a guest write to a shadowed page table, regardless of whether or not the associated (parent) shadow page will be zapped, e.g. due to detected write-flooding. This plugs a hole where KVM fails to reclaim defunct, unsync shadow pages for se...
```diff diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index f8aa7eda661e..6e881c40f823 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -6357,7 +6357,7 @@ void kvm_mmu_track_write(struct kvm_vcpu *vcpu, gpa_t gpa, const u8 *new, while (npte--) { entry = *spte; - mmu_page_zap...
439bc91d20188901dac698bed4921caac76d9074
Analyze and fix the following issue in the Linux kernel code: pinctrl: mediatek: mt8167: Fix Schmitt trigger register offset of pins 34-39
Problem Details: The correct Schmitt trigger register offset for pins 34-39 is 0xA00. Value was verified with SoC data sheet. Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com> Fixes: 82d70627e94a ("pinctrl: mediatek: Add MT8167 Pinctrl driver") Signed-off-by: Linus Walleij <linusw@kernel.org>
```diff diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8167.c b/drivers/pinctrl/mediatek/pinctrl-mt8167.c index 143c26622272..c812d614e9d4 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mt8167.c +++ b/drivers/pinctrl/mediatek/pinctrl-mt8167.c @@ -244,7 +244,7 @@ static const struct mtk_pin_ies_smt_set mt8167_smt_set[] ...
1c3044cab23a056ea28da47da1cdd667a39df0b8
Analyze and fix the following issue in the Linux kernel code: pinctrl: mediatek: mt8516: Fix Schmitt trigger register offset of pins 34-39
Problem Details: The correct Schmitt trigger register offset for pins 34-39 is 0xA00. Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com> Fixes: 264667112ef0 ("pinctrl: mediatek: Add MT8516 Pinctrl driver") Signed-off-by: Linus Walleij <linusw@kernel.org>
```diff diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8516.c b/drivers/pinctrl/mediatek/pinctrl-mt8516.c index abda75d4354e..68d6638e7f4b 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mt8516.c +++ b/drivers/pinctrl/mediatek/pinctrl-mt8516.c @@ -244,7 +244,7 @@ static const struct mtk_pin_ies_smt_set mt8516_smt_set[] ...
7c08d430835a90414cd962e3a9602e5b002dee3b
Analyze and fix the following issue in the Linux kernel code: scsi: target: Remove tcm_loop target reset handling
Problem Details: tcm_loop_target_reset is supposed to handle all the LUNs on a target but it's only doing a TMR_LUN_RESET so only that one LUN is handled. This will cause us to return early while IOs to other LUNs are still hung in lower layers. This just removes the target reset handler for the driver because LIO doe...
```diff diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index a25fd826b542..f8902087c6c9 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -270,69 +270,6 @@ static int tcm_loop_device_reset(struct scsi_cmnd *sc) return (ret == TMR_FUNCTION...
fc6f9719e68d4133f2a373e1c6826fdef8bb1a34
Analyze and fix the following issue in the Linux kernel code: scsi: lpfc: Fix spelling mistakes in comments
Problem Details: Comment-only changes across the lpfc driver, found by running scripts/checkpatch.pl with the kernel's scripts/spelling.txt list against drivers/scsi/lpfc/. No functional impact. v1 covered a single site in lpfc_bsg.c. v2 expands to all checkpatch-detected comment misspellings across the driver, per ...
```diff diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index c91fa44b12d4..f4e8164b94ab 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -84,7 +84,7 @@ const char *const trunk_errmsg[] = { /* map errcode */ }; /** - * lpfc_jedec_to_ascii - Hex to ascii co...
01d5e237b33931b970dd190dd6a19c5ef32c105d
Analyze and fix the following issue in the Linux kernel code: scsi: ufs: core: Handle PM commands timeout before SCSI EH
Problem Details: A PM START STOP sent from the UFS well-known LU resume path can race with SCSI EH: The "wl resume" task flow is: __ufshcd_wl_resume() ufshcd_set_dev_pwr_mode(UFS_ACTIVE_PWR_MODE) ufshcd_execute_start_stop() scsi_execute_cmd() blk_execute_rq <-- wait sc...
```diff diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 60ec2c63c2d8..2bbab3b2f656 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -9484,22 +9484,44 @@ static enum scsi_timeout_action ufshcd_eh_timed_out(struct scsi_cmnd *scmd) { struct ufs_hba *hba = shost_priv(scm...
92f58587a04c94985fd4a9e3575720b054c432bf
Analyze and fix the following issue in the Linux kernel code: nvme: quieten sparse warning in valid LBA size check
Problem Details: Currently building with C=1 generates the following warning: CC drivers/nvme/host/core.o CHECK drivers/nvme/host/core.c drivers/nvme/host/core.c:2426:13: warning: unsigned value that used to be signed checked against zero? drivers/nvme/host/core.c:2426:13: signed value source This issue wa...
```diff diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index efaddab8296e..d37fc70fe48a 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2379,6 +2379,11 @@ free: return ret; } +static bool nvme_invalid_lba_sz(u64 nsze, signed int shift, sector_t *capacity) +{ + return chec...
7e161211f1dd5288b4ea802b30e70ef919ebc3da
Analyze and fix the following issue in the Linux kernel code: scsi: target: Fix hexadecimal CHAP_I handling
Problem Details: A mutual CHAP handshake requires target processing of an initiator-sent CHAP_I identifier. The RFC 3720 specification states: 11.1.4. Challenge Handshake Authentication Protocol (CHAP) ... CHAP_A=<A> CHAP_I=<I> CHAP_C=<C> ... Where N, (A,A1,A2), I, C, and R are (correspondingly) the Name, ...
```diff diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c index a3ad2d244dbe..5858cc308979 100644 --- a/drivers/target/iscsi/iscsi_target_auth.c +++ b/drivers/target/iscsi/iscsi_target_auth.c @@ -438,9 +438,11 @@ static int chap_server_compute_hash( } if (type == HEX...
3c08f6034d7459f6d4d5c1599de7bb42c1d89521
Analyze and fix the following issue in the Linux kernel code: scsi: scsi_debug: Fix one-partition tape setup bounds
Problem Details: The tape setup path uses one tape_block entry as the end-of-data marker after the usable tape blocks. For the one-partition layout, partition 0 uses all TAPE_UNITS data slots and partition 1's marker is written at tape_blocks[0] + TAPE_UNITS. Only TAPE_UNITS entries are allocated, so that marker write...
```diff diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index a2f85ee1ae57..bb6b0e7fb910 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -6640,7 +6640,7 @@ static int scsi_debug_sdev_configure(struct scsi_device *sdp, if (sdebug_ptype == TYPE_TAPE) { if (!devip->tape_bl...
6fe0687245e8406bf26143bd45eb16441bbe5280
Analyze and fix the following issue in the Linux kernel code: nvme-apple: Prevent shared tags across queues on Apple A11
Problem Details: On Apple A11, tags of pending commands must be unique across the admin and IO queues, else the firmware crashes with "duplicate tag error for tag N", with N being the tag. Apply the existing workaround for M1 of reserving two tags for the admin queue to A11. Cc: stable@vger.kernel.org Fixes: 04d8ecf3...
```diff diff --git a/drivers/nvme/host/apple.c b/drivers/nvme/host/apple.c index de0d5126458f..79e1fe2a23f9 100644 --- a/drivers/nvme/host/apple.c +++ b/drivers/nvme/host/apple.c @@ -225,7 +225,7 @@ static unsigned int apple_nvme_queue_depth(struct apple_nvme_queue *q) { struct apple_nvme *anv = queue_to_apple_nvme(...
4e31ab47997540d0ff4c9de801741bed03c1ab3f
Analyze and fix the following issue in the Linux kernel code: pinctrl: qcom: Fix resolving register base address from device node
Problem Details: Commit 56ffb63749f4 ("pinctrl: qcom: add multi TLMM region option parameter") added reg-names property based register reading. However multiple platforms are not using the reg-names as they have only single TLMM register region. Commit tried to handle this using the default_region module parameter, ho...
```diff diff --git a/drivers/pinctrl/qcom/tlmm-test.c b/drivers/pinctrl/qcom/tlmm-test.c index b655de5b4c5f..007d6539cece 100644 --- a/drivers/pinctrl/qcom/tlmm-test.c +++ b/drivers/pinctrl/qcom/tlmm-test.c @@ -581,6 +581,9 @@ static int tlmm_reg_base(struct device_node *tlmm, struct resource *res) int ret; int i; ...
656646b3847ac6a21b074a813223feef2aadd6e2
Analyze and fix the following issue in the Linux kernel code: i2c: tegra: Fix NOIRQ suspend/resume
Problem Details: The Tegra I2C driver relies on runtime PM to wake up the controller before each transfer. However, runtime PM is disabled between the system suspend and NOIRQ suspend. If an I2C device initiates a transfer during this window, the I2C controller fails to wake up and the transfer fails. To handle this, t...
```diff diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index efe93c5a7bb8..400c9089daf0 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -2401,29 +2401,38 @@ static int __maybe_unused tegra_i2c_runtime_suspend(struct device *dev) } static int __maybe_...
97d0a9c6e80903d342656ab8a7743a9ec50c92e1
Analyze and fix the following issue in the Linux kernel code: i2c: tegra: Update Tegra410 I2C timing parameters
Problem Details: Update Tegra410 I2C timing parameters based on hardware characterization results. This adjusts the fast mode and HS mode settings to be compliant with the I2C specification. Fixes: 59717f260183 ("i2c: tegra: Add support for Tegra410") Signed-off-by: Akhil R <akhilrajeev@nvidia.com> Reviewed-by: Jon Hu...
```diff diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 479a1667e88d..efe93c5a7bb8 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -2115,9 +2115,9 @@ static const struct tegra_i2c_hw_feature tegra264_i2c_hw = { static const struct tegra_i2c_hw_feat...
4837fb36219e6c08b666bc31a86841bad8526358
Analyze and fix the following issue in the Linux kernel code: nfs: use nfsi->rwsem to protect traversal of the file lock list
Problem Details: Lingfeng identified a bug and suggested two solutions, but both appear to have issues. Generally, we cannot release flc_lock while iterating over the file lock list to avoid use-after-free (UAF) problems with file locks. However, functions like nfs_delegation_claim_locks and nfs4_reclaim_locks cannot ...
```diff diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 122fb3f14ffb..9546d2195c25 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -173,6 +173,7 @@ int nfs4_check_delegation(struct inode *inode, fmode_t type) static int nfs_delegation_claim_locks(struct nfs4_state *state, const nfs4_stateid ...
d616d8bec3b11962735c9c9ff53fb4972162b324
Analyze and fix the following issue in the Linux kernel code: NFSv4.1/pNFS: fix LAYOUTCOMMIT retry loop on OLD_STATEID
Problem Details: Handle -NFS4ERR_OLD_STATEID in nfs4_layoutcommit_done(). This issue was reproduced on NFSv4.2. Without refreshing data->args.stateid, LAYOUTCOMMIT can keep retrying with the same stale stateid after OLD_STATEID, resulting in an unbounded retry loop. Refresh the layout stateid with nfs4_layout_refres...
```diff diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 0d77d50f4de7..393ce50274d2 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -9988,6 +9988,38 @@ nfs4_layoutcommit_done(struct rpc_task *task, void *calldata) case -NFS4ERR_GRACE: /* loca_recalim always false */ task->tk_status = 0; br...
a298c7302ee9584a7a1ac1e8acbede8d98ab51a4
Analyze and fix the following issue in the Linux kernel code: watchdog: unregister PM notifier on watchdog unregister
Problem Details: watchdog_register_device() registers wdd->pm_nb when WDOG_NO_PING_ON_SUSPEND is set, but watchdog_unregister_device() does not remove it. This leaves an embedded notifier block on the PM notifier chain after the watchdog device has been unregistered. A later suspend/resume notification can then call w...
```diff diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c index 866874b26819..f4097aefaf49 100644 --- a/drivers/watchdog/watchdog_core.c +++ b/drivers/watchdog/watchdog_core.c @@ -391,6 +391,9 @@ static void __watchdog_unregister_device(struct watchdog_device *wdd) if (test_bit(WDOG_STO...
c5be907887350812624f8bac4671a0f7e6c22c92
Analyze and fix the following issue in the Linux kernel code: watchdog: core: clean up some comments
Problem Details: Fix some grammar typos and bulleted kernel-doc comment format. Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
```diff diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c index 8300520688d0..866874b26819 100644 --- a/drivers/watchdog/watchdog_core.c +++ b/drivers/watchdog/watchdog_core.c @@ -55,9 +55,9 @@ MODULE_PARM_DESC(stop_on_reboot, "Stop watchdogs on reboot (0=keep watching, 1=s * for exampl...
43b45755e80e5eee9d3f6271d301940af7dbc29b
Analyze and fix the following issue in the Linux kernel code: kill configfs_drop_dentry()
Problem Details: Fold into the only remaining user, don't bother with the timestamps of parent - we are going to rmdir it shortly anyway, which will override those. Fix the locking of inode, while we are at it - updating the link count and timestamps ought to be done with the inode locked. Reviewed-by: Jan Kara <jack...
```diff diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_internal.h index 0b969d0eb8ff..acdeea8e2d69 100644 --- a/fs/configfs/configfs_internal.h +++ b/fs/configfs/configfs_internal.h @@ -76,7 +76,6 @@ extern int configfs_make_dirent(struct configfs_dirent *, struct dentry *, extern int configfs_dir...
9b9e8bb81c41fd27e7b57a1c936fde140548535f
Analyze and fix the following issue in the Linux kernel code: configfs: fix lockless traversals of ->s_children
Problem Details: Having the parent directory locked protects entries from removal by another thread, but it does *not* protect cursors from being moved around by lseek() - or freed, for that matter. Fixes: 6f6107640625 ("configfs: Introduce configfs_dirent_lock") Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Al ...
```diff diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index e84483a0836d..eb991b2a9c34 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c @@ -235,15 +235,16 @@ static int configfs_dirent_exists(struct dentry *dentry) const unsigned char *new = dentry->d_name.name; struct configfs_dirent *sd; + spin_lock(...
3f26bb732cc136ab20176697c92f32c9c84cb125
Analyze and fix the following issue in the Linux kernel code: drm/virtio: fix dma_fence refcount leak on error in virtio_gpu_dma_fence_wait()
Problem Details: dma_fence_unwrap_for_each() internally calls dma_fence_unwrap_first() which does cursor->chain = dma_fence_get(head), taking an extra reference. On normal loop completion, dma_fence_unwrap_next() releases this via dma_fence_chain_walk() -> dma_fence_put(). When virtio_gpu_do_fence_wait() fails and the...
```diff diff --git a/drivers/gpu/drm/virtio/virtgpu_submit.c b/drivers/gpu/drm/virtio/virtgpu_submit.c index dae761fa5788..32cb1e4aa425 100644 --- a/drivers/gpu/drm/virtio/virtgpu_submit.c +++ b/drivers/gpu/drm/virtio/virtgpu_submit.c @@ -65,8 +65,10 @@ static int virtio_gpu_dma_fence_wait(struct virtio_gpu_submit *sub...
729ac5a4b966aac42e08a94dea966f4429008548
Analyze and fix the following issue in the Linux kernel code: i2c: qcom-cci: Fix NULL pointer dereference in cci_remove()
Problem Details: On all modern platforms Qualcomm CCI controller provides two I2C masters, and on particular boards only one I2C master may be initialized, and in such cases the device unbinding or driver removal causes a NULL pointer dereference, because cci_halt() is called for all two I2C masters, but a completion i...
```diff diff --git a/drivers/i2c/busses/i2c-qcom-cci.c b/drivers/i2c/busses/i2c-qcom-cci.c index f3ccfbbc4bea..01e440b6585d 100644 --- a/drivers/i2c/busses/i2c-qcom-cci.c +++ b/drivers/i2c/busses/i2c-qcom-cci.c @@ -660,8 +660,8 @@ static void cci_remove(struct platform_device *pdev) if (cci->master[i].cci) { i2c...
54bf38b27afc08a0eb6b732f9c14eb8a4bcb66b5
Analyze and fix the following issue in the Linux kernel code: RDMA/rtrs-srv: Fix integer underflow in process_read and process_write
Problem Details: usr_len is read from a network-supplied message field (le16_to_cpu) and used to compute data_len = off - usr_len without validating that usr_len <= off. A malicious RDMA client can send usr_len > off causing an integer underflow, resulting in data_len wrapping to a huge size_t value which is then passe...
```diff diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c index 6482ad859bd1..f2fd80c8a044 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c @@ -1059,6 +1059,11 @@ static void process_read(struct rtrs_srv_con *con, "Proces...
d3ec78f8f8d48a04a9fac38d47275c34645e5103
Analyze and fix the following issue in the Linux kernel code: firmware_loader: Fix recursive lock in device_cache_fw_images()
Problem Details: A recursive locking deadlock can occur in the firmware loader's power management notification handler. During system suspend or hibernation preparation, fw_pm_notify() calls device_cache_fw_images(). This function acquires fw_lock to set the firmware cache state to FW_LOADER_START_CACHE and then itera...
```diff diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c index a11b30dda23b..c96312ac2be7 100644 --- a/drivers/base/firmware_loader/main.c +++ b/drivers/base/firmware_loader/main.c @@ -1503,9 +1503,10 @@ static void device_cache_fw_images(void) mutex_lock(&fw_lock); fwc->stat...
4d992e63f52d58f52b724606c60ae7b37a1c582f
Analyze and fix the following issue in the Linux kernel code: ASoC: amd: acp-sdw-sof: Bound DAI link iteration
Problem Details: create_sdw_dailinks() walks sof_dais until it finds an entry with initialised cleared, but sof_dais is allocated with exactly num_ends entries. If all entries are initialised, the loop reads past the end of the array. Pass the allocated entry count to create_sdw_dailinks() and stop before reading past...
```diff diff --git a/sound/soc/amd/acp/acp-sdw-sof-mach.c b/sound/soc/amd/acp/acp-sdw-sof-mach.c index a0fd8a6f9970..a423853f3a97 100644 --- a/sound/soc/amd/acp/acp-sdw-sof-mach.c +++ b/sound/soc/amd/acp/acp-sdw-sof-mach.c @@ -220,13 +220,14 @@ static int create_sdw_dailink(struct snd_soc_card *card, static int crea...
d49ecdf327cc91062d2f80996a163cf65fda1e60
Analyze and fix the following issue in the Linux kernel code: ASoC: amd: acp-sdw-legacy: Bound DAI link iteration
Problem Details: create_sdw_dailinks() walks soc_dais until it finds an entry with initialised cleared, but soc_dais is allocated with exactly num_ends entries. If all entries are initialised, the loop reads past the end of the array. This was reported by KASAN: BUG: KASAN: slab-out-of-bounds in mc_probe+0x26b3/0x2...
```diff diff --git a/sound/soc/amd/acp/acp-sdw-legacy-mach.c b/sound/soc/amd/acp/acp-sdw-legacy-mach.c index 09b475c83c49..e8b6819cc4b4 100644 --- a/sound/soc/amd/acp/acp-sdw-legacy-mach.c +++ b/sound/soc/amd/acp/acp-sdw-legacy-mach.c @@ -303,13 +303,14 @@ static int create_sdw_dailink(struct snd_soc_card *card, sta...
7886054b06f762f62054957a8f6de0f14e6b7541
Analyze and fix the following issue in the Linux kernel code: spi: ep93xx: fix double-free of zeropage on DMA setup failure
Problem Details: If DMA setup fails after allocating the zeropage, the error path frees the page but leaves espi->zeropage dangling. A subsequent call to ep93xx_spi_release_dma() sees the non-NULL pointer and frees the page again. Clear the pointer after freeing in the error path of ep93xx_spi_setup_dma(). Fixes: 626...
```diff diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c index ea610b0537a9..bf389d7590d3 100644 --- a/drivers/spi/spi-ep93xx.c +++ b/drivers/spi/spi-ep93xx.c @@ -600,6 +600,7 @@ fail_release_rx: espi->dma_rx = NULL; fail_free_page: free_page((unsigned long)espi->zeropage); + espi->zeropage = NULL;...
b8948ac26efc395264a47f9a743889065adb5cff
Analyze and fix the following issue in the Linux kernel code: ASoC: mediatek: mt8365-afe-pcm: fix possible NULL-pointer dereferences in mt8365_afe_suspend()
Problem Details: mt8365_afe_suspend() allocates the register backup buffer with devm_kcalloc(), but does not check for allocation failure before using the returned pointer. This may lead to a NULL pointer dereference when accessing afe->reg_back_up[i]. Add the missing NULL check and return -ENOMEM on allocation failur...
```diff diff --git a/sound/soc/mediatek/mt8365/mt8365-afe-pcm.c b/sound/soc/mediatek/mt8365/mt8365-afe-pcm.c index d01793394f22..5966ca18c7c9 100644 --- a/sound/soc/mediatek/mt8365/mt8365-afe-pcm.c +++ b/sound/soc/mediatek/mt8365/mt8365-afe-pcm.c @@ -1974,10 +1974,15 @@ static int mt8365_afe_suspend(struct device *dev)...
a124579c0763da7bc408f4cd7e8f606cadc94855
Analyze and fix the following issue in the Linux kernel code: i2c: stm32f7: fix timing computation ignoring i2c-analog-filter
Problem Details: stm32f7_i2c_compute_timing() uses i2c_dev->analog_filter to pick the analog filter delay, but i2c_dev->analog_filter is parsed from the "i2c-analog-filter" DT property only after the compute_timing loop in stm32f7_i2c_setup_timing(), so in practice the timing calculations always ignore the analog filte...
```diff diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c index 53d9df70ebe4..067af255bd22 100644 --- a/drivers/i2c/busses/i2c-stm32f7.c +++ b/drivers/i2c/busses/i2c-stm32f7.c @@ -694,6 +694,9 @@ static int stm32f7_i2c_setup_timing(struct stm32f7_i2c_dev *i2c_dev, if (!of_property_read_...
7d3fb78b550301e43fdc60312aed733069694426
Analyze and fix the following issue in the Linux kernel code: ASoC: wm_adsp: Fix NULL dereference when removing firmware controls
Problem Details: In wm_adsp_control_remove() check that the priv pointer is not NULL before attempting to cleanup what it points to. When cs_dsp creates a control it calls wm_adsp_control_add_cb() so that wm_adsp can create its own private control data. There are two cases where private data is not created: 1. The co...
```diff diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index a637e22c3929..ca630c9948e4 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -679,6 +679,9 @@ static void wm_adsp_control_remove(struct cs_dsp_coeff_ctl *cs_ctl) { struct wm_coeff_ctl *ctl = cs_ctl->priv; +...
8783fb8031799f1230997c16df8c8dce9fcd1841
Analyze and fix the following issue in the Linux kernel code: i2c: imx: fix clock and pinctrl state inconsistency in runtime PM
Problem Details: In i2c_imx_runtime_suspend(), the clock is disabled before switching the pinctrl state to sleep. If pinctrl_pm_select_sleep_state() fails, the runtime suspend is aborted but the clock remains disabled, causing a system crash when the hardware is subsequently accessed. Fix this by switching the pinctrl...
```diff diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index a208fefd3c3b..28313d0fad37 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -1892,9 +1892,15 @@ static void i2c_imx_remove(struct platform_device *pdev) static int i2c_imx_runtime_suspend(struct device...
8e0a02a989c156ce17f06a645d5f075277e06b95
Analyze and fix the following issue in the Linux kernel code: IB/mlx5: Don't mangle the mr->pd inside the rereg callback
Problem Details: The rereg protocol expects the core code to change mr->pd and synchronize that change with the atomics and syncs. The driver should not touch it. mlx5 needed to update it in umr_rereg_pas() because mlx5r_umr_update_mr_pas() required the updated mr->pd to build the UMR. Simply switch mlx5r_umr_update_...
```diff diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index 47f6a13a5f85..7e2d5219fa3e 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c @@ -1134,10 +1134,8 @@ static int umr_rereg_pas(struct mlx5_ib_mr *mr, struct ib_pd *pd, if (err) return err; ...
4910483bd7ee2b40d0cc8ebd537fa33c95562029
Analyze and fix the following issue in the Linux kernel code: IB/mlx5: Remove unused mkc bits in mlx5r_umr_update_mr_page_shift()
Problem Details: The HW only processes mkc fields selected by mkey_mask. pd, qpn and mkey_7_0 are never selected so they can be left as zero. This removes a racy read of mr->pd. Fixes: e73242aa14d2 ("RDMA/mlx5: Optimize DMABUF mkey page size") Link: https://patch.msgid.link/r/5-v1-29ebd2c229b5+fd5-ib_mr_pd_jgg@nvidia...
```diff diff --git a/drivers/infiniband/hw/mlx5/umr.c b/drivers/infiniband/hw/mlx5/umr.c index 688d5246f284..f0ba8d91f81d 100644 --- a/drivers/infiniband/hw/mlx5/umr.c +++ b/drivers/infiniband/hw/mlx5/umr.c @@ -937,8 +937,7 @@ int mlx5r_umr_update_xlt(struct mlx5_ib_mr *mr, u64 idx, int npages, * pinned and the HW ca...
50d5c02ab8e62325548bd3a6e6b758a9dcd6e7c3
Analyze and fix the following issue in the Linux kernel code: RDMA/nldev: Fix locking when accessing mr->pd
Problem Details: Sashiko points out that, due to rereg_mr, the PD is actually variable and all the touches in nldev are racy. Use mr->device instead of mr->pd->device. Getting the PD restrack ID is more tricky. To avoid disturbing all the happy paths, add an rdma_restrack_sync() operation which is sort of like flush_...
```diff diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c index 5aaba2b9746b..02a0a9c0a4a6 100644 --- a/drivers/infiniband/core/nldev.c +++ b/drivers/infiniband/core/nldev.c @@ -695,7 +695,7 @@ static int fill_res_mr_entry(struct sk_buff *msg, bool has_cap_net_admin, struct rdma_re...
ee7a8335069150c3f1893a697ab30bbeca00d796
Analyze and fix the following issue in the Linux kernel code: IB/mlx5: Properly support implicit ODP rereg_mr
Problem Details: Due to all the child mkeys in the implicit ODP configuration we cannot change anything in place for the parent mkey. Instead the whole thing needs to be rebuilt if any change is requested. If the user does not specify a translation then force the implicit values which will then fall through the logic i...
```diff diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index e75a3aa3e278..17902a643ce5 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c @@ -1188,6 +1188,21 @@ struct ib_mr *mlx5_ib_rereg_user_mr(struct ib_mr *ib_mr, int flags, u64 start, if (!(flags &...
93e64c7a33ff6679d4d1c0a03021a2ff0e2b6c98
Analyze and fix the following issue in the Linux kernel code: RDMA/mlx5: Create ODP EQ for non-pinned dmabuf MRs
Problem Details: DMABUF generally relies on the ODP EQ mechanism to safely implement the move semantics. ODP requires a device-global one time startup of the ODP machinery when the first MR is created, and this was missed on the DMABUF path. Call mlx5r_odp_create_eq() when creating a ODP'able DMABUF. The core code pr...
```diff diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index 0fa0a57240c0..e75a3aa3e278 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c @@ -956,6 +956,10 @@ reg_user_mr_dmabuf(struct ib_pd *pd, struct device *dma_device, atomic_add(ib_umem_num_pages(m...
55d339d200c908de83a408d023cfb7be779b0dd7
Analyze and fix the following issue in the Linux kernel code: IB/mlx5: Don't take the rereg_mr fallback without a new translation
Problem Details: Jumping to mlx5_ib_reg_user_mr() without IB_MR_REREG_TRANS set will use garbage values for start, length, and iova. Recovering the original mr parameters for ODP and DMABUF to properly recreate it is too hard in this flow, so just fail it. Fixes: ef3642c4f54d ("RDMA/mlx5: Fix error unwinds for rereg_m...
```diff diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index 254e6aa4ccaf..0fa0a57240c0 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c @@ -1198,7 +1198,7 @@ struct ib_mr *mlx5_ib_rereg_user_mr(struct ib_mr *ib_mr, int flags, u64 start, } /* DM or...
46800585ae04863c623b1563b03d12e9381089f1
Analyze and fix the following issue in the Linux kernel code: io_uring/kbuf: validate ring provided buffer addresses with access_ok()
Problem Details: Commit: 809b997a5ce9 ("x86-64/arm64/powerpc: clean up and rename __copy_from_user_flushcache") sanitized that any provided copy helper should separately validate destination and source addresses, but we should also ensure that anything that is retrieved from a buffer is validated upfront. For ring pr...
```diff diff --git a/io_uring/kbuf.c b/io_uring/kbuf.c index 7a1c65f631c2..b9f4720ca22f 100644 --- a/io_uring/kbuf.c +++ b/io_uring/kbuf.c @@ -210,10 +210,14 @@ static struct io_br_sel io_ring_buffer_select(struct io_kiocb *req, size_t *len, buf_len = READ_ONCE(buf->len); if (*len == 0 || *len > buf_len) *len = ...
1f57f68c4dd101e5e8ffc9ffa6428f45bcdd776a
Analyze and fix the following issue in the Linux kernel code: s390: Remove GENERIC_LOCKBREAK Kconfig option
Problem Details: s390 selects GENERIC_LOCKBREAK if PREEMPT is enabled. Reason is a historic 18 years old commit [1] which fixed a compile error for PREEMPT enabled kernels. Back than only PREEMPT_NONE and PREEMPT_VOLUNTARY kernels were considered to be important for s390. PREEMPT should "just work". However, since rec...
```diff diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index ecbcbb781e40..9921a3772bf7 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -29,9 +29,6 @@ config GENERIC_BUG config GENERIC_BUG_RELATIVE_POINTERS def_bool y -config GENERIC_LOCKBREAK - def_bool y if PREEMPTION - config AUDIT_ARCH def_boo...
d585018a9258efed01514bae369ab3d4f21e7b1a
Analyze and fix the following issue in the Linux kernel code: riscv: misaligned: Fix fast_unaligned_access_speed_key init
Problem Details: When booting with unaligned_scalar_speed=fast, fast_unaligned_access_speed_key is initialized incorrectly. The key is currently derived from the fast_misaligned_access cpumask, but that mask is only populated when the unaligned access speed probe runs. Specifying unaligned_scalar_speed=fast skips the ...
```diff diff --git a/arch/riscv/kernel/unaligned_access_speed.c b/arch/riscv/kernel/unaligned_access_speed.c index 11c781a4de73..bb57eb5d19df 100644 --- a/arch/riscv/kernel/unaligned_access_speed.c +++ b/arch/riscv/kernel/unaligned_access_speed.c @@ -27,8 +27,6 @@ DEFINE_PER_CPU(long, vector_misaligned_access) = RISCV_...
13e91fd076306f5d0cdfa14f53d69e37274723c4
Analyze and fix the following issue in the Linux kernel code: RDMA/srp: bound SRP_RSP sense copy by the received length
Problem Details: srp_process_rsp() copies sense data from rsp->data + resp_data_len, where resp_data_len is the full 32-bit value supplied by the SRP target and is never checked against the number of bytes actually received (wc->byte_len). The copy length is bounded to SCSI_SENSE_BUFFERSIZE, so at most 96 bytes are cop...
```diff diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index b58868e1cf11..acbd787de265 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -1932,7 +1932,8 @@ static int srp_post_recv(struct srp_rdma_ch *ch, struct srp_iu *iu) return ib...
29e7b925ae6df64894e82ab6419994dc25580a8a
Analyze and fix the following issue in the Linux kernel code: IB/isert: Reject login PDUs shorter than ISER_HEADERS_LEN
Problem Details: In drivers/infiniband/ulp/isert/ib_isert.c, isert_login_recv_done() computes the login request payload length as wc->byte_len minus ISER_HEADERS_LEN with no lower bound, and login_req_len is a signed int. A remote iSER initiator can post a login Send work request carrying fewer than ISER_HEADERS_LEN (7...
```diff diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 348005e71891..1015a51f750a 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c @@ -1383,6 +1383,12 @@ isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc) ib...
db80ad776cd216e833c410569ffc1359c1abc8bf
Analyze and fix the following issue in the Linux kernel code: cpufreq: Remove driver default policy->min/max init
Problem Details: Prior to commit 521223d8b3ec ("cpufreq: Fix initialization of min and max frequency QoS requests"), drivers were setting policy->min/max and these values were used as initial policy QoS constraints. After the above commit, these values are only used temporarily, as cpufreq_set_policy() ultimately over...
```diff diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 6f415860bd2a..07fc6ac3daf8 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1080,10 +1080,9 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) perf = READ_ONCE(cpudata->perf); - pol...
badad6fad60def1b9805559dd81dbab3d97b82aa
Analyze and fix the following issue in the Linux kernel code: RDMA: During rereg_mr ensure that REREG_ACCESS is compatible
Problem Details: If IB_MR_REREG_ACCESS changes from RO to RW then the umem has to be re-evaluated to ensure it is properly pinned as RW. Since the umem is hidden inside each driver's mr struct add a ib_umem_check_rereg() function that each driver has to call before processing IB_MR_REREG_ACCESS. mlx4 has to retain its...
```diff diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index 786fa1aa8e55..4b055712b0d0 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c @@ -332,3 +332,19 @@ int ib_umem_copy_from(void *dst, struct ib_umem *umem, size_t offset, return 0; } EXPORT_SYMBOL...
65aa483f32ec674f0506658329d43403cafe5eb0
Analyze and fix the following issue in the Linux kernel code: Documentation: KVM: Synchronize x86 VM types
Problem Details: KVM has reflected KVM_X86_SNP_VM to userspace since 1dfe571c12cf ("KVM: SEV: Add initial SEV-SNP support"), and KVM_X86_TDX_VM since 161d34609f9b ("KVM: TDX: Make TDX VM type supported"). Update the documentation to reflect this fact. Fixes: 1dfe571c12cf ("KVM: SEV: Add initial SEV-SNP support") Fixes...
```diff diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index 1a5a82ab0d66..7d55aac04c15 100644 --- a/Documentation/virt/kvm/api.rst +++ b/Documentation/virt/kvm/api.rst @@ -9366,6 +9366,8 @@ means the VM type with value @n is supported. Possible values of @n are:: #define KVM_X86_SW_PR...
2c725bd2802fe7afef77318654cf589ff6588743
Analyze and fix the following issue in the Linux kernel code: KVM: selftests: Add regression test for mediated PMU fixed counter filter bug
Problem Details: Add a regression test where KVM would inadvertently ignore PMU event filters on writes that change _some_ bits in FIXED_CTR_CTRL, but not the enable bits for PMCs that are denied to the guest. Link: https://patch.msgid.link/20260603231905.1738487-3-seanjc@google.com Signed-off-by: Sean Christopherson ...
```diff diff --git a/tools/testing/selftests/kvm/x86/pmu_event_filter_test.c b/tools/testing/selftests/kvm/x86/pmu_event_filter_test.c index c1232344fda8..84e4c6ca67a3 100644 --- a/tools/testing/selftests/kvm/x86/pmu_event_filter_test.c +++ b/tools/testing/selftests/kvm/x86/pmu_event_filter_test.c @@ -731,6 +731,8 @@ s...
4721f8160f17554b003e8928bb61e6c9b2fe92a3
Analyze and fix the following issue in the Linux kernel code: KVM: x86: hyper-v: Bound the bank index when querying sparse banks
Problem Details: When checking if a VP ID is included in a sparse bank set, explicitly check that the ID can actually be contained in a sparse bank (the TLFS allows for a maximum of 64 banks of 64 vCPUs each). When handling a paravirtual TLB flush for L2, the VP ID is copied verbatim from the enlightened VMCS, without...
```diff diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index 3551af9a9453..fd4eb1e561f7 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -1839,6 +1839,11 @@ static bool hv_is_vp_in_sparse_set(u32 vp_id, u64 valid_bank_mask, u64 sparse_ba int valid_bit_nr = vp_id / HV_VCPUS_PER_SPARSE_BANK...
48dbe473219832788c3940c84faa7f1df4375d5d
Analyze and fix the following issue in the Linux kernel code: KVM: guest_memfd: fix NUMA interleave index double-counting
Problem Details: kvm_gmem_get_policy() sets the interleave index (the output param that's typically named "ilx") to the full page offset (vm_pgoff + vma offset). But get_vma_policy() adds the page offset on top of the interleave index, and so the offset is counted twice. This causes NUMA interleaving to skip nodes: fo...
```diff diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c index f54502640b08..557aac91fc0a 100644 --- a/virt/kvm/guest_memfd.c +++ b/virt/kvm/guest_memfd.c @@ -438,11 +438,12 @@ static int kvm_gmem_set_policy(struct vm_area_struct *vma, struct mempolicy *mpo } static struct mempolicy *kvm_gmem_get_policy...
1d62e659c0bf11649cf48e002c2a55d148f2610a
Analyze and fix the following issue in the Linux kernel code: NFSv4/flexfiles: honor FF_FLAGS_NO_IO_THRU_MDS in pg_get_mirror_count_write
Problem Details: The FF_FLAGS_NO_IO_THRU_MDS flag lives on each lseg, so any fallback decision made when there is no current lseg (e.g. between LAYOUTRETURN and the next LAYOUTGET) cannot run the per-lseg check. Introduce a sticky hdr-level ditto for FF_FLAGS_NO_IO_THRU_MDS in struct nfs4_flexfile_layout::flags (NFS4_...
```diff diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index 0a4a06d93e6a..c4aa995026f6 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c @@ -636,6 +636,9 @@ ff_layout_alloc_lseg(struct pnfs_layout_hdr *lh, if (!p) goto ou...