id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
c594b83457ccdee76d458416fb3bc9348a37592f
Analyze and fix the following issue in the Linux kernel code: arm64: mm: call pagetable dtor when freeing hot-removed page tables
Problem Details: Since 5e8eb9aeeda3 ("arm64: mm: always call PTE/PMD ctor in __create_pgd_mapping()") page-table allocation on ARM64 always calls pagetable_{pte,pmd,pud,p4d}_ctor(). This sets the page_type to PGTY_table, increments NR_PAGETABLE and possible allocates a PTL. However the matching pagetable_dtor() calls...
```diff diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index dd85e093ffdb..8242f93f05e4 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -1441,6 +1441,7 @@ static void free_hotplug_page_range(struct page *page, size_t size, static void free_hotplug_pgtable_page(struct page *page) { + pagetable_...
98733f3f0becb1ae0701d021c1748e974e5fa55c
Analyze and fix the following issue in the Linux kernel code: mm/list_lru: drain before clearing xarray entry on reparent
Problem Details: memcg_reparent_list_lrus() clears the dying memcg's xarray entry with xas_store(&xas, NULL) before reparenting its per-node lists into the parent. This opens a window where a concurrent list_lru_del() arriving for the dying memcg sees xa_load() == NULL, walks to the parent in lock_list_lru_of_memcg(),...
```diff diff --git a/mm/list_lru.c b/mm/list_lru.c index dd29bcf8eb5f..9bf7f524796b 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c @@ -473,26 +473,29 @@ void memcg_reparent_list_lrus(struct mem_cgroup *memcg, struct mem_cgroup *paren mutex_lock(&list_lrus_mutex); list_for_each_entry(lru, &memcg_list_lrus, list) { ...
43e7f189769c512c843184a8a5892ac779a6bd90
Analyze and fix the following issue in the Linux kernel code: mm/huge_memory: use correct flags for device private PMD entry
Problem Details: Commit 65edfda6f3f2 ("mm/rmap: extend rmap and migration support device-private entries") updated set_pmd_migration_entry() to use pmdp_huge_get_and_clear() in the softleaf case, but made no further adjustments to the function itself. Therefore this function continues to incorrectly use pmd_write(), p...
```diff diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 653f2dc03403..b118bcd392cb 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -4983,7 +4983,7 @@ int set_pmd_migration_entry(struct page_vma_mapped_walk *pvmw, struct vm_area_struct *vma = pvmw->vma; struct mm_struct *mm = vma->vm_mm; unsigned lo...
ab04340b5ae5d52c1d46b750538febcde9d889e7
Analyze and fix the following issue in the Linux kernel code: mm/damon/lru_sort: handle ctx allocation failure
Problem Details: DAMON_LRU_SORT allocates the damon_ctx object for its kdamond in its init function. damon_lru_sort_enabled_store() wrongly assumes the allocation will always succeed once tried. If the damon_ctx allocation was failed, therefore, code execution reaches to damon_commit_ctx() while 'ctx' is NULL. As a ...
```diff diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c index 8494040b1ee4..8cfe7bd3dc1d 100644 --- a/mm/damon/lru_sort.c +++ b/mm/damon/lru_sort.c @@ -437,6 +437,10 @@ static int damon_lru_sort_enabled_store(const char *val, if (!damon_initialized()) return 0; + /* damon_modules_new_paddr_ctx_target() in...
7e2ed8a29427af534bf2cb9b8bc51762b8b6e654
Analyze and fix the following issue in the Linux kernel code: mm/damon/reclaim: handle ctx allocation failure
Problem Details: Patch series "mm/damon/{reclaim,lru_sort}: handle ctx allocation failures". DAMON_RECLAIM and DAMON_LRU_SORT could dereference NULL pointers if their damon_ctx object allocations fail. The bugs are expected to happen infrequently because the allocations are arguably too small to fail on common setups...
```diff diff --git a/mm/damon/reclaim.c b/mm/damon/reclaim.c index fe7fce26cf6c..96f6dfc28eae 100644 --- a/mm/damon/reclaim.c +++ b/mm/damon/reclaim.c @@ -339,6 +339,10 @@ static int damon_reclaim_enabled_store(const char *val, if (!damon_initialized()) return 0; + /* damon_modules_new_paddr_ctx_target() in the ...
732fd9f0b9c1cdc6dfd77162ded60df005182cc0
Analyze and fix the following issue in the Linux kernel code: zram: fix use-after-free in zram_bvec_write_partial()
Problem Details: zram_read_page() picks the sync or async backing device read path based on whether the parent bio is NULL. zram_bvec_write_partial() passes its parent bio down, so for ZRAM_WB slots the read is dispatched asynchronously and zram_read_page() returns 0 while the bio is still in flight. The caller then ...
```diff diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 07111455eecf..e11ee1ed3832 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -2337,7 +2337,7 @@ static int zram_bvec_write_partial(struct zram *zram, struct bio_vec *bvec, if (!page) return -ENO...
5921629dd625a69546692a92e1ca7ae987f03964
Analyze and fix the following issue in the Linux kernel code: tools headers UAPI: sync linux/taskstats.h for procacct.c
Problem Details: After commit 9b93f7e32774 ("tools/getdelays: use the static UAPI headers from tools/include/uapi"), the Makefile was changed to use -I../include/uapi/ instead of -I../../usr/include to ensure tools always use the up-to-date UAPI headers. However, only linux/taskstats.h was added to tools/include/uapi/...
```diff diff --git a/tools/include/uapi/linux/acct.h b/tools/include/uapi/linux/acct.h new file mode 100644 index 000000000000..1e2382ed4fd5 --- /dev/null +++ b/tools/include/uapi/linux/acct.h @@ -0,0 +1,128 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * BSD Process Accounting for Linux - D...
0ade3a8d83a8f5bc274e1ace776c1a26aa7a0308
Analyze and fix the following issue in the Linux kernel code: mm/cma_sysfs: skip inactive CMA areas in sysfs
Problem Details: cma_activate_area() can fail after a CMA area has already been added to cma_areas[]. In that case the area is left in the global array, but it does not reach the point where CMA_ACTIVATED is set. cma_sysfs_init() currently walks all cma_area_count entries and creates sysfs files for every area, inclu...
```diff diff --git a/mm/cma_sysfs.c b/mm/cma_sysfs.c index f52b696bc46d..d5bf792c6245 100644 --- a/mm/cma_sysfs.c +++ b/mm/cma_sysfs.c @@ -117,13 +117,16 @@ static int __init cma_sysfs_init(void) return -ENOMEM; for (i = 0; i < cma_area_count; i++) { + cma = &cma_areas[i]; + if (!test_bit(CMA_ACTIVATED, &cma->...
2e5c6f4fd4001562781e99bbfc7f1f0127187542
Analyze and fix the following issue in the Linux kernel code: ipc/shm: serialize orphan cleanup with shm_nattch updates
Problem Details: shm_destroy_orphaned() walks the shm idr under shm_ids(ns).rwsem, but that does not serialize all fields tested by shm_may_destroy(). In particular, shm_nattch is updated while holding shm_perm.lock, and attach paths can do that without holding the rwsem. Do not decide that an orphaned segment is unu...
```diff diff --git a/ipc/shm.c b/ipc/shm.c index a95dae447707..b3e8a58e177d 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -418,15 +418,17 @@ static int shm_try_destroy_orphaned(int id, void *p, void *data) * We want to destroy segments without users and with already * exit'ed originating process. * - * As shp->* ...
8a7f2bff2165e53595d1e91c160b340f978c0ab7
Analyze and fix the following issue in the Linux kernel code: bpftool: Use libbpf error code for flow dissector query
Problem Details: bpf_prog_query() returns a negative errno on failure. query_flow_dissector() currently closes the namespace fd and then reads errno to decide whether -EINVAL means that the running kernel does not support flow dissector queries. That errno check controls behavior, not just diagnostics: -EINVAL is hand...
```diff diff --git a/tools/bpf/bpftool/net.c b/tools/bpf/bpftool/net.c index 974189da8a91..dba28755d284 100644 --- a/tools/bpf/bpftool/net.c +++ b/tools/bpf/bpftool/net.c @@ -603,14 +603,14 @@ static int query_flow_dissector(struct bpf_attach_info *attach_info) &attach_flags, prog_ids, &prog_cnt); close(fd);...
15384402c94a55b05d06a446aedd19e242367b6f
Analyze and fix the following issue in the Linux kernel code: power: supply: ab8500_fg: Fix typos in comments
Problem Details: Fix spelling mistake in comments: - occured -> occurred (twice) Acked-by: Linus Walleij <linusw@kernel.org> Signed-off-by: Md Shofiqul Islam <shofiqtest@gmail.com> Link: https://patch.msgid.link/20260507191840.25941-1-shofiqtest@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora....
```diff diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c index 9dd99722667a..eb5c1ae68e44 100644 --- a/drivers/power/supply/ab8500_fg.c +++ b/drivers/power/supply/ab8500_fg.c @@ -2037,7 +2037,7 @@ static irqreturn_t ab8500_fg_cc_convend_handler(int irq, void *_di) } /** - * ab8500_fg...
b6c6b9260a92dacef6edef8e93bc2767b86b1dfe
Analyze and fix the following issue in the Linux kernel code: power: supply: bq257xx: Fix VSYSMIN clamping logic
Problem Details: The minimal system voltage (VSYSMIN) is meant to protect the battery from dangerous over-discharge. When the device tree provides a value for the minimum design voltage of the battery, the user should not be allowed to set a lower VSYSMIN, as that would defeat the purpose of this protection. Flip the ...
```diff diff --git a/drivers/power/supply/bq257xx_charger.c b/drivers/power/supply/bq257xx_charger.c index 02c7d8b61e82..7ca4ae610902 100644 --- a/drivers/power/supply/bq257xx_charger.c +++ b/drivers/power/supply/bq257xx_charger.c @@ -128,9 +128,8 @@ static int bq25703_get_min_vsys(struct bq257xx_chg *pdata, int *intva...
40a25d59e85b3c8709ac2424d44f65610467871e
Analyze and fix the following issue in the Linux kernel code: locking/rtmutex: Skip remove_waiter() when waiter is not enqueued
Problem Details: syzbot triggered the following splat in remove_waiter() via FUTEX_CMP_REQUEUE_PI: KASAN: null-ptr-deref in range [0x0000000000000a88-0x0000000000000a8f] class_raw_spinlock_constructor remove_waiter+0x159/0x1200 kernel/locking/rtmutex.c:1561 rt_mutex_start_proxy_lock+0x103/0x120 futex_req...
```diff diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c index 4f386ea6c792..daeeeef973e2 100644 --- a/kernel/locking/rtmutex.c +++ b/kernel/locking/rtmutex.c @@ -1558,6 +1558,9 @@ static void __sched remove_waiter(struct rt_mutex_base *lock, lockdep_assert_held(&lock->wait_lock); + if (!waiter_ta...
d8839941df7de41fd4b02b7b7cdd0c46e5ba501e
Analyze and fix the following issue in the Linux kernel code: KVM: arm64: nv: Restart stage-1 walk if stage-2 desc update fails
Problem Details: kvm_walk_nested_s2() returns -EAGAIN as an indication that an underlying descriptor update fails due to a race. The expectation is that the caller restart translation, yet walk_s1() actually synthesizes an abort. Propagate the -EAGAIN return out of walk_s1(), relying on callers to restart the translat...
```diff diff --git a/arch/arm64/kvm/at.c b/arch/arm64/kvm/at.c index 6cc5892023dd..4d4285e60fce 100644 --- a/arch/arm64/kvm/at.c +++ b/arch/arm64/kvm/at.c @@ -423,6 +423,9 @@ static int walk_s1(struct kvm_vcpu *vcpu, struct s1_walk_info *wi, if (wi->s2) { ret = kvm_walk_nested_s2(vcpu, ipa, &s2_trans); + if ...
699a2cc7f608145d55621e57828ccf6bfcb8d906
Analyze and fix the following issue in the Linux kernel code: KVM: arm64: Restart instruction upon race in __kvm_at_s12()
Problem Details: __kvm_at_s*() are expected to return -EAGAIN if the page table walk raced with a concurrent update to a page table descriptor, which is interpreted as a signal to restart the trapping instruction. While this mostly works, __kvm_at_s12() silently eats the return from __kvm_at_s1e01() and consumes an un...
```diff diff --git a/arch/arm64/kvm/at.c b/arch/arm64/kvm/at.c index 119a603e636e..6cc5892023dd 100644 --- a/arch/arm64/kvm/at.c +++ b/arch/arm64/kvm/at.c @@ -1557,7 +1557,10 @@ int __kvm_at_s12(struct kvm_vcpu *vcpu, u32 op, u64 vaddr) return 0; } - __kvm_at_s1e01(vcpu, op, vaddr); + ret = __kvm_at_s1e01(vcpu, ...
efa871f4a2517385295de2e3f786e4ae4ffa6e77
Analyze and fix the following issue in the Linux kernel code: KVM: arm64: nv: Inject SEA TTW when desc update can't write to GPA
Problem Details: Similar to the handling of descriptor reads, inject an SEA during TTW when the descriptor access fails for reasons other than a race, such as a read-only memslot or a bad HVA. Fixes: bff8aa213dee ("KVM: arm64: Implement HW access flag management in stage-1 SW PTW") Fixes: e4c7dfac2f1a ("KVM: arm64: nv...
```diff diff --git a/arch/arm64/kvm/at.c b/arch/arm64/kvm/at.c index 9f8f0ae8e86e..119a603e636e 100644 --- a/arch/arm64/kvm/at.c +++ b/arch/arm64/kvm/at.c @@ -521,8 +521,12 @@ static int walk_s1(struct kvm_vcpu *vcpu, struct s1_walk_info *wi, } ret = kvm_swap_s1_desc(vcpu, ipa, desc, new_desc, wi); - if (ret) ...
5949004d7032767e8fde1e8c986a33f241b2a192
Analyze and fix the following issue in the Linux kernel code: KVM: arm64: nv: Fully update VNCR fixmap state in kvm_translate_vncr()
Problem Details: kvm_translate_vncr() first invalidates the pseudo-TLB entry and corresponding fixmap in anticipation of installing a new translation. While the fixmap invalidation does clear the mapping from host stage-1, it does not clear the L1_VNCR_MAPPED flag. Depending on the state of the VNCR TLB at vcpu_put(),...
```diff diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c index 4fa82e96454d..d0545144eaac 100644 --- a/arch/arm64/kvm/nested.c +++ b/arch/arm64/kvm/nested.c @@ -797,18 +797,24 @@ void kvm_vcpu_load_hw_mmu(struct kvm_vcpu *vcpu) } } +static void this_cpu_reset_vncr_fixmap(struct kvm_vcpu *vcpu) +{ + i...
9f76b039a72d7e06374aa96862f0232ed53f7787
Analyze and fix the following issue in the Linux kernel code: KVM: arm64: Don't leak PFN when kvm_translate_vncr() races MMU notifier
Problem Details: In the case that kvm_translate_vncr() races with an MMU notifier the early return does not release a reference on the faulted in PFN. Add the necessary call to kvm_release_faultin_page() for the unused PFN. Cc: stable@vger.kernel.org Fixes: 069a05e535496 ("KVM: arm64: nv: Handle VNCR_EL2-triggered fau...
```diff diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c index 883b6c1008fb..4fa82e96454d 100644 --- a/arch/arm64/kvm/nested.c +++ b/arch/arm64/kvm/nested.c @@ -1326,8 +1326,10 @@ static int kvm_translate_vncr(struct kvm_vcpu *vcpu, bool *is_gmem) } scoped_guard(write_lock, &vcpu->kvm->mmu_lock) { -...
a62b4226ae47202eb00306b576859131c4c7196e
Analyze and fix the following issue in the Linux kernel code: arm64: cpufeature: Expose ID_AA64ISAR2_EL1.ATS1A to KVM
Problem Details: KVM needs to know if the HW implements FEAT_ATS1A in order to correctly sanitise HFGITR_EL2.ATS1E1A, which otherwise defaults to RES0 and AT S1E1A traps are handled as UNDEF. Solves this by exposing ID_AA64ISAR2_EL1.ATS1A to the rest of the kernel. Fixes: ff987ffc0c18c ("KVM: arm64: nv: Add support f...
```diff diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 6d53bb15cf7b..62b0d77217ee 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -266,6 +266,7 @@ static const struct arm64_ftr_bits ftr_id_aa64isar1[] = { }; static const struct arm64_ftr_bits f...
f41b481548cc263112b6da4a3b4869fcd35b4e45
Analyze and fix the following issue in the Linux kernel code: KVM: arm64: Wire AT S1E1A in the system instruction handling table
Problem Details: Despite having handling code for AT S1E1A, the instruction was never plugged into the system instruction table, leading to an exception being injected in the guest. If the guest is Linux and using the __kvm_at() helper, the exception is actually handled in the helper, and KVM continues more or less si...
```diff diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 148fc3400ea8..753fe30d322c 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -4217,6 +4217,7 @@ static struct sys_reg_desc sys_insn_descs[] = { SYS_INSN(AT_S1E0W, handle_at_s1e01), SYS_INSN(AT_S1E1RP, handle_at_...
978cd6b2ad036168712aad8fca213385a5b15e2d
Analyze and fix the following issue in the Linux kernel code: KVM: arm64: Key CPTR_EL2.E0POE propagation on FEAT_S1POE
Problem Details: We propagate CPTR_EL2.E0POE from a L1 into the L0 configuration, but we key this on the L1 guest supporting FEAT_S2POE. This is obviously wrong, as this bit is solely concerned with Stage-1 translation. Fix this by making the update depend on FEAT_S1POE. Fixes: cd931bd6093cb ("KVM: arm64: nv: Add add...
```diff diff --git a/arch/arm64/kvm/hyp/include/hyp/switch.h b/arch/arm64/kvm/hyp/include/hyp/switch.h index 98b2976837b1..4d814ae90613 100644 --- a/arch/arm64/kvm/hyp/include/hyp/switch.h +++ b/arch/arm64/kvm/hyp/include/hyp/switch.h @@ -141,7 +141,7 @@ static inline void __activate_cptr_traps_vhe(struct kvm_vcpu *vcp...
a2c14ff63e0e02e3c832385e523e9cc81301171c
Analyze and fix the following issue in the Linux kernel code: power: supply: cpcap-battery: Fix missing nvmem_device_put() causing reference leak
Problem Details: In cpcap_battery_detect_battery_type(), the reference to an nvmem device obtained via nvmem_device_find() is not released with nvmem_device_put() on the success or read-failure paths, causing a permanent reference leak. The driver’s retry logic on subsequent battery property reads can compound this lea...
```diff diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c index 7b7bdce3162f..59c741993ef8 100644 --- a/drivers/power/supply/cpcap-battery.c +++ b/drivers/power/supply/cpcap-battery.c @@ -439,10 +439,13 @@ static void cpcap_battery_detect_battery_type(struct cpcap_battery_ddata *d...
68d234144b7dffd1f50b07ba74d0d6e833ef43a4
Analyze and fix the following issue in the Linux kernel code: power: supply: max17042: fix OF node reference imbalance
Problem Details: The driver reuses the OF node of the parent multi-function device but fails to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices. Fix this by using the intended helper for reusing OF nodes. Fixes: 0cd4f1f77ad4 ("power...
```diff diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c index abd276e13475..024fa38888f6 100644 --- a/drivers/power/supply/max17042_battery.c +++ b/drivers/power/supply/max17042_battery.c @@ -1288,7 +1288,8 @@ static int max17042_platform_probe(struct platform_device *pdev...
8eec545cde69e46e9a1d2b7d915ce4f5df85b3bd
Analyze and fix the following issue in the Linux kernel code: power: reset: linkstation-poweroff: fix use-after-free in the linkstation_poweroff_init()
Problem Details: Move of_node_put(dn) after the of_match_node() call, which still needs the node pointer. The node reference is correctly released after use. Fixes: e2f471efe1d6 ("power: reset: linkstation-poweroff: prepare for new devices") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Li...
```diff diff --git a/drivers/power/reset/linkstation-poweroff.c b/drivers/power/reset/linkstation-poweroff.c index 02f5fdb8ffc4..e56d75bfcc43 100644 --- a/drivers/power/reset/linkstation-poweroff.c +++ b/drivers/power/reset/linkstation-poweroff.c @@ -163,10 +163,10 @@ static int __init linkstation_poweroff_init(void) ...
0ff9718c266f9eb334674377501ccf37d8d351a4
Analyze and fix the following issue in the Linux kernel code: perf env: Add mutex to protect lazy environment initialization
Problem Details: Introduce a mutex to 'struct perf_env' to safely protect lazy metadata setup, such as os_release or e_machine resolution, preventing concurrent initialization data races and memory leaks during multi-threaded profiling or symbol loading. Signed-off-by: Ian Rogers <irogers@google.com> Acked-by: Namhyun...
```diff diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c index 28c54c58193e..03d90a45992c 100644 --- a/tools/perf/util/env.c +++ b/tools/perf/util/env.c @@ -250,6 +250,8 @@ void perf_env__exit(struct perf_env *env) { int i, j; + mutex_destroy(&env->lock); + perf_env__purge_bpf(env); perf_env__purge_c...
5936245125f78d896fdb1bbc2ae79213e28a6579
Analyze and fix the following issue in the Linux kernel code: perf/arm-cmn: Fix DVM node events
Problem Details: The new DVM node events added in CMN-700 also apply to CMN S3; fix the model encoding so that we can expose the aliases and handle occupancy filtering on newer CMNs too. Cc: stable@vger.kernel.org Fixes: 0dc2f4963f7e ("perf/arm-cmn: Support CMN S3") Signed-off-by: Robin Murphy <robin.murphy@arm.com> S...
```diff diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c index f5305c8fdca4..6e5cc4086a9e 100644 --- a/drivers/perf/arm-cmn.c +++ b/drivers/perf/arm-cmn.c @@ -197,13 +197,14 @@ enum cmn_model { CMN600 = 1, CMN650 = 2, - CMN700 = 4, - CI700 = 8, + CI700 = 4, + CMN700 = 8, CMNS3 = 16, /* ...and then ...
c4e16f0543ff5df76e221141ab8e7430792bf841
Analyze and fix the following issue in the Linux kernel code: perf print_insn: Use e_machine for fallback IP length check
Problem Details: Avoid string comparisons with perf_env arch, switch to using the more precise ELF machine. Sort header files and fix missing definitions. Signed-off-by: Ian Rogers <irogers@google.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Alexander Gordeev <agordeev@linux.ibm.com> Cc: Heiko Carstens <hca@...
```diff diff --git a/tools/perf/util/print_insn.c b/tools/perf/util/print_insn.c index 02e6fbb8ca04..4068436f26ea 100644 --- a/tools/perf/util/print_insn.c +++ b/tools/perf/util/print_insn.c @@ -4,19 +4,24 @@ * * Author(s): Changbin Du <changbin.du@huawei.com> */ +#include "print_insn.h" + #include <inttypes.h> ...
fa06520fa0aae5a8e7386c1d6b622c4d8b6a400d
Analyze and fix the following issue in the Linux kernel code: perf timechart: Fix cat_backtrace() use-after-free on corrupted callchain
Problem Details: cat_backtrace() uses open_memstream() to build a backtrace string. When an invalid callchain context is encountered, zfree(&p) frees the memstream buffer, then the exit path calls fclose(f), which flushes to the already-freed buffer — a use-after-free. The function then returns a dangling pointer that...
```diff diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 071987241a52..85a9ad0455ae 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c @@ -489,6 +489,10 @@ static void sched_switch(struct timechart *tchart, int cpu, u64 timestamp, } } +/* + * Returns ...
4cd74dee09d4b06f0e80826bf9d472d5aa42caaf
Analyze and fix the following issue in the Linux kernel code: perf timechart: Include file offset in CPU bounds check messages
Problem Details: Add the perf.data file offset to the out-of-bounds CPU debug messages in process_sample_cpu_idle(), process_sample_cpu_frequency(), process_sample_sched_wakeup(), and process_sample_sched_switch(). Reviewed-by: Ian Rogers <irogers@google.com> Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo ...
```diff diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 630756bebe32..071987241a52 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c @@ -605,8 +605,10 @@ process_sample_cpu_idle(struct timechart *tchart __maybe_unused, u32 state = perf_sample__intval(...
d38bee6d8082c23635faa5473162291d228ca96e
Analyze and fix the following issue in the Linux kernel code: perf sched: Include file offset in event skip messages
Problem Details: Add the perf.data file offset to the CPU out-of-bounds and machine__resolve failure messages emitted when samples are skipped in process_sched_switch_event(), process_sched_runtime_event(), and timehist_sched_change_event(). Also switch event type from raw integer to perf_event__name() string for read...
```diff diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 812a1b0d56d6..9ec8e049e19b 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -1792,8 +1792,10 @@ static int process_sched_switch_event(const struct perf_tool *tool, u32 prev_pid = perf_sample__intval(sample, "...
0a733cd247eb9bda928049d72ab7ae16b9bff353
Analyze and fix the following issue in the Linux kernel code: power: supply: max17042_battery: Use Current register in get_status
Problem Details: It can take a while for AvgCurrent to adjust after (un)plugging the charger. Use the instantaneous value in order to not confuse the userspace. While at that, don't do unit conversion of the read value. The current code was prone to overflows and we only care about the sign anyway. Signed-off-by: Seb...
```diff diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c index 103ce1d47aa8..e896cd169a91 100644 --- a/drivers/power/supply/max17042_battery.c +++ b/drivers/power/supply/max17042_battery.c @@ -121,7 +121,7 @@ static int max17042_get_temperature(struct max17042_chip *chip, i...
ec4c462e2d8161b32038e21e7187f4a15fe1661d
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: Fix incorrect VRAM GART mappings on non-4K page size systems
Problem Details: When mapping VRAM pages into the GART page table, amdgpu_gart_map_vram_range() assumes that the system page size is the same as the GPU page size. On systems with non-4K page sizes, multiple GPU pages can exist within a single CPU page. As a result, the mappings are created incorrectly because fewer p...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c index b6f849d51c2e..c4c21dbbbdbf 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c @@ -394,7 +394,8 @@ void amdgpu_gart_map_vram_range(struct amdgpu_device *adev, u...
352ea59028ea48a6fff77f19ae28f98f71946a80
Analyze and fix the following issue in the Linux kernel code: drm/amdkfd: Fix buffer overflow in SDMA queue checkpoint/restore on GFX11
Problem Details: The v11 MQD manager incorrectly assigned the CP-compute variants of checkpoint_mqd/restore_mqd for KFD_MQD_TYPE_SDMA queues. These functions use sizeof(struct v11_compute_mqd) (2048 bytes) instead of sizeof(struct v11_sdma_mqd) (512 bytes), causing a 1536-byte overflow. During CRIU checkpoint of an SD...
```diff diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c index a1e3cf2384dd..527c531676e4 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c @@ -320,8 +320,7 @@ static void checkpoint_mqd(st...
2bd550b547deabef98bd3b017ff743b7c34d3a6d
Analyze and fix the following issue in the Linux kernel code: drm/amdkfd: fix NULL dereference in get_queue_ids()
Problem Details: When usr_queue_id_array is NULL and num_queues is non-zero, get_queue_ids() returns NULL. The callers check only IS_ERR() on the return value; since IS_ERR(NULL) == false the check passes, and suspend_queues() calls q_array_invalidate() which immediately dereferences NULL while iterating num_queues tim...
```diff diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index 0a408f95baac..31187ddbb79e 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -3315,7 +3315,7 @@ static ...
e47b0056a08dc70430ffc44bbf62197e7d1ff8ea
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: set noretry=1 as default for GFX 10.1.x (Navi10/12/14)
Problem Details: Problem: While developing the amd_close_race IGT test (which intentionally triggers execute permission faults by removing VM_PAGE_EXECUTABLE from GPU page table entries), we discovered that on Navi10 (GFX 10.1.x) these faults produce zero diagnostic output. The GPU simply hangs silently for ~10s until ...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c index 13a5acdf8da3..c076c5f06e77 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c @@ -1003,7 +1003,7 @@ void amdgpu_gmc_noretry_set(struct amdgpu_device *adev) gc...
58bafc666c484b21839a2d27e923ae1b2727a1df
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: fix waiting for all submissions for userptrs
Problem Details: Wait for all submissions when userptrs need to be invalidated by the MMU notifier, not just the one the userptr was involved into. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Vitaly Prosyak <vitaly.prosyak@amd.com> Tested-by: Vitaly Prosyak <vitaly.prosyak@amd.com> Reviewed-...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c index 5bfa5a84b09c..e452444b33b0 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c @@ -67,6 +67,7 @@ static bool amdgpu_hmm_invalidate_gfx(struct mmu_interval_notifier ...
bb204f19e4a115f094a6a3c4d82fcf48862d0766
Analyze and fix the following issue in the Linux kernel code: drm/amd/pm: fix smu13 power limit default/cap calculation
Problem Details: smu_v13_0_0_get_power_limit() and smu_v13_0_7_get_power_limit() mix runtime power_limit with PP table limits when reporting default/min/max. When current power limit query succeeds, default_power_limit was set to the runtime value instead of the PP table default, and min/max could be derived from inco...
```diff diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c index fa861ec4d700..7f8d4bb47d02 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c @@ -2390,28 +2390,30 @@ static in...
a40412285ec17a69ed728675a56b7ad479c86e36
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: Align amdgpu_gtt_mgr entries to TLB size on all SI
Problem Details: It seems that Pitcairn has the same issues as Tahiti with regards to the TLB size. This commit fixes a VCE1 FW validation timeout on suspend/resume on Pitcairn. Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/5336 Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Signed-off-by: Alex D...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c index a5d26b943f6d..d23a91d029aa 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c @@ -203,7 +203,7 @@ int amdgpu_gtt_mgr_alloc_entries(struct amdgpu_gt...
1a4a55f181a9584386701f9b4183d9ecc5271b21
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu/sdma7.1: fix support for disable_kq
Problem Details: Set the flag in the ring structure. Fixes: 80d4d3a45b86 ("drm/amdgpu/sdma7.1: add support for disable_kq") Reviewed-by: Kent Russell <kent.russell@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit e0a3aa8a6750e8cf067fe2146dc618ffd296d5ef)
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c b/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c index 061934a2e93a..9c9bbe043a47 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c @@ -1316,6 +1316,7 @@ static int sdma_v7_1_sw_init(struct amdgpu_ip_block *ip_block) r...
62c1671f6454ceaa80e9ceff63f821aa36f35154
Analyze and fix the following issue in the Linux kernel code: accel/amdxdna: Return errors for failed debug BO commands
Problem Details: The config and sync debug BO commands currently may report success even when the operation fails. Capture the firmware return status and propagate the corresponding error to userspace. Fixes: 7ea046838021 ("accel/amdxdna: Support firmware debug buffer") Reviewed-by: Mario Limonciello (AMD) <superm1@k...
```diff diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c index 2ad343728782..da89b3701f5b 100644 --- a/drivers/accel/amdxdna/aie2_ctx.c +++ b/drivers/accel/amdxdna/aie2_ctx.c @@ -305,17 +305,13 @@ aie2_sched_drvcmd_resp_handler(void *handle, void __iomem *data, size_t size) struct amdx...
181eda5549c5d9fad3fdb88b050fbf0844d884f8
Analyze and fix the following issue in the Linux kernel code: drm/amdkfd: fix UAF race in destroy_queue_cpsch
Problem Details: wait_on_destroy_queue() drops locks to wait for queue resume, allowing a concurrent destroy to free the queue. Use is_being_destroyed flag to serialize destruction. Reviewed-by: Amir Shetaia <Amir.Shetaia@amd.com> Signed-off-by: Alysa Liu <Alysa.Liu@amd.com> Signed-off-by: Alex Deucher <alexander.deuc...
```diff diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index 0d7296c739ed..0a408f95baac 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -2502,6 +2502,9 @@ static ...
5d12ef71fbfd3b46c1319074e50f814215ae7f3b
Analyze and fix the following issue in the Linux kernel code: accel/amdxdna: Remove drv_cmd tracing from job free callback
Problem Details: aie2_sched_job_free() accesses job->drv_cmd for tracing purposes. However, job->drv_cmd is owned by the caller and may already have been freed when the job free callback runs, leading to a potential use-after-free. Remove the job->drv_cmd access from aie2_sched_job_free(). Fixes: 8711eb2dde2e ("accel...
```diff diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c index 658a5fb1fda6..2ad343728782 100644 --- a/drivers/accel/amdxdna/aie2_ctx.c +++ b/drivers/accel/amdxdna/aie2_ctx.c @@ -437,8 +437,9 @@ static void aie2_sched_job_free(struct drm_sched_job *sched_job) struct amdxdna_sched_job *...
ff287df16a1a58aca78b08d1f3ee09fc44da0351
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Bound VBIOS record-chain walk loops
Problem Details: [Why & How] All record-chain walk loops in bios_parser.c and bios_parser2.c use for(;;) and only terminate on a 0xFF record_type sentinel or zero record_size. A malformed VBIOS image missing the terminator record causes unbounded iteration at probe time, potentially hundreds of thousands of iterations ...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c index c307f42fe0b9..507b628abdb5 100644 --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c @@ -222,6 +222,7 @@ static enum bp_result bio...
f0f3981c43b32cadfe373d636d9e9ca522bb3702
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Clamp HDMI HDCP2 rx_id_list read to buffer size
Problem Details: [Why & How] During HDCP 2.x repeater authentication over HDMI, the driver reads the sink's RxStatus register and extracts a 10-bit message size field (max value 1023). This value is used as the read length for the ReceiverID list without being clamped to the size of the destination buffer rx_id_list[17...
```diff diff --git a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c index 0ca39873f807..324413a090bf 100644 --- a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c +++ b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c @@ -529,7 +529,8 @@ enum mod_hdcp_sta...
49c3da65961fe9857c831d47fa1989084e87514a
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Reject gpio_bitshift >= 32 in bios_parser_get_gpio_pin_info()
Problem Details: [Why & How] gpio_bitshift is a uint8_t read directly from the VBIOS GPIO pin table. If the value is >= 32, the expression "1 << gpio_bitshift" triggers undefined behaviour in C (shift count exceeds type width). On x86 the shift is silently masked to 5 bits, producing an incorrect GPIO mask that may cau...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c index e8d8947c552e..4f213ea865b8 100644 --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c @@ -701,8 +701,10 @@ static enum bp_resul...
da48bc4461b8a5ebfb9264c9b191a701d8e99009
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Use krealloc_array() in dal_vector_reserve()
Problem Details: [Why & How] dal_vector_reserve() computes the allocation size as "capacity * vector->struct_size" using uint32_t arithmetic, which can silently wrap to a small value on overflow. This would cause krealloc to return a smaller buffer than expected, leading to heap overflows on subsequent vector appends. ...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/basics/vector.c b/drivers/gpu/drm/amd/display/dc/basics/vector.c index e8736c134b8d..60bd9ead928a 100644 --- a/drivers/gpu/drm/amd/display/dc/basics/vector.c +++ b/drivers/gpu/drm/amd/display/dc/basics/vector.c @@ -289,8 +289,8 @@ bool dal_vector_reserve(struct vector...
adf67034b1f61f7119295208085bfd43f85f56af
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Fix NULL deref and buffer over-read in SDP debugfs
Problem Details: [Why & How] dp_sdp_message_debugfs_write() dereferences connector->base.state->crtc without checking for NULL. A connector can be connected but not bound to any CRTC (e.g. after hot-plug before the next atomic commit), causing a kernel crash when writing to the sdp_message debugfs node. The function a...
```diff diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c index 2409ac72b166..3a3d01ce0d42 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c @@ -1344,8 +1...
fb0707ce00eef4e2d60c3020e1c0432739703e4a
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Clamp VBIOS HDMI retimer register count to array size
Problem Details: [Why & How] The VBIOS integrated info tables (v1_11 and v2_1) contain HdmiRegNum and Hdmi6GRegNum fields that are used as loop bounds when copying retimer I2C register settings into fixed-size arrays (dp*_ext_hdmi_reg_settings[9] and dp*_ext_hdmi_6g_reg_settings[3]). These u8 fields are not validated b...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c index c51c4b2c6fae..e8d8947c552e 100644 --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c @@ -2600,14 +2600,16 @@ static enum bp_re...
e8b4d37eba05141ee01794fc6b7f2da808cee83b
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Fix out-of-bounds read in dp_get_eq_aux_rd_interval()
Problem Details: [Why & How] The aux_rd_interval array in struct dc_lttpr_caps is declared with MAX_REPEATER_CNT - 1 (7) elements, indexed 0..6. However, the offset parameter passed to dp_get_eq_aux_rd_interval() can be as large as MAX_REPEATER_CNT (8) when a sink reports 8 LTTPR repeaters via DPCD. This leads to an ou...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/dc_dp_types.h b/drivers/gpu/drm/amd/display/dc/dc_dp_types.h index 7fa336bf1115..7dd73eaaf940 100644 --- a/drivers/gpu/drm/amd/display/dc/dc_dp_types.h +++ b/drivers/gpu/drm/amd/display/dc/dc_dp_types.h @@ -1217,7 +1217,7 @@ struct dc_lttpr_caps { union dp_main_link...
bad4e98893afdfe0b1a03433d3af53972bafc67c
Analyze and fix the following issue in the Linux kernel code: RDMA: Update the query_device() op
Problem Details: This op hasn't followed the normal pattern of passing NULL for udata when invoked by the kernel. Instead the kernel caller creates a dummy ib_udata on the stack and passes that in. It does not seem to currently be a bug, but this flow should be modernized to use the new API flow and in the process acce...
```diff diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 21ada0fe9059..b8193e077a74 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -1246,7 +1246,6 @@ out: */ static int setup_device(struct ib_device *device) { - struct ib_udata uhw = {.o...
43b57d73ebbe5e7964a8b3ee3ffde0948fae6e2e
Analyze and fix the following issue in the Linux kernel code: RDMA/core: Don't make a dummy ib_udata on the stack in create_qp
Problem Details: Sashiko points out the udata for destruction has to be created using uverbs_get_cleared_udata(). Move it to ib_core_uverbs.c so that the core qp code can call it. Rework the call chain to pass the struct uverbs_attr_bundle right up to the driver op callback. Fixes a possible wild stack reference in dr...
```diff diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h index a2c36666e6fc..19104c542b27 100644 --- a/drivers/infiniband/core/core_priv.h +++ b/drivers/infiniband/core/core_priv.h @@ -321,7 +321,7 @@ void nldev_exit(void); struct ib_qp *ib_create_qp_user(struct ib_device *dev, ...
b548a6c4eee5c428663f3944e173e6c92e2e8d6f
Analyze and fix the following issue in the Linux kernel code: RDMA/irdma: Fix typo in SQ completions generation
Problem Details: When we generate completion for SQ the opcode while being properly read from ring buffer is ignored when written back to completion. Seems to be a simple typo. Link: https://patch.msgid.link/r/ahjB87k54bYdFbft@grain Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Reviewed-by: Jacob Moroni <jmoroni...
```diff diff --git a/drivers/infiniband/hw/irdma/utils.c b/drivers/infiniband/hw/irdma/utils.c index 495e5daff4b4..7cc7b107db3c 100644 --- a/drivers/infiniband/hw/irdma/utils.c +++ b/drivers/infiniband/hw/irdma/utils.c @@ -2442,7 +2442,7 @@ void irdma_generate_flush_completions(struct irdma_qp *iwqp) cmpl->cpi.wr_i...
a8f0bc22388f74e0cf4ed8b7d1846c580eaf44cc
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: Fix incorrect VRAM GART mappings on non-4K page size systems
Problem Details: When mapping VRAM pages into the GART page table, amdgpu_gart_map_vram_range() assumes that the system page size is the same as the GPU page size. On systems with non-4K page sizes, multiple GPU pages can exist within a single CPU page. As a result, the mappings are created incorrectly because fewer p...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c index b6f849d51c2e..c4c21dbbbdbf 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c @@ -394,7 +394,8 @@ void amdgpu_gart_map_vram_range(struct amdgpu_device *adev, u...
cd0e76a2f60e158534fddd0052e0ea8a6d50f247
Analyze and fix the following issue in the Linux kernel code: amd/amdkfd: Fix profiler lock init order
Problem Details: A call chain at driver probe exists where profiler lock is used before it is initialized: [ 12.131440] kfd kfd: Allocated 3969056 bytes on gart [ 12.131561] kfd kfd: Total number of KFD nodes to be created: 1 [ 12.132691] ------------[ cut here ]------------ [ 12.132703] DEBUG_LOCKS_WARN_ON(lo...
```diff diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c index f48eb0f739af..5eb863dec8f4 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c @@ -739,6 +739,9 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, int partition_mod...
baa286df5fb366e4aee5b747443dfc7194fdaa59
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: set sub_block_index for mca ras sub-blocks
Problem Details: The mca ras sub-blocks (mp0, mp1, mpio) all share the AMDGPU_RAS_BLOCK__MCA block id and are distinguished only by sub_block_index. The ras manager object for an mca block is selected with: con->objs[AMDGPU_RAS_BLOCK__LAST + head->sub_block_index] Since the rework in commit 7f544c5488cf ("drm/amdgpu...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c index 823ba17e32af..cc6d1a4e4c3a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c @@ -99,6 +99,7 @@ int amdgpu_mca_mp0_ras_sw_init(struct amdgpu_device *adev) strc...
33425e49719f827289c0e11942cecdf31679f85d
Analyze and fix the following issue in the Linux kernel code: drm/amd/ras: chunk UNIRAS CPER debugfs reads
Problem Details: Legacy CPER ring readers can issue one debugfs read with a buffer larger than the UNIRAS RAS command payload limit. Passing that full size to GET_CPER_RECORD makes the command reject the request, so userspace may only see the ring prefix and treat the CPER stream as empty. Commit 3c88fb7aa57d ("drm/am...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c index 7e496607de1a..b97fa35bac23 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c @@ -501,6 +501,8 @@ static ssize_t amdgpu_ras_cper_debugfs_read(struct file *f, c...
323c98a4ff06aa28114f2bf658fb43eb3b536bbc
Analyze and fix the following issue in the Linux kernel code: RDMA/core: Validate cpu_id against nr_cpu_ids in DMAH alloc
Problem Details: The cpu_id attribute supplied by user space through UVERBS_ATTR_ALLOC_DMAH_CPU_ID is passed directly to cpumask_test_cpu() without first verifying that the value is within the valid CPU range. Passing such untrusted data to cpumask_test_cpu() may lead to an out-of-bounds read of the underlying cpumask...
```diff diff --git a/drivers/infiniband/core/uverbs_std_types_dmah.c b/drivers/infiniband/core/uverbs_std_types_dmah.c index 453ce656c6f2..97101e093826 100644 --- a/drivers/infiniband/core/uverbs_std_types_dmah.c +++ b/drivers/infiniband/core/uverbs_std_types_dmah.c @@ -47,6 +47,11 @@ static int UVERBS_HANDLER(UVERBS_M...
c21487ce5fa112b6faef271e4a97c5e4a8d7194c
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: Adjust _PR3 detection
Problem Details: _PR3 detection was changed in commit 134b8c5d8674 ("drm/amd: Fix detection of _PR3 on the PCIe root port") to look at the root port of the topology containing the GPU. This however was too far because it ignored whether or not all the intermediary bridges could power off the device. The original desi...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index e9a88343389c..d2d70c4b2ac5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -2028,7 +2028,7 @@ static int amdgpu_device_ip_early_init(struct amdgp...
6fa41db7ffdec97d62433adf03b7b9b759af8c2c
Analyze and fix the following issue in the Linux kernel code: drm/amdkfd: Fix buffer overflow in SDMA queue checkpoint/restore on GFX11
Problem Details: The v11 MQD manager incorrectly assigned the CP-compute variants of checkpoint_mqd/restore_mqd for KFD_MQD_TYPE_SDMA queues. These functions use sizeof(struct v11_compute_mqd) (2048 bytes) instead of sizeof(struct v11_sdma_mqd) (512 bytes), causing a 1536-byte overflow. During CRIU checkpoint of an SD...
```diff diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c index 7568e7ed5244..fff137e00b5e 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c @@ -330,8 +330,7 @@ static void checkpoint_mqd(st...
f165a82cdf503884bb1797771c61b2fcc72113d4
Analyze and fix the following issue in the Linux kernel code: drm/amdkfd: fix NULL dereference in get_queue_ids()
Problem Details: When usr_queue_id_array is NULL and num_queues is non-zero, get_queue_ids() returns NULL. The callers check only IS_ERR() on the return value; since IS_ERR(NULL) == false the check passes, and suspend_queues() calls q_array_invalidate() which immediately dereferences NULL while iterating num_queues tim...
```diff diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index c6a2b952303a..5150511cefc5 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -3484,7 +3484,7 @@ static ...
5726af470517cab93851b0ee7e9ea9a8259a6455
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: widen FRL debug knobs to unsigned int
Problem Details: force_frl_rate, select_ffe and limit_ffe in dc_debug_options carry non-negative configuration values: an FRL link-rate enum (0..0xF), an FFE level selector and an FFE level limit. They are only ever compared against 0/0xF, assigned, or cast to uint8_t before being written to hardware. No call site reli...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h index c6db021a61b0..82d02ebbd829 100644 --- a/drivers/gpu/drm/amd/display/dc/dc.h +++ b/drivers/gpu/drm/amd/display/dc/dc.h @@ -1155,10 +1155,10 @@ struct dc_debug_options { bool force_vrr; bool force_fva; int max_frl_r...
eb21edd24c40d81066753f8ac6f23bce15745395
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: set noretry=1 as default for GFX 10.1.x (Navi10/12/14)
Problem Details: Problem: While developing the amd_close_race IGT test (which intentionally triggers execute permission faults by removing VM_PAGE_EXECUTABLE from GPU page table entries), we discovered that on Navi10 (GFX 10.1.x) these faults produce zero diagnostic output. The GPU simply hangs silently for ~10s until ...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c index 821dca9ee18c..5f7745143f56 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c @@ -1015,7 +1015,7 @@ void amdgpu_gmc_noretry_set(struct amdgpu_device *adev) gc...
91250893cbaa25c86872deca95a540d08de1f91e
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: fix waiting for all submissions for userptrs
Problem Details: Wait for all submissions when userptrs need to be invalidated by the MMU notifier, not just the one the userptr was involved into. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Vitaly Prosyak <vitaly.prosyak@amd.com> Tested-by: Vitaly Prosyak <vitaly.prosyak@amd.com> Reviewed-...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c index 5bfa5a84b09c..e452444b33b0 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c @@ -67,6 +67,7 @@ static bool amdgpu_hmm_invalidate_gfx(struct mmu_interval_notifier ...
1eaf26db95901ca70737503a89b831dd763c8453
Analyze and fix the following issue in the Linux kernel code: drm/amd/pm: fix smu13 power limit default/cap calculation
Problem Details: smu_v13_0_0_get_power_limit() and smu_v13_0_7_get_power_limit() mix runtime power_limit with PP table limits when reporting default/min/max. When current power limit query succeeds, default_power_limit was set to the runtime value instead of the PP table default, and min/max could be derived from inco...
```diff diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c index fa861ec4d700..7f8d4bb47d02 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c @@ -2390,28 +2390,30 @@ static in...
05465e2a13f138258a0c77116fd8fd9f2f41952e
Analyze and fix the following issue in the Linux kernel code: drm/amd/pm: use kcalloc in phm table copy helpers
Problem Details: Use kcalloc() so multiplication overflow is detected and allocation fails safely for phm table copy helpers. Signed-off-by: Candice Li <candice.li@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
```diff diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c index 30d83e18db40..085b100821b9 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c @@ -49,11 +49,10 @@ int phm_copy_cloc...
a4b0c3f5d2287997876d8f711a40d3c0418458d8
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu/pm: fix SmartShift bias sysfs store PM refcount on parse error
Problem Details: Return the parse error before acquiring PM access. Signed-off-by: Candice Li <candice.li@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
```diff diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c index ffb03c51a414..52e5cbcac352 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c @@ -1886,12 +1886,12 @@ static ssize_t amdgpu_set_smartshift_bias(struct device *dev, { struct drm_dev...
f193e71fa9fab2e68ef85201b106e8f580d3a25b
Analyze and fix the following issue in the Linux kernel code: drm/amd/pm: bound pp_dpm_set_pp_table() memcpy
Problem Details: The powerplay path allocates hardcode_pp_table once with kmemdup(..., soft_pp_table_size). memcpy(..., size) used the sysfs store count (up to PAGE_SIZE) with no upper bound, causing heap overflow. Reject writes where size exceeds soft_pp_table_size. Signed-off-by: Asad Kamal <asad.kamal@amd.com> Revi...
```diff diff --git a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c index 5700bcc7ad9a..6f5c27bdc1e9 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +++ b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c @@ -665,6 +665,9 @@ static int pp_dpm_set_pp_tabl...
2064610469c5f7f5d665034ddd4c4365dff65f58
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: fix duplicated buffer allocation for concurrent
Problem Details: In case of concurrent calling to the bin file writing, use the mutex to avoid allocating the temporary buffer more than once. Signed-off-by: Shiwu Zhang <shiwu.zhang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index e3210ce17183..96e1b72b9e1c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -4651,14 +4651,17 @@ static ssize_t amdgpu_psp_vbflash_write(struct file *filp, st...
6229898d46c0cbc238a6fe9f11c1ea12cf8bb9c5
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: fix buffer overflow during vBIOS update
Problem Details: Clamp the buffer postion to write by setting the bin attribute to the maximum buffer size so that VFS layer will block the out-of-bounds accessing. Signed-off-by: Shiwu Zhang <shiwu.zhang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd....
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index 665a2632379d..e3210ce17183 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -4723,7 +4723,7 @@ rel_buf: */ static const struct bin_attribute psp_vbflash_bi...
220e2e3b9634f21633993b14b340be1c54387a4d
Analyze and fix the following issue in the Linux kernel code: drm/amd/pm: Reject negative values in thermal_throttling_logging
Problem Details: Discovery: Fuzzing for secure supply chain requirements Tool: amd_fuzzing_sysfs (IGT test) The thermal_throttling_logging sysfs store function accepts negative values like -1 and -9999999, which are nonsensical for a logging interval. Current behavior: - Values <= 0 disable logging (intended for 0 on...
```diff diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c index a0250431ad11..ffb03c51a414 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c @@ -1634,6 +1634,10 @@ static ssize_t amdgpu_set_thermal_throttling_logging(struct device *dev, if (ret...
c872fc05380c4eb2761ab289ce6a215c9bfa9576
Analyze and fix the following issue in the Linux kernel code: drm/amd/pm: Add empty string validation to sysfs store functions
Problem Details: Discovery: Fuzzing for secure supply chain requirements Tool: amd_fuzzing_sysfs (IGT test) The AMDGPU power management sysfs store functions accept whitespace-only strings when they should reject them with -EINVAL. This was discovered via systematic fuzzing of sysfs interfaces crossing the user/kernel...
```diff diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c index bb11f8bb7bd4..a0250431ad11 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c @@ -244,6 +244,10 @@ static ssize_t amdgpu_set_power_dpm_state(struct device *dev, enum amd_pm_state_ty...
08ac3a7879d300302a1927ce2038629539a37f8b
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: fix KASAN slab-out-of-bounds in amdgpu_coredump ring dump
Problem Details: The ring content dump in amdgpu_coredump() uses two separate loops over adev->rings[]: the first counts rings with unsignalled fences to size the allocation, and the second copies ring data into the allocated buffers. Both loops use the same condition to skip rings: atomic_read(&ring->fence_drv.l...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c index 0811593fca7f..27830518a230 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c @@ -553,7 +553,7 @@ void amdgpu_coredump(struct a...
c990c05eb6c74c98d1ff3acf67a19015312820b7
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: harden FRU PIA parsing with bounded helpers
Problem Details: Replace the open-coded TLV walk with fru_pia_advance() and fru_pia_copy_field() helpers that bound every read by the actual EEPROM data length, preventing out-of-bounds reads on truncated or malformed FRU data. Signed-off-by: Stanley.Yang <Stanley.Yang@amd.com> Reviewed-by: Tao Zhou <tao.zhou1@amd.com...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c index 841e1b3a017e..18078844ddc7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c @@ -115,6 +115,43 @@ static bool is_fru_eeprom_supported(...
7822e87bb77e906465c5d1e43818e1b34b59ee04
Analyze and fix the following issue in the Linux kernel code: drm/amd/ras: make UNIRAS CPER debugfs header legacy-compatible
Problem Details: The UNIRAS CPER debugfs path returned a zeroed 12-byte prefix and used file offset directly as the CPER record index. Legacy CPER ring readers expect the prefix to contain three 32-bit ring pointers followed immediately by CPER payload data. Build the same header shape for UNIRAS reads by reporting a ...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c index d6bee5c30073..7e496607de1a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c @@ -484,7 +484,7 @@ bool amdgpu_ring_soft_recovery(struct amdgpu_ring *ring, unsi...
f9db1378f11092c4f22737331c4f2adad1bc0045
Analyze and fix the following issue in the Linux kernel code: drm/amd/ras: snapshot remote cmd header to fix double-fetch
Problem Details: The response header lives in PF-controlled shared memory. Copy it into a local struct once, then read cmd_res and output_size from the snapshot so the PF cannot flip cmd_res or grow output_size between checks. Signed-off-by: Stanley.Yang <Stanley.Yang@amd.com> Reviewed-by: Tao Zhou <tao.zhou1@amd.com>...
```diff diff --git a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_virt_ras_cmd.c b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_virt_ras_cmd.c index 571b81cb0475..fd4eea8c3f7b 100644 --- a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_virt_ras_cmd.c +++ b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_virt_ras_cmd.c @@ -92,6 +92,7 @@ static int ...
629279e2e798cd161cf74f40aaebfeb16d45eb01
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: Align amdgpu_gtt_mgr entries to TLB size on all SI
Problem Details: It seems that Pitcairn has the same issues as Tahiti with regards to the TLB size. This commit fixes a VCE1 FW validation timeout on suspend/resume on Pitcairn. Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/5336 Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Signed-off-by: Alex D...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c index a5d26b943f6d..d23a91d029aa 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c @@ -203,7 +203,7 @@ int amdgpu_gtt_mgr_alloc_entries(struct amdgpu_gt...
113fa3ca614a865776f81759bb245dabf99859a7
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: reserve TTM move fences slot for rearming eviction fences
Problem Details: The eviction rearming does not cover possible TTM move fences. If TTM moves the BO and consumes move fence slots, the later eviction fence add can hit the dma_resv_add_fence() BUG. Signed-off-by: Prike Liang <Prike.Liang@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: A...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index 1120f8225ac0..212c14d99f6b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c @@ -249,7 +249,7 @@ static int amdgpu_gem_object_open(struct drm_gem_object *obj, ...
c04b0430a9b9291ac2ad23a46cd6216c7ef8964f
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: fix shift-out-bounds warning of number_instance
Problem Details: Clamp number_instance using BIT/BIT_ULL with the <32 check to avoid the shift-out-bounds warning. Signed-off-by: Feifei Xu <Feifei.Xu@amd.com> Reviewed-by: Le Ma <le.ma@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c index b52c9fcf3fc5..340f4c823673 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c @@ -840,42 +840,44 @@ static void amdgpu_discovery_read_from_...
e0a3aa8a6750e8cf067fe2146dc618ffd296d5ef
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu/sdma7.1: fix support for disable_kq
Problem Details: Set the flag in the ring structure. Fixes: 80d4d3a45b86 ("drm/amdgpu/sdma7.1: add support for disable_kq") Reviewed-by: Kent Russell <kent.russell@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c b/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c index e1c0a4ff0e7f..cd9668605a50 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c @@ -1315,6 +1315,7 @@ static int sdma_v7_1_sw_init(struct amdgpu_ip_block *ip_block) r...
5ac01ec854079ac95733ac9a8f3eb694bbe8ff5a
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: Add size guard before copy discovery binary
Problem Details: Fix the firmware blob copied into fixed-size buffer without length check. Signed-off-by: Feifei Xu <Feifei.Xu@amd.com> Reviewed-by: Le Ma <le.ma@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c index d5d044e7fca7..b52c9fcf3fc5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c @@ -396,6 +396,26 @@ static int amdgpu_discovery_read_binary_...
ac081deaf16a639ea7dff2f285fe421a33c1ade0
Analyze and fix the following issue in the Linux kernel code: drm/amdkfd: fix UAF race in destroy_queue_cpsch
Problem Details: wait_on_destroy_queue() drops locks to wait for queue resume, allowing a concurrent destroy to free the queue. Use is_being_destroyed flag to serialize destruction. Reviewed-by: Amir Shetaia <Amir.Shetaia@amd.com> Signed-off-by: Alysa Liu <Alysa.Liu@amd.com> Signed-off-by: Alex Deucher <alexander.deuc...
```diff diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index cbd6fe8340f7..c6a2b952303a 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -2669,6 +2669,9 @@ static ...
fbace613a5a4a910956380c1cc1f49e321e3906a
Analyze and fix the following issue in the Linux kernel code: drm/amd: Fix amdgpu_device_find_parent()
Problem Details: commit eb53125a7ad9 ("drm/amd: Add dedicated helper for amdgpu_device_find_parent()") created a dedicated helper to find the parent device outside of the dGPU but it had a logic error that caused it to walk all the way up the topology and return the wrong device. Break out of the loop when the device ...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 480eeb8510f8..e9a88343389c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -1921,6 +1921,7 @@ static struct pci_dev *amdgpu_device_find_parent(st...
d4c6ec729fb7a8bf8a27b19bd70a1b945ad93dac
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Add missing kdoc for ALLM parameters
Problem Details: Add descriptions for the missing parameters for ALLMEnabled and ALLMValue to keep the function documentation synchronized with the function prototype mod_build_hf_vsif_infopacket(). Fixes the below with gcc W=1: ../display/modules/info_packet/info_packet.c:507 function parameter 'ALLMEnabled' not des...
```diff diff --git a/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c b/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c index fa05547c615a..f5ac4bf32a78 100644 --- a/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c +++ b/drivers/gpu/drm/amd/display/modules/info_packet/info_packet...
fed376e1f2e378551cfe411a56f4df3d305ecad9
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Fix kdoc parameter names for DSC padding helper
Problem Details: Replace incorrect kdoc parameter names with the actual function parameter names used by dc_update_modified_pix_clock_for_dsc_with_padding(). Fixes the below with gcc W=1: ../display/dc/core/dc_resource.c:4616 function parameter 'stream' not described in 'dc_update_modified_pix_clock_for_dsc_with_paddi...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c index e5565a61ef12..5f6cc1b1f788 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -4603,8 +4603,8 @@ fail: /** * dc_updat...
8cd9c5b1ccc809eff79029b46a722fba3fa41d75
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Promote DC to 3.2.384
Problem Details: This version brings along the following updates: - Enable DCN 4.2.1: * Add register header files for DCN42B * Add DCN42B DC resource files * Add DCN42B DMUB support * Add DCN42B code to DC and dcn42b_soc_bb to DML2 * Add DCN42 PMO init_for_pstate_support * Enable DCN42 PMO policy an...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h index 3ffcb74552c4..7b356bf95a67 100644 --- a/drivers/gpu/drm/amd/display/dc/dc.h +++ b/drivers/gpu/drm/amd/display/dc/dc.h @@ -63,7 +63,7 @@ struct dcn_dsc_reg_state; struct dcn_optc_reg_state; struct dcn_dccg_reg_state; ...
bb3ab95ac78671b128314b3515aa007439b7b58d
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Export symbols for KUnit test modules
Problem Details: Add missing EXPORT_IF_KUNIT() calls for amdgpu_dm_psr_set_event, amdgpu_dm_ism_init, and amdgpu_dm_ism_fini so that the KUnit test modules can resolve these symbols when built as modules, i.e., CONFIG_DRM_AMD_DC_KUNIT_TEST=m. Fixes: 34f281489976 ("drm/amd/display: Add KUnit tests for amdgpu_dm_psr_set...
```diff diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c index 5c0841728671..32391b56097e 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c @@ -640,6 +640,7 @@ void amdg...
a3142b13fe9fdbc3738026cc1cfeb7b2ab38a382
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Add more KUnit tests for amdgpu_dm_ism
Problem Details: [Why & How] Add 8 more KUnit tests: - dm_ism_get_idle_allow_delay: add a case where filter_entry_count exceeds filter_history_size, exercising the max() branch in the history_size calculation. - amdgpu_dm_ism_init: verify all fields are initialised to expected values after construction. - amdgpu...
```diff diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c index 06594fbfceee..0a010802540d 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c @@ -230,7 +230,8 @@ EXPORT_IF...
533de2d4d5879704cfe83f3b7929e6528fbfa95b
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Fix gamma 2.2 colorop TF direction in tests
Problem Details: [Why & How] Correct the gamma 2.2 TF direction used in the supported-TF bitmask tests. Degam and blnd use DRM_COLOROP_1D_CURVE_GAMMA22 (EOTF direction); shaper uses DRM_COLOROP_1D_CURVE_GAMMA22_INV (inverse EOTF direction). This aligns the tests with commit d8f9f42effd7 ("drm/amd/display: Fix gamma 2....
```diff diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_colorop_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_colorop_test.c index 6c77a7159188..4245ebd3725b 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_colorop_test.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/...
c2572d535be4847f8caba58b4ee8446b4ee15b57
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Fix DP_PIXEL_FORMAT fields & update clk_src for DCN4x
Problem Details: [Why & How] The enc1_stream_encoder_dp_get_pixel_format() function reads fields of the DP_PIXEL_FORMAT register that are deprecated on DCN4x. This breaks seamless boot because driver cannot properly determine the pixel format programmed by VBIOS. The previous changed submitted for this issue incorrectl...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c index 09910333bd71..6f14b98a054b 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c @@ -1264,8 +1264,6 @@ static ...
95700a3d660287ed657d6892f7be9ffc0e294a93
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Bound VBIOS record-chain walk loops
Problem Details: [Why & How] All record-chain walk loops in bios_parser.c and bios_parser2.c use for(;;) and only terminate on a 0xFF record_type sentinel or zero record_size. A malformed VBIOS image missing the terminator record causes unbounded iteration at probe time, potentially hundreds of thousands of iterations ...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c index 91df37c4c8da..fb30a3e5dfdb 100644 --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c @@ -222,6 +222,7 @@ static enum bp_result bio...
229212219e4247d9486f8ba41ef087358490be09
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Clamp HDMI HDCP2 rx_id_list read to buffer size
Problem Details: [Why & How] During HDCP 2.x repeater authentication over HDMI, the driver reads the sink's RxStatus register and extracts a 10-bit message size field (max value 1023). This value is used as the read length for the ReceiverID list without being clamped to the size of the destination buffer rx_id_list[17...
```diff diff --git a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c index 0ca39873f807..324413a090bf 100644 --- a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c +++ b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c @@ -529,7 +529,8 @@ enum mod_hdcp_sta...
eadf438ab8d370b9d19acee9359918c85afeb80d
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Reject gpio_bitshift >= 32 in bios_parser_get_gpio_pin_info()
Problem Details: [Why & How] gpio_bitshift is a uint8_t read directly from the VBIOS GPIO pin table. If the value is >= 32, the expression "1 << gpio_bitshift" triggers undefined behaviour in C (shift count exceeds type width). On x86 the shift is silently masked to 5 bits, producing an incorrect GPIO mask that may cau...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c index 27f8dce1d17e..6f99cfc28e79 100644 --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c @@ -701,8 +701,10 @@ static enum bp_resul...
37668568641ccc4cc1dbca4923d0a16609dd5707
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Use krealloc_array() in dal_vector_reserve()
Problem Details: [Why & How] dal_vector_reserve() computes the allocation size as "capacity * vector->struct_size" using uint32_t arithmetic, which can silently wrap to a small value on overflow. This would cause krealloc to return a smaller buffer than expected, leading to heap overflows on subsequent vector appends. ...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/basics/vector.c b/drivers/gpu/drm/amd/display/dc/basics/vector.c index e8736c134b8d..60bd9ead928a 100644 --- a/drivers/gpu/drm/amd/display/dc/basics/vector.c +++ b/drivers/gpu/drm/amd/display/dc/basics/vector.c @@ -289,8 +289,8 @@ bool dal_vector_reserve(struct vector...
6ab4c36a522842ff70474a1c0af2e40e50fc8300
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Fix NULL deref and buffer over-read in SDP debugfs
Problem Details: [Why & How] dp_sdp_message_debugfs_write() dereferences connector->base.state->crtc without checking for NULL. A connector can be connected but not bound to any CRTC (e.g. after hot-plug before the next atomic commit), causing a kernel crash when writing to the sdp_message debugfs node. The function a...
```diff diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c index 4b09a740f205..df6c54d84b8f 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c @@ -1345,8 +1...
10f5f9c0ef32d08b228bfee3684b62f36f395852
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Avoid DPMS-on for phantom stream
Problem Details: [Why & How] Calling dc_update_planes_and_stream separately for stream and its phantom stream causes a NULL pointer dereference, since the phantom is destroyed on the first call. Skip the call for phantom streams. Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Ilya Bakoulin <Ilya.Bakoulin@...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/link/accessories/link_dp_cts.c b/drivers/gpu/drm/amd/display/dc/link/accessories/link_dp_cts.c index ae6ed3a52d53..d3172dbdcdf0 100644 --- a/drivers/gpu/drm/amd/display/dc/link/accessories/link_dp_cts.c +++ b/drivers/gpu/drm/amd/display/dc/link/accessories/link_dp_cts...
5a7f0ef90195940c54b0f5bb85b87da55f038c69
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Clamp VBIOS HDMI retimer register count to array size
Problem Details: [Why & How] The VBIOS integrated info tables (v1_11 and v2_1) contain HdmiRegNum and Hdmi6GRegNum fields that are used as loop bounds when copying retimer I2C register settings into fixed-size arrays (dp*_ext_hdmi_reg_settings[9] and dp*_ext_hdmi_6g_reg_settings[3]). These u8 fields are not validated b...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c index 06bab03a8579..27f8dce1d17e 100644 --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c @@ -2600,14 +2600,16 @@ static enum bp_re...
c9affedcb8ef80eb8673cee8c88d368ab3bd58fc
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Change default driver setting for "Force ODM2:1 for eDP" policy
Problem Details: [Why & How] Change the driver setting: force single eDP ODM2:1 disable as default. Still allow user to enable it via debug option. Revert to unblock testing. Reviewed-by: Tom Chung <chiahsuan.chung@amd.com> Signed-off-by: Ovidiu Bunea <ovidiu.bunea@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Test...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c index b9f998ea2d0f..0feb4872412f 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_reso...
a55a458a8df37a65ffda5cf721d554a8f74f6b04
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Fix out-of-bounds read in dp_get_eq_aux_rd_interval()
Problem Details: [Why & How] The aux_rd_interval array in struct dc_lttpr_caps is declared with MAX_REPEATER_CNT - 1 (7) elements, indexed 0..6. However, the offset parameter passed to dp_get_eq_aux_rd_interval() can be as large as MAX_REPEATER_CNT (8) when a sink reports 8 LTTPR repeaters via DPCD. This leads to an ou...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/dc_dp_types.h b/drivers/gpu/drm/amd/display/dc/dc_dp_types.h index 7e5c118b2f20..fbef0dc743ff 100644 --- a/drivers/gpu/drm/amd/display/dc/dc_dp_types.h +++ b/drivers/gpu/drm/amd/display/dc/dc_dp_types.h @@ -1217,7 +1217,7 @@ struct dc_lttpr_caps { union dp_main_link...
ae696dfa47c30016cd429b9db5e70b259b8f509e
Analyze and fix the following issue in the Linux kernel code: iio: adc: nxp-sar-adc: harden buffer ISR against per-channel read failure
Problem Details: nxp_sar_adc_isr_buffer() bails on the first channel-read failure without calling iio_trigger_notify_done(), so the trigger use_count is left incremented and iio_trigger_poll_chained() drops subsequent dispatches until the device is rebound. Reaching this path means a state machine has gone wrong (driv...
```diff diff --git a/drivers/iio/adc/nxp-sar-adc.c b/drivers/iio/adc/nxp-sar-adc.c index 01f3da56e987..15c7432808f4 100644 --- a/drivers/iio/adc/nxp-sar-adc.c +++ b/drivers/iio/adc/nxp-sar-adc.c @@ -346,6 +346,7 @@ static void nxp_sar_adc_isr_buffer(struct iio_dev *indio_dev) ret = nxp_sar_adc_read_data(info, info->...
a3d34e5525cef4a53b755b94807dbe8c2976d7e7
Analyze and fix the following issue in the Linux kernel code: xhci: dbc: detect and recover hung DbC during enumeraton
Problem Details: Add a timeout between the detection of the debug host connection and the DbC Run transition to ‘1’. Toggle the DCE bit to re-enable DbC in order to retry the debug device enumeration process if the DbC run transition takes too long. Set the timeout to 2 seconds See xhci specification section 7.6.4.1 ...
```diff diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c index 34441ffa5e15..b1cabf5582fa 100644 --- a/drivers/usb/host/xhci-dbgcap.c +++ b/drivers/usb/host/xhci-dbgcap.c @@ -901,23 +901,49 @@ static enum evtreturn xhci_dbc_do_handle_events(struct xhci_dbc *dbc) return EVT_ERR; case DS_...