id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
8b1f3c54f930c3aeda0b5bad97bc317fc80267fd
Analyze and fix the following issue in the Linux kernel code: cpuset: fix overlap of partition effective CPUs
Problem Details: A warning was detect: WARNING: kernel/cgroup/cpuset.c:825 at rebuild_sched_domains_locked Modules linked in: CPU: 12 UID: 0 PID: 681 Comm: rmdir 6.19.0-rc6-next-20260121+ RIP: 0010:rebuild_sched_domains_locked+0x309/0x4b0 RSP: 0018:ffffc900019bbd28 EFLAGS: 00000202 RAX: ffff888104413508 RBX: 00...
```diff diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 003232dc9d2e..92a51316225d 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -2222,27 +2222,20 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs, * It is possible a change in parent's effective_...
553b4999cbe231b5011cb8db05a3092dec168aca
Analyze and fix the following issue in the Linux kernel code: mfd: wm8350-core: Use IRQF_ONESHOT
Problem Details: Using a threaded interrupt without a dedicated primary handler mandates the IRQF_ONESHOT flag to mask the interrupt source while the threaded handler is active. Otherwise the interrupt can fire again before the threaded handler had a chance to run. Mark explained that this should not happen with this ...
```diff diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h index 5f70d3b5d1b1..097ef4dfcdac 100644 --- a/include/linux/mfd/wm8350/core.h +++ b/include/linux/mfd/wm8350/core.h @@ -667,7 +667,7 @@ static inline int wm8350_register_irq(struct wm8350 *wm8350, int irq, return -ENODEV; retu...
18d28446231390e4ea3634fb16200865df2c6506
Analyze and fix the following issue in the Linux kernel code: rtc: amlogic-a4: Remove IRQF_ONESHOT
Problem Details: Passing IRQF_ONESHOT ensures that the interrupt source is masked until the secondary (threaded) handler is done. If only a primary handler is used then the flag makes no sense because the interrupt can not fire (again) while its handler is running. The flag also prevents force-threading of the primary...
```diff diff --git a/drivers/rtc/rtc-amlogic-a4.c b/drivers/rtc/rtc-amlogic-a4.c index 123fb372fc9f..50938c35af36 100644 --- a/drivers/rtc/rtc-amlogic-a4.c +++ b/drivers/rtc/rtc-amlogic-a4.c @@ -369,7 +369,7 @@ static int aml_rtc_probe(struct platform_device *pdev) return PTR_ERR(rtc->rtc_dev); ret = devm_reques...
a7fb84ea70aae9a92a842932206e70ed1b3c7007
Analyze and fix the following issue in the Linux kernel code: usb: typec: fusb302: Remove IRQF_ONESHOT
Problem Details: Passing IRQF_ONESHOT ensures that the interrupt source is masked until the secondary (threaded) handler is done. If only a primary handler is used then the flag makes no sense because the interrupt can not fire (again) while its handler is running. The flag also prevents force-threading of the primary...
```diff diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c index 870a71f953f6..19ff8217818e 100644 --- a/drivers/usb/typec/tcpm/fusb302.c +++ b/drivers/usb/typec/tcpm/fusb302.c @@ -1756,8 +1756,7 @@ static int fusb302_probe(struct i2c_client *client) } ret = request_irq(chip->gpio_in...
5c858d6c66304b4c7579582ec5235f02d43578ea
Analyze and fix the following issue in the Linux kernel code: EDAC/altera: Remove IRQF_ONESHOT
Problem Details: Passing IRQF_ONESHOT ensures that the interrupt source is masked until the secondary (threaded) handler is done. If only a primary handler is used then the flag makes no sense because the interrupt can not fire (again) while its handler is running. The flag also prevents force-threading of the primary...
```diff diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c index 0c5b94e64ea1..4edd2088c2db 100644 --- a/drivers/edac/altera_edac.c +++ b/drivers/edac/altera_edac.c @@ -1563,8 +1563,7 @@ static int altr_portb_setup(struct altr_edac_device_dev *device) goto err_release_group_1; } rc = devm_reque...
bd81f07e9a27c341cd7e72be95eb0b7cf3910926
Analyze and fix the following issue in the Linux kernel code: scsi: efct: Use IRQF_ONESHOT and default primary handler
Problem Details: There is no added value in efct_intr_msix() compared to irq_default_primary_handler(). Using a threaded interrupt without a dedicated primary handler mandates the IRQF_ONESHOT flag to mask the interrupt source while the threaded handler is active. Otherwise the interrupt can fire again before the thre...
```diff diff --git a/drivers/scsi/elx/efct/efct_driver.c b/drivers/scsi/elx/efct/efct_driver.c index 1bd42f7db177..528399f725d4 100644 --- a/drivers/scsi/elx/efct/efct_driver.c +++ b/drivers/scsi/elx/efct/efct_driver.c @@ -415,12 +415,6 @@ efct_intr_thread(int irq, void *handle) return IRQ_HANDLED; } -static irqre...
28abed6569c87eab9071ab56c64433c2f0d9ce51
Analyze and fix the following issue in the Linux kernel code: Bluetooth: btintel_pcie: Use IRQF_ONESHOT and default primary handler
Problem Details: There is no added value in btintel_pcie_msix_isr() compared to irq_default_primary_handler(). Using a threaded interrupt without a dedicated primary handler mandates the IRQF_ONESHOT flag to mask the interrupt source while the threaded handler is active. Otherwise the interrupt can fire again before t...
```diff diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c index 2936b535479f..704767b334b9 100644 --- a/drivers/bluetooth/btintel_pcie.c +++ b/drivers/bluetooth/btintel_pcie.c @@ -1431,11 +1431,6 @@ static void btintel_pcie_msix_rx_handle(struct btintel_pcie_data *data) } } -static i...
5bfcdccb4d18d3909b7f87942be67fd6bdc00c1d
Analyze and fix the following issue in the Linux kernel code: iommu/amd: Use core's primary handler and set IRQF_ONESHOT
Problem Details: request_threaded_irq() is invoked with a primary and a secondary handler and no flags are passed. The primary handler is the same as irq_default_primary_handler() so there is no need to have an identical copy. The lack of the IRQF_ONESHOT can be dangerous because the interrupt source is not masked whi...
```diff diff --git a/drivers/iommu/amd/amd_iommu.h b/drivers/iommu/amd/amd_iommu.h index b742ef1adb35..df1c238dc888 100644 --- a/drivers/iommu/amd/amd_iommu.h +++ b/drivers/iommu/amd/amd_iommu.h @@ -15,7 +15,6 @@ irqreturn_t amd_iommu_int_thread(int irq, void *data); irqreturn_t amd_iommu_int_thread_evtlog(int irq, vo...
f6bc712877f24dc89bdfd7bdbf1a32f3b9960b34
Analyze and fix the following issue in the Linux kernel code: platform/x86: int0002: Remove IRQF_ONESHOT from request_irq()
Problem Details: Passing IRQF_ONESHOT ensures that the interrupt source is masked until the secondary (threaded) handler is done. If only a primary handler is used then the flag makes no sense because the interrupt cannot fire (again) while its handler is running. The flag also prevents force-threading of the primary ...
```diff diff --git a/drivers/platform/x86/intel/int0002_vgpio.c b/drivers/platform/x86/intel/int0002_vgpio.c index 6f5629dc3f8d..562e88025643 100644 --- a/drivers/platform/x86/intel/int0002_vgpio.c +++ b/drivers/platform/x86/intel/int0002_vgpio.c @@ -206,8 +206,8 @@ static int int0002_probe(struct platform_device *pdev...
943b052ded21feb84f293d40b06af3181cd0d0d7
Analyze and fix the following issue in the Linux kernel code: genirq: Set IRQF_COND_ONESHOT in devm_request_irq().
Problem Details: The flag IRQF_COND_ONESHOT was already force-added to request_irq() because the ACPI SCI interrupt handler is using the IRQF_ONESHOT flag which breaks all shared handlers. devm_request_irq() needs the same change since some users, such as int0002_vgpio, are using this function instead. Add IRQF_COND_...
```diff diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 266f2b39213a..b2bb878abd11 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -228,7 +228,7 @@ static inline int __must_check devm_request_irq(struct device *dev, unsigned int irq, irq_handler_t handler, unsigne...
e1f94662d759411fb7da3e4e662ec588c268e1a5
Analyze and fix the following issue in the Linux kernel code: irqchip/aspeed-scu-ic: Remove unused variable mask
Problem Details: The kernel test robot reports: drivers/irqchip/irq-aspeed-scu-ic.c:107:27: warning: variable 'mask' set but not used 107 | unsigned int sts, mask; Remove the leftover. Fixes: b2a0c13f8b4f ("irqchip/aspeed-scu-ic: Add support for AST2700 SCU interrupt controllers") Reported-by: kernel ...
```diff diff --git a/drivers/irqchip/irq-aspeed-scu-ic.c b/drivers/irqchip/irq-aspeed-scu-ic.c index bee59c8c4c93..7398c3b9eace 100644 --- a/drivers/irqchip/irq-aspeed-scu-ic.c +++ b/drivers/irqchip/irq-aspeed-scu-ic.c @@ -104,11 +104,10 @@ static void aspeed_scu_ic_irq_handler_split(struct irq_desc *desc) struct asp...
52b330799e2d6f825ae2bb74662ec1b10eb954bb
Analyze and fix the following issue in the Linux kernel code: drm/exynos: vidi: use ctx->lock to protect struct vidi_context member variables related to memory alloc/free
Problem Details: Exynos Virtual Display driver performs memory alloc/free operations without lock protection, which easily causes concurrency problem. For example, use-after-free can occur in race scenario like this: ``` CPU0 CPU1 CPU2 ---- ---- ---- vidi_connection_ioctl() if (vidi->connection) //...
```diff diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 9709c07e5d8f..67bbf9b8bc0e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -187,29 +187,37 @@ static ssize_t vidi_store_connection(struct device *dev, ...
d4c98c077c7fb2dfdece7d605e694b5ea2665085
Analyze and fix the following issue in the Linux kernel code: drm/exynos: vidi: fix to avoid directly dereferencing user pointer
Problem Details: In vidi_connection_ioctl(), vidi->edid(user pointer) is directly dereferenced in the kernel. This allows arbitrary kernel memory access from the user space, so instead of directly accessing the user pointer in the kernel, we should modify it to copy edid to kernel memory using copy_from_user() and use...
```diff diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 480c99a8f9f7..9709c07e5d8f 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -252,13 +252,27 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void ...
d3968a0d85b211e197f2f4f06268a7031079e0d0
Analyze and fix the following issue in the Linux kernel code: drm/exynos: vidi: use priv->vidi_dev for ctx lookup in vidi_connection_ioctl()
Problem Details: vidi_connection_ioctl() retrieves the driver_data from drm_dev->dev to obtain a struct vidi_context pointer. However, drm_dev->dev is the exynos-drm master device, and the driver_data contained therein is not the vidi component device, but a completely different device. This can lead to various bugs, ...
```diff diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 23646e55f142..06c29ff2aac0 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -199,6 +199,7 @@ struct drm_exynos_file_private { struct exynos_drm_private { s...
e5b0cfa32b1c3e7f153373bfdc20ccdd3c342de2
Analyze and fix the following issue in the Linux kernel code: MAINTAINERS: Drop RDMA files from Hyper-V section
Problem Details: MAINTAINERS entries are organized by subsystem ownership, and the RDMA files belong under drivers/infiniband. Remove the overly broad mana_ib entries from the Hyper-V section, and instead add the Hyper-V mailing list to CC on mana_ib patches. This makes get_maintainer.pl behave more sensibly when runn...
```diff diff --git a/MAINTAINERS b/MAINTAINERS index 12f49de7fe03..d2e3353a1d29 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11739,7 +11739,6 @@ F: arch/x86/kernel/cpu/mshyperv.c F: drivers/clocksource/hyperv_timer.c F: drivers/hid/hid-hyperv.c F: drivers/hv/ -F: drivers/infiniband/hw/mana/ F: drivers/input/serio...
bb1256e0ddc7e9e406164319769b9f8d8389f056
Analyze and fix the following issue in the Linux kernel code: ACPI: battery: fix incorrect charging status when current is zero
Problem Details: On some laptops, such as the Huawei Matebook series, the embedded controller continues to report "Charging" status even when the charge threshold is reached and no current is being drawn. This incorrect reporting prevents the system from switching to battery power profiles, leading to significantly hi...
```diff diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 151a9f645511..3bbddd6f622c 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -212,7 +212,14 @@ static int acpi_battery_get_property(struct power_supply *psy, if (battery->state & ACPI_BATTERY_STATE_DISCHARGING) val->intv...
58b604dfc7bb753f91bc0ccd3fa705e14e6edfb4
Analyze and fix the following issue in the Linux kernel code: RDMA/uverbs: Add __GFP_NOWARN to ib_uverbs_unmarshall_recv() kmalloc
Problem Details: Since wqe_size in ib_uverbs_unmarshall_recv() is user-provided and already validated, but can still be large, add __GFP_NOWARN to suppress memory allocation warnings for large sizes, consistent with the similar fix in ib_uverbs_post_send(). Fixes: 67cdb40ca444 ("[IB] uverbs: Implement more commands") ...
```diff diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index 3259e9848cc7..f4616deeca54 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -2242,7 +2242,7 @@ ib_uverbs_unmarshall_recv(struct uverbs_req_iter *iter, u32 wr_count, if ...
427b2535f51342de3156babc6bdc3f3b7dd2c707
Analyze and fix the following issue in the Linux kernel code: kho: skip memoryless NUMA nodes when reserving scratch areas
Problem Details: kho_reserve_scratch() iterates over all online NUMA nodes to allocate per-node scratch memory. On systems with memoryless NUMA nodes (nodes that have CPUs but no memory), memblock_alloc_range_nid() fails because there is no memory available on that node. This causes KHO initialization to fail and kho...
```diff diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c index e0a50b012ba3..8a2b2a7e50fc 100644 --- a/kernel/liveupdate/kexec_handover.c +++ b/kernel/liveupdate/kexec_handover.c @@ -655,7 +655,7 @@ static void __init kho_reserve_scratch(void) scratch_size_update(); /* FIXME: d...
96a54b8ffc8c4567c32fe0b6996669f1132b026d
Analyze and fix the following issue in the Linux kernel code: crash_dump: fix dm_crypt keys locking and ref leak
Problem Details: crash_load_dm_crypt_keys() reads dm-crypt volume keys from the user keyring. It uses user_key_payload_locked() without holding key->sem, which makes lockdep complain when kexec_file_load() assembles the crash image: ============================= WARNING: suspicious RCU usage -------------------...
```diff diff --git a/kernel/crash_dump_dm_crypt.c b/kernel/crash_dump_dm_crypt.c index 0d23dc1de67c..37129243054d 100644 --- a/kernel/crash_dump_dm_crypt.c +++ b/kernel/crash_dump_dm_crypt.c @@ -143,6 +143,7 @@ static int read_key_from_user_keying(struct dm_crypt_key *dm_key) { const struct user_key_payload *ukp; ...
0895a000e4fff9e950a7894210db45973e485c35
Analyze and fix the following issue in the Linux kernel code: ucount: check for CAP_SYS_RESOURCE using ns_capable_noaudit()
Problem Details: The user.* sysctls implement the ctl_table_root::permissions hook and they override the file access mode based on the CAP_SYS_RESOURCE capability (at most rwx if capable, at most r-- if not). The capability is being checked unconditionally, so if an LSM denies the capability, an audit record may be lo...
```diff diff --git a/kernel/ucount.c b/kernel/ucount.c index 586af49fc03e..fc4a8f2d3096 100644 --- a/kernel/ucount.c +++ b/kernel/ucount.c @@ -47,7 +47,7 @@ static int set_permissions(struct ctl_table_header *head, int mode; /* Allow users with CAP_SYS_RESOURCE unrestrained access */ - if (ns_capable(user_ns, CAP...
8924336531e21b187d724b5fdf5277269c9ec22c
Analyze and fix the following issue in the Linux kernel code: ipc: don't audit capability check in ipc_permissions()
Problem Details: The IPC sysctls implement the ctl_table_root::permissions hook and they override the file access mode based on the CAP_CHECKPOINT_RESTORE capability, which is being checked regardless of whether any access is actually denied or not, so if an LSM denies the capability, an audit record may be logged even...
```diff diff --git a/include/linux/capability.h b/include/linux/capability.h index 1fb08922552c..37db92b3d6f8 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h @@ -203,6 +203,12 @@ static inline bool checkpoint_restore_ns_capable(struct user_namespace *ns) ns_capable(ns, CAP_SYS_ADMIN); } +...
480e1d5c64bb14441f79f2eb9421d5e26f91ea3d
Analyze and fix the following issue in the Linux kernel code: kexec: derive purgatory entry from symbol
Problem Details: kexec_load_purgatory() derives image->start by locating e_entry inside an SHF_EXECINSTR section. If the purgatory object contains multiple executable sections with overlapping sh_addr, the entrypoint check can match more than once and trigger a WARN. Derive the entry section from the purgatory_start ...
```diff diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index eb62a9794242..2bfbb2d144e6 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -882,6 +882,60 @@ out_free_sha_regions: } #ifdef CONFIG_ARCH_SUPPORTS_KEXEC_PURGATORY +/* + * kexec_purgatory_find_symbol - find a symbol in the purgatory + *...
5138c936c2c82c9be8883921854bc6f7e1177d8c
Analyze and fix the following issue in the Linux kernel code: ocfs2: fix reflink preserve cleanup issue
Problem Details: commit c06c303832ec ("ocfs2: fix xattr array entry __counted_by error") doesn't handle all cases and the cleanup job for preserved xattr entries still has bug: - the 'last' pointer should be shifted by one unit after cleanup an array entry. - current code logic doesn't cleanup the first entry when xh...
```diff diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 5fd85f517868..e434a62dd69f 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c @@ -6395,6 +6395,10 @@ static int ocfs2_reflink_xattr_header(handle_t *handle, (void *)last - (void *)xe); memset(last, 0, sizeof(struct ocfs2_xattr_entry...
666183dcdd9ad3b8156a1df7f204f728f720380f
Analyze and fix the following issue in the Linux kernel code: rapidio: replace rio_free_net() with kfree() in rio_scan_alloc_net()
Problem Details: When idtab allocation fails, net is not registered with rio_add_net() yet, so kfree(net) is sufficient to release the memory. Set mport->net to NULL to avoid dangling pointer. Link: https://lkml.kernel.org/r/20260121013508.195836-1-lihaoxiang@isrc.iscas.ac.cn Fixes: e6b585ca6e81 ("rapidio: move net a...
```diff diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c index c12941f71e2c..dcd6619a4b02 100644 --- a/drivers/rapidio/rio-scan.c +++ b/drivers/rapidio/rio-scan.c @@ -854,7 +854,8 @@ static struct rio_net *rio_scan_alloc_net(struct rio_mport *mport, if (idtab == NULL) { pr_err("RIO: failed ...
86e685ff364394b477cd1c476029480a2a1960c5
Analyze and fix the following issue in the Linux kernel code: tracing: remove size parameter in __trace_puts()
Problem Details: The __trace_puts() function takes a string pointer and the size of the string itself. All users currently simply pass in the strlen() of the string it is also passing in. There's no reason to pass in the size. Instead have the __trace_puts() function do the strlen() within the function itself. This...
```diff diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 09850b26061c..5838c419ed37 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -328,10 +328,10 @@ int __trace_printk(unsigned long ip, const char *fmt, ...); if (__builtin_constant_p(str)) \ __trace_bputs(_THIS_IP_, trac...
e8d899d301346a5591c9d1af06c3c9b3501cf84b
Analyze and fix the following issue in the Linux kernel code: compiler-clang.h: require LLVM 19.1.0 or higher for __typeof_unqual__
Problem Details: When building the kernel using a version of LLVM between llvmorg-19-init (the first commit of the LLVM 19 development cycle) and the change in LLVM that actually added __typeof_unqual__ for all C modes [1], which might happen during a bisect of LLVM, there is a build failure: In file included from a...
```diff diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h index 7edf1a07b535..e1123dd28486 100644 --- a/include/linux/compiler-clang.h +++ b/include/linux/compiler-clang.h @@ -153,4 +153,4 @@ * Bindgen uses LLVM even if our C compiler is GCC, so we cannot * rely on the auto-detected CONFI...
931d5c36c7369b65adb9e3d197a8d3a8a913db8c
Analyze and fix the following issue in the Linux kernel code: checkpatch: add an invalid patch separator test
Problem Details: Some versions of tools that apply patches incorrectly allow lines that start with 3 dashes and have additional content on the same line. Checkpatch will now emit an ERROR on these lines and optionally convert those lines from dashes to equals with --fix. Link: https://lkml.kernel.org/r/6ec1ed08328340...
```diff diff --git a/Documentation/dev-tools/checkpatch.rst b/Documentation/dev-tools/checkpatch.rst index deb3f67a633c..baf0b42ebba9 100644 --- a/Documentation/dev-tools/checkpatch.rst +++ b/Documentation/dev-tools/checkpatch.rst @@ -601,6 +601,11 @@ Commit message See: https://www.kernel.org/doc/html/latest/pr...
36976159140bc288c3752a9b799090a49f1a8b62
Analyze and fix the following issue in the Linux kernel code: mm, swap: cleanup swap entry management workflow
Problem Details: The current swap entry allocation/freeing workflow has never had a clear definition. This makes it hard to debug or add new optimizations. This commit introduces a proper definition of how swap entries would be allocated and freed. Now, most operations are folio based, so they will never exceed one ...
```diff diff --git a/arch/s390/mm/gmap_helpers.c b/arch/s390/mm/gmap_helpers.c index d41b19925a5a..dd89fce28531 100644 --- a/arch/s390/mm/gmap_helpers.c +++ b/arch/s390/mm/gmap_helpers.c @@ -32,7 +32,7 @@ static void ptep_zap_softleaf_entry(struct mm_struct *mm, softleaf_t entry) dec_mm_counter(mm, MM_SWAPENTS); e...
de85024b34839e9c476b6f93c3104e920bd9d270
Analyze and fix the following issue in the Linux kernel code: mm, swap: remove workaround for unsynchronized swap map cache state
Problem Details: Remove the "skip if exists" check from commit a65b0e7607ccb ("zswap: make shrinking memcg-aware"). It was needed because there is a tiny time window between setting the SWAP_HAS_CACHE bit and actually adding the folio to the swap cache. If a user is trying to add the folio into the swap cache but ano...
```diff diff --git a/mm/swap.h b/mm/swap.h index e427240073e9..0801857a0640 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -260,7 +260,7 @@ int swap_cache_add_folio(struct folio *folio, swp_entry_t entry, void swap_cache_del_folio(struct folio *folio); struct folio *swap_cache_alloc_folio(swp_entry_t entry, gfp_t gfp_flag...
2732acda82c93475c5986e1a5640004a5d4f9c3e
Analyze and fix the following issue in the Linux kernel code: mm, swap: use swap cache as the swap in synchronize layer
Problem Details: Current swap in synchronization mostly uses the swap_map's SWAP_HAS_CACHE bit. Whoever sets the bit first does the actual work to swap in a folio. This has been causing many issues as it's just a poor implementation of a bit lock. Raced users have no idea what is pinning a slot, so it has to loop wi...
```diff diff --git a/include/linux/swap.h b/include/linux/swap.h index bf72b548a96d..74df3004c850 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -458,7 +458,6 @@ void put_swap_folio(struct folio *folio, swp_entry_t entry); extern swp_entry_t get_swap_page_of_type(int); extern int add_swap_count_conti...
f1879e8a0c601de78a356016e216241b43de9208
Analyze and fix the following issue in the Linux kernel code: mm, swap: never bypass the swap cache even for SWP_SYNCHRONOUS_IO
Problem Details: Now the overhead of the swap cache is trivial. Bypassing the swap cache is no longer a valid optimization. So unify the swapin path using the swap cache. This changes the swap in behavior in two observable ways. Readahead is now always disabled for SWP_SYNCHRONOUS_IO devices, which is a huge win fo...
```diff diff --git a/mm/memory.c b/mm/memory.c index 87cf4e1a6f86..5a6dd1606c67 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4611,7 +4611,16 @@ static struct folio *alloc_swap_folio(struct vm_fault *vmf) } #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ -static DECLARE_WAIT_QUEUE_HEAD(swapcache_wq); +/* Sanity check tha...
256c11937de0039253ee36ed7d1cabc852beae54
Analyze and fix the following issue in the Linux kernel code: mm/vma: update vma_assert_locked() to use lockdep
Problem Details: We can use lockdep to avoid unnecessary work here, otherwise update the code to logically evaluate all pertinent cases and share code with vma_assert_write_locked(). Make it clear here that we treat the VMA being detached at this point as a bug, this was only implicit before. Additionally, abstract r...
```diff diff --git a/include/linux/mmap_lock.h b/include/linux/mmap_lock.h index 1746a172a81c..90fc32b683dd 100644 --- a/include/linux/mmap_lock.h +++ b/include/linux/mmap_lock.h @@ -78,6 +78,12 @@ static inline void mmap_assert_write_locked(const struct mm_struct *mm) #ifdef CONFIG_PER_VMA_LOCK +#ifdef CONFIG_LOC...
e28e575af956c4c3089b443e87be91a6ff7af355
Analyze and fix the following issue in the Linux kernel code: mm/vma: introduce helper struct + thread through exclusive lock fns
Problem Details: It is confusing to have __vma_start_exclude_readers() return 0, 1 or an error (but only when waiting for readers in TASK_KILLABLE state), and having the return value be stored in a stack variable called 'locked' is further confusion. More generally, we are doing a lot of rather finnicky things during ...
```diff diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 3e608d22cab0..8731606d8d36 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -1011,15 +1011,15 @@ struct vm_area_struct { * decrementing it again. * * VM_REFCNT_EXCLUDE_READERS_FLAG - Detached, pending - * __v...
ef4c0cea1e15dc6b1b5b9bb72fa4605b14f2125e
Analyze and fix the following issue in the Linux kernel code: mm/vma: document possible vma->vm_refcnt values and reference comment
Problem Details: The possible vma->vm_refcnt values are confusing and vague, explain in detail what these can be in a comment describing the vma->vm_refcnt field and reference this comment in various places that read/write this field. No functional change intended. [akpm@linux-foundation.org: fix typo, per Suren] Lin...
```diff diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index bdbf17c4f26b..3e608d22cab0 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -758,7 +758,8 @@ static inline struct anon_vma_name *anon_vma_name_alloc(const char *name) * set the VM_REFCNT_EXCLUDE_READERS_FLAG in vma->...
25faccd69977d9a72739fd425040c2a1c2d67e46
Analyze and fix the following issue in the Linux kernel code: mm/vma: rename VMA_LOCK_OFFSET to VM_REFCNT_EXCLUDE_READERS_FLAG
Problem Details: Patch series "mm: add and use vma_assert_stabilised() helper", v4. This series first introduces a series of refactorings, intended to significantly improve readability and abstraction of the code. Sometimes we wish to assert that a VMA is stable, that is - the VMA cannot be changed underneath us. Th...
```diff diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 78950eb8926d..bdbf17c4f26b 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -752,8 +752,17 @@ static inline struct anon_vma_name *anon_vma_name_alloc(const char *name) } #endif -#define VMA_LOCK_OFFSET 0x40000000 -...
b71e496f815a3bc6e8907a9b495e61e431631794
Analyze and fix the following issue in the Linux kernel code: Docs/mm/damon/maintainer-profile: fix wrong MAITNAINERS section name
Problem Details: Commit 9044cbe50a70 ("MAINTAINERS: rename DAMON section") renamed the section for DAMON from "DATA ACCESS MONITOR" to "DAMON". But the commit forgot updating the name on the maintainer-profile document. Update. Link: https://lkml.kernel.org/r/20260118180305.70023-8-sj@kernel.org Signed-off-by: Seong...
```diff diff --git a/Documentation/mm/damon/maintainer-profile.rst b/Documentation/mm/damon/maintainer-profile.rst index e761edada1e9..4fa06b21ec30 100644 --- a/Documentation/mm/damon/maintainer-profile.rst +++ b/Documentation/mm/damon/maintainer-profile.rst @@ -3,8 +3,8 @@ DAMON Maintainer Entry Profile ============...
69714a74c19f5ae8b21e25558d62d893d48a3f18
Analyze and fix the following issue in the Linux kernel code: mm/damon/core: cancel damos_walk() before damon_ctx->kdamond reset
Problem Details: damos_walk() request is canceled after damon_ctx->kdamond is reset. This can make weird situations where damon_is_running() returns false but the DAMON context has the damos_walk() request linked. There was a similar situation for damon_call() requests handling [1], which _was_ able to cause a racy u...
```diff diff --git a/mm/damon/core.c b/mm/damon/core.c index 0c8ac11a49f9..0bed937b1dce 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -2856,14 +2856,13 @@ done: kfree(ctx->regions_score_histogram); kdamond_call(ctx, true); + damos_walk_cancel(ctx); pr_debug("kdamond (%d) finishes\n", current->pid); ...
94a62284ede0250e48c886416041ad65907ee917
Analyze and fix the following issue in the Linux kernel code: selftests/damon/sysfs_memcg_path_leak.sh: use kmemleak
Problem Details: Patch series "selftests/damon: improve leak detection and wss estimation reliability". Two DAMON selftets, namely 'sysfs_memcg_leak' and 'sysfs_update_schemes_tried_regions_wss_estimation' frequently show intermittent failures due to their unreliable leak detection and working set size estimation. Ma...
```diff diff --git a/tools/testing/selftests/damon/sysfs_memcg_path_leak.sh b/tools/testing/selftests/damon/sysfs_memcg_path_leak.sh index 64c5d8c518a4..33a7ff43ed6c 100755 --- a/tools/testing/selftests/damon/sysfs_memcg_path_leak.sh +++ b/tools/testing/selftests/damon/sysfs_memcg_path_leak.sh @@ -14,6 +14,13 @@ then ...
148e5879532f835118e00c3040acef077b57721a
Analyze and fix the following issue in the Linux kernel code: selftests/mm: fix exit code in pagemap_ioctl
Problem Details: Make sure pagemap_ioctl exits with an appropriate value: * If the tests are run, call ksft_finished() to report the right status instead of reporting PASS unconditionally. * Report SKIP if userfaultfd isn't available (in line with other tests) * Report FAIL if we failed to open /proc/self/pagema...
```diff diff --git a/tools/testing/selftests/mm/pagemap_ioctl.c b/tools/testing/selftests/mm/pagemap_ioctl.c index 1896c7d4f72e..2ca8a7e3c27e 100644 --- a/tools/testing/selftests/mm/pagemap_ioctl.c +++ b/tools/testing/selftests/mm/pagemap_ioctl.c @@ -1552,7 +1552,7 @@ int main(int __attribute__((unused)) argc, char *ar...
7e938f00b00319510ae097e20b7487dfa578d53f
Analyze and fix the following issue in the Linux kernel code: selftests/mm: fix faulting-in code in pagemap_ioctl test
Problem Details: One of the pagemap_ioctl tests attempts to fault in pages by memcpy()'ing them to an unused buffer. This probably worked originally, but since commit 46036188ea1f ("selftests/mm: build with -O2") the compiler is free to optimise away that unused buffer and the memcpy() with it. As a result there migh...
```diff diff --git a/tools/testing/selftests/mm/pagemap_ioctl.c b/tools/testing/selftests/mm/pagemap_ioctl.c index 2cb5441f29c7..1896c7d4f72e 100644 --- a/tools/testing/selftests/mm/pagemap_ioctl.c +++ b/tools/testing/selftests/mm/pagemap_ioctl.c @@ -1052,11 +1052,10 @@ static void test_simple(void) int sanity_tests(v...
bce1dabd310e87fefe0645fec9ba98b84d37e418
Analyze and fix the following issue in the Linux kernel code: selftests/mm: fix usage of FORCE_READ() in cow tests
Problem Details: Commit 5bbc2b785e63 ("selftests/mm: fix FORCE_READ to read input value correctly") modified FORCE_READ() to take a value instead of a pointer. It also changed most of the call sites accordingly, but missed many of them in cow.c. In those cases, we ended up with the pointer itself being read, not the ...
```diff diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c index accfd198dbda..83b3563be26b 100644 --- a/tools/testing/selftests/mm/cow.c +++ b/tools/testing/selftests/mm/cow.c @@ -1612,8 +1612,8 @@ static void run_with_huge_zeropage(non_anon_test_fn fn, const char *desc) * the first su...
1821be740d2e9329805cafa368e476064fde0789
Analyze and fix the following issue in the Linux kernel code: selftests/mm: remove flaky header check
Problem Details: Commit 96ed62ea0298 ("mm: page_frag: fix a compile error when kernel is not compiled") introduced a check to avoid attempting to build the page_frag module if <linux/page_frag_cache.h> is missing. Unfortunately this check only works if KDIR points to /lib/modules/... or an in-tree kernel build. It a...
```diff diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index bb93101e339e..4e5c8a330a0c 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -46,12 +46,8 @@ CFLAGS += -U_FORTIFY_SOURCE KDIR ?= $(if $(O),$(O),$(realpath ../../../..)) if...
4ac76c51709dff01b285a2d8afea80ca7ae66d28
Analyze and fix the following issue in the Linux kernel code: selftests/mm: default KDIR to build directory
Problem Details: Patch series "Various mm kselftests improvements/fixes", v3. Various improvements/fixes for the mm kselftests: - Patch 1-3 extend support for more build configurations: out-of-tree $KDIR, cross-compilation, etc. - Patch 4-7 fix issues related to faulting in pages, introducing a new helper for th...
```diff diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index eaf9312097f7..bb93101e339e 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -44,7 +44,7 @@ LDLIBS = -lrt -lpthread -lm # warnings. CFLAGS += -U_FORTIFY_SOURCE -KDIR ?= /l...
3a64d5b82eccc0dc629d43cde791a2c19bd67dfc
Analyze and fix the following issue in the Linux kernel code: sparc/mm: export symbols for lazy_mmu_mode KUnit tests
Problem Details: The lazy_mmu_mode KUnit tests call lazy_mmu_mode_{enable,disable}. These tests may be built as a module, and because of inlining this means that arch_{enter,flush,leave}_lazy_mmu_mode need to be exported. [akpm@linux-foundation.org: remove mm/tests/lazy_mmu_mode_kunit.c comment, per Kevin] Link: http...
```diff diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c index 3a852071d260..6d9dd5eb1328 100644 --- a/arch/sparc/mm/tlb.c +++ b/arch/sparc/mm/tlb.c @@ -11,6 +11,8 @@ #include <linux/preempt.h> #include <linux/pagemap.h> +#include <kunit/visibility.h> + #include <asm/tlbflush.h> #include <asm/cacheflush.h> ...
ed0a826ce3025832c8d8b79924fd638f75b62bb7
Analyze and fix the following issue in the Linux kernel code: mm: add WQ_PERCPU to alloc_workqueue users
Problem Details: This continues the effort to refactor workqueue APIs, which began with the introduction of new workqueues and a new alloc_workqueue flag in: commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq") commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag") The refactoring is goi...
```diff diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 69361742893a..e319bd5e8b75 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c @@ -974,7 +974,7 @@ static int __init cgwb_init(void) * system_percpu_wq. Put them in a separate wq and limit concurrency. * There's no point in executing many of these i...
824b8c96c421e677cf0fe6f69939ff0082665a34
Analyze and fix the following issue in the Linux kernel code: mm/hugetlb: enforce brace style
Problem Details: Documentation/process/coding-style.rst explicitly notes that if only one branch of a conditional statement is a single statement, braces should be used in both branches. Enforce this in mm/hugetlb.c. While add it, fix the indentation for vma_end_reservation. No functional change intended. Link: htt...
```diff diff --git a/mm/hugetlb.c b/mm/hugetlb.c index a84869d33bed..9c7efad6fa48 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -578,8 +578,9 @@ hugetlb_resv_map_add(struct resv_map *map, struct list_head *rg, long from, record_hugetlb_cgroup_uncharge_info(cg, h, map, nrg); list_add(&nrg->link, rg); coalesce...
94350fe6cad77b46c3dcb8c96543bef7647efbc0
Analyze and fix the following issue in the Linux kernel code: mm/highmem: fix __kmap_to_page() build error
Problem Details: This changes fixes following build error which is a miss from ef6e06b2ef87 ("highmem: fix kmap_to_page() for kmap_local_page() addresses"). mm/highmem.c:184:66: error: 'pteval' undeclared (first use in this function); did you mean 'pte_val'? 184 | idx = arch_kmap_local_map_idx(i, pte_pfn(pteval)); In...
```diff diff --git a/mm/highmem.c b/mm/highmem.c index b5c8e4c2d5d4..a33e41183951 100644 --- a/mm/highmem.c +++ b/mm/highmem.c @@ -180,12 +180,13 @@ struct page *__kmap_to_page(void *vaddr) for (i = 0; i < kctrl->idx; i++) { unsigned long base_addr; int idx; + pte_t pteval = kctrl->pteval[i]; idx = a...
a45088376d8a847a5e3b1982fcfceb41644e3b1d
Analyze and fix the following issue in the Linux kernel code: mm/vmscan: add tracepoint and reason for kswapd_failures reset
Problem Details: Currently, kswapd_failures is reset in multiple places (kswapd, direct reclaim, PCP freeing, memory-tiers), but there's no way to trace when and why it was reset, making it difficult to debug memory reclaim issues. This patch: 1. Introduce kswapd_clear_hopeless() as a wrapper function to centraliz...
```diff diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 8881198e85c6..3e51190a55e4 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1534,16 +1534,27 @@ static inline unsigned long pgdat_end_pfn(pg_data_t *pgdat) #include <linux/memory_hotplug.h> void build_all_zonelists(pg_dat...
dc9fe9b7056a44ad65715def880e7d91d32c047f
Analyze and fix the following issue in the Linux kernel code: mm/vmscan: mitigate spurious kswapd_failures reset from direct reclaim
Problem Details: Patch series "mm/vmscan: add tracepoint and reason for kswapd_failures reset", v4. Currently, kswapd_failures is reset in multiple places (kswapd, direct reclaim, PCP freeing, memory-tiers), but there's no way to trace when and why it was reset, making it difficult to debug memory reclaim issues. Thi...
```diff diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index eb3815fc94ad..8881198e85c6 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1536,6 +1536,8 @@ static inline unsigned long pgdat_end_pfn(pg_data_t *pgdat) void build_all_zonelists(pg_data_t *pgdat); void wakeup_kswapd(struct...
5898aa8f9a0b42fe1f65c7364010ab15ec5c38bf
Analyze and fix the following issue in the Linux kernel code: mm: fix OOM killer inaccuracy on large many-core systems
Problem Details: Use the precise, albeit slower, precise RSS counter sums for the OOM killer task selection and console dumps. The approximated value is too imprecise on large many-core systems. The following rss tracking issues were noted by Sweet Tea Dorminy [1], which lead to picking wrong tasks as OOM kill target...
```diff diff --git a/include/linux/mm.h b/include/linux/mm.h index aacabf8a0b58..aa90719234f1 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2906,6 +2906,13 @@ static inline unsigned long get_mm_rss(struct mm_struct *mm) get_mm_counter(mm, MM_SHMEMPAGES); } +static inline unsigned long get_mm_rss_su...
77bcee8d4015a1191e1e3f5c5c51589086493ab0
Analyze and fix the following issue in the Linux kernel code: alloc_tag: fix rw permission issue when handling boot parameter
Problem Details: Boot parameters prefixed with "sysctl." are processed during the final stage of system initialization via kernel_init()-> do_sysctl_args(). When CONFIG_MEM_ALLOC_PROFILING_DEBUG is enabled, the sysctl.vm.mem_profiling entry is not writable and will cause a warning. Before run_init_process(), system i...
```diff diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c index 846a5b5b44a4..00ae4673a271 100644 --- a/lib/alloc_tag.c +++ b/lib/alloc_tag.c @@ -776,8 +776,22 @@ EXPORT_SYMBOL(page_alloc_tagging_ops); static int proc_mem_profiling_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, l...
6e31add91a10e3804f020ec4e87cb9c3b2b6c3ec
Analyze and fix the following issue in the Linux kernel code: vmw_balloon: adjust BALLOON_DEFLATE when deflating while migrating
Problem Details: Patch series "mm: balloon infrastructure cleanups", v3. I started with wanting to remove the dependency of the balloon infrastructure on the page lock, but ended up performing various other cleanups, some of which I had on my todo list for years. This series heavily cleans up and simplifies our ballo...
```diff diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index cc1d18b3df5c..2cc34c4968fa 100644 --- a/drivers/misc/vmw_balloon.c +++ b/drivers/misc/vmw_balloon.c @@ -1818,6 +1818,8 @@ static int vmballoon_migratepage(struct balloon_dev_info *b_dev_info, if (status == VMW_BALLOON_SUCCESS) { bal...
7832e4d583ee7c6a7907731c568ca40b160d8a5e
Analyze and fix the following issue in the Linux kernel code: mm/khugepaged: remove unnecessary goto 'skip' label
Problem Details: Patch series "mm/khugepaged: cleanups and scan limit fix", v3. This series contains several cleanups for mm/khugepaged.c to improve code readability and type safety, and one functional fix to ensure khugepaged_scan_mm_slot() correctly accounts for small VMAs towards scan limit. This patch (of 4): R...
```diff diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 16582bdcb6ff..984294a16861 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -2442,14 +2442,15 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages, int *result, break; } if (!thp_vma_allowable_order(vma, vma->vm_flags, TVA_KHUGEPAG...
842b6520e579b8bd7d6ea09937e1fb7729cce1c5
Analyze and fix the following issue in the Linux kernel code: selftests: ublk: refactor test_loop_08 into separate functions
Problem Details: Encapsulate each test case in its own function for better organization and maintainability: - _setup_device(): device and backfile initialization - _test_fill_and_verify(): initial data population - _test_corrupted_reftag(): reftag corruption detection test - _test_corrupted_data(): data corruption de...
```diff diff --git a/tools/testing/selftests/ublk/test_loop_08.sh b/tools/testing/selftests/ublk/test_loop_08.sh index 2caa7ba748fb..aaf1f52da559 100755 --- a/tools/testing/selftests/ublk/test_loop_08.sh +++ b/tools/testing/selftests/ublk/test_loop_08.sh @@ -13,98 +13,129 @@ if [[ "$fio_version" =~ fio-[0-9]+\.[0-9]+$ ...
8798902f2b8bcae6f90229a1a1496b48ddda2972
Analyze and fix the following issue in the Linux kernel code: bpf: Add bpf_jit_supports_fsession()
Problem Details: The added fsession does not prevent running on those architectures, that haven't added fsession support. For example, try to run fsession tests on arm64: test_fsession_basic:PASS:fsession_test__open_and_load 0 nsec test_fsession_basic:PASS:fsession_attach 0 nsec check_result:FAIL:test_run_opts err un...
```diff diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index 5a075e06cf45..070ba80e39d7 100644 --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c @@ -4112,3 +4112,8 @@ bool bpf_jit_supports_timed_may_goto(void) { return true; } + +bool bpf_jit_supports_fsession(void) +{ + re...
6557f1565d779851c4db9c488c49c05a47a6e72f
Analyze and fix the following issue in the Linux kernel code: bpf: Fix bpf_xdp_store_bytes proto for read-only arg
Problem Details: While making some maps in Cilium read-only from the BPF side, we noticed that the bpf_xdp_store_bytes proto is incorrect. In particular, the verifier was throwing the following error: ; ret = ctx_store_bytes(ctx, l3_off + offsetof(struct iphdr, saddr), &nat->address, 4, 0);...
```diff diff --git a/net/core/filter.c b/net/core/filter.c index d14401193b01..f04982d79d72 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -4135,7 +4135,7 @@ static const struct bpf_func_proto bpf_xdp_store_bytes_proto = { .ret_type = RET_INTEGER, .arg1_type = ARG_PTR_TO_CTX, .arg2_type = ARG_ANYTHING,...
fdf3f6800be36377e045e2448087f12132b88d2f
Analyze and fix the following issue in the Linux kernel code: net: don't touch dev->stats in BPF redirect paths
Problem Details: Gal reports that BPF redirect increments dev->stats.tx_errors on failure. This is not correct, most modern drivers completely ignore dev->stats so these drops will be invisible to the user. Core code should use the dedicated core stats which are folded into device stats in dev_get_stats(). Note that w...
```diff diff --git a/net/core/filter.c b/net/core/filter.c index bcd73d9bd764..029e560e32ce 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -2289,12 +2289,12 @@ static int __bpf_redirect_neigh_v6(struct sk_buff *skb, struct net_device *dev, err = bpf_out_neigh_v6(net, skb, dev, nh); if (unlikely(net_xmi...
4923bbff0bcffe488b3aa76829c829bd15b02585
Analyze and fix the following issue in the Linux kernel code: hwmon: (nct7363) Fix a resource leak in nct7363_present_pwm_fanin
Problem Details: When calling of_parse_phandle_with_args(), the caller is responsible to call of_node_put() to release the reference of device node. In nct7363_present_pwm_fanin, it does not release the reference, causing a resource leak. Signed-off-by: Felix Gu <gu_0233@qq.com> Link: https://lore.kernel.org/r/tencent...
```diff diff --git a/drivers/hwmon/nct7363.c b/drivers/hwmon/nct7363.c index 4946d59ff807..20f14d5e0c94 100644 --- a/drivers/hwmon/nct7363.c +++ b/drivers/hwmon/nct7363.c @@ -349,6 +349,7 @@ static int nct7363_present_pwm_fanin(struct device *dev, if (ret) return ret; + of_node_put(args.np); if (args.args[0] >...
2954ce672b7623478c1cfeb69e6a6e4042a3656e
Analyze and fix the following issue in the Linux kernel code: hwmon: (emc2305) Fix a resource leak in emc2305_of_parse_pwm_child
Problem Details: When calling of_parse_phandle_with_args(), the caller is responsible to call of_node_put() to release the reference of device node. In emc2305_of_parse_pwm_child, it does not release the reference, causing a resource leak. Signed-off-by: Felix Gu <gu_0233@qq.com> Link: https://lore.kernel.org/r/tencen...
```diff diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c index 8f80a39574f3..64b213e1451e 100644 --- a/drivers/hwmon/emc2305.c +++ b/drivers/hwmon/emc2305.c @@ -578,6 +578,7 @@ static int emc2305_of_parse_pwm_child(struct device *dev, data->pwm_output_mask |= EMC2305_OPEN_DRAIN << ch; } + of_node_p...
d4168cb6ae4f77779c8ceb1edf15b8eae95bdf7f
Analyze and fix the following issue in the Linux kernel code: hwmon: (acpi_power_meter) Replace deprecated strcpy() with strscpy()
Problem Details: strcpy() performs no bounds checking on the destination buffer, which could result in linear overflows beyond the end of the buffer. Although the source strings here are compile-time constants that fit within the destination buffers, using strscpy() is the preferred approach as it provides bounds check...
```diff diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c index de408df0c4d7..7cb66216f358 100644 --- a/drivers/hwmon/acpi_power_meter.c +++ b/drivers/hwmon/acpi_power_meter.c @@ -900,8 +900,8 @@ static int acpi_power_meter_add(struct acpi_device *device) resource->sensors_valid = 0; ...
246167b17c14e8a5142368ac6457e81622055e0a
Analyze and fix the following issue in the Linux kernel code: hwmon: (nct6775) Add ASUS Pro WS WRX90E-SAGE SE
Problem Details: Boards Pro WS WRX90E-SAGE SE has got a nct6775 chip, but by default there's no use of it because of resource conflict with WMI method. Add the board to the WMI monitoring list. Link: https://bugzilla.kernel.org/show_bug.cgi?id=204807 Signed-off-by: Denis Pauk <pauk.denis@gmail.com> Tested-by: Marcus ...
```diff diff --git a/drivers/hwmon/nct6775-platform.c b/drivers/hwmon/nct6775-platform.c index c3a719aef1ac..555029dfe713 100644 --- a/drivers/hwmon/nct6775-platform.c +++ b/drivers/hwmon/nct6775-platform.c @@ -1357,6 +1357,7 @@ static const char * const asus_msi_boards[] = { "Pro WS W680-ACE IPMI", "Pro WS W790-AC...
141d3002521609991bc016c79ed05f10a0189e8d
Analyze and fix the following issue in the Linux kernel code: hwmon: Use sysfs_emit in show function callbacks
Problem Details: Use sysfs_emit() over sprintf() to prevent potential overflows. In hwmon_attr_show() that is totally impossible but looking other places many still use sysfs_emit(). Also according Documentation/filesystems/sysfs.rst code should use sysfs_emit(). Signed-off-by: Kari Argillander <kari.argillander@gmai...
```diff diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index 7a784d685d77..714caa6a36a3 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -73,7 +73,7 @@ struct hwmon_thermal_data { static ssize_t name_show(struct device *dev, struct device_attribute *attr, char *buf) { - return sprintf(bu...
aa8126b914a767ccacaad53596193d4b97abcd58
Analyze and fix the following issue in the Linux kernel code: hwmon: Fix wrong return errno in *sanitize_name()
Problem Details: Currently if user of *sanitize_name() function gives nullptr for name they get's ENOMEM. Logically it should be EINVAL. Signed-off-by: Kari Argillander <kari.argillander@gmail.com> Link: https://lore.kernel.org/r/20251219-hwmon-fixes-v1-1-21b29097ea3b@gmail.com Signed-off-by: Guenter Roeck <linux@roec...
```diff diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index 0b4bdcd33c7b..7a784d685d77 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -1260,6 +1260,9 @@ static char *__hwmon_sanitize_name(struct device *dev, const char *old_name) */ char *hwmon_sanitize_name(const char *name) { + if ...
d0a0960602f780362ea974c80650d87bcf13726a
Analyze and fix the following issue in the Linux kernel code: hwmon: submitting-patches: Explain race conditions caused by calculations in macros
Problem Details: The current documentation advises against calculations in macros primarily to avoid code obfuscation. It misses the risk of concurrency issues. Add a note explaining that macros evaluating arguments multiple times can lead to race conditions when accessing shared data. Link: https://lore.kernel.org/a...
```diff diff --git a/Documentation/hwmon/submitting-patches.rst b/Documentation/hwmon/submitting-patches.rst index 6482c4f137dc..7f7095951750 100644 --- a/Documentation/hwmon/submitting-patches.rst +++ b/Documentation/hwmon/submitting-patches.rst @@ -82,7 +82,10 @@ increase the chances of your change being accepted. *...
615901b57b7ef8eb655f71358f7e956e42bcd16b
Analyze and fix the following issue in the Linux kernel code: hwmon: (acpi_power_meter) Fix deadlocks related to acpi_power_meter_notify()
Problem Details: The acpi_power_meter driver's .notify() callback function, acpi_power_meter_notify(), calls hwmon_device_unregister() under a lock that is also acquired by callbacks in sysfs attributes of the device being unregistered which is prone to deadlocks between sysfs access and device removal. Address this b...
```diff diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c index 29ccdc2fb7ff..de408df0c4d7 100644 --- a/drivers/hwmon/acpi_power_meter.c +++ b/drivers/hwmon/acpi_power_meter.c @@ -47,6 +47,8 @@ static int cap_in_hardware; static bool force_cap_on; +static DEFINE_MUTEX(acpi_notify_lock...
8e24994872361212531a952c93adb01c485148f1
Analyze and fix the following issue in the Linux kernel code: kbuild: Do not run kernel-doc when building external modules
Problem Details: After commit 778b8ebe5192 ("docs: Move the python libraries to tools/lib/python"), building an external module with any value of W= against the output of install-extmod-build fails with: $ make -C /usr/lib/modules/6.19.0-rc7-00108-g4d310797262f/build M=$PWD W=1 make: Entering directory '/usr/lib/m...
```diff diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 5037f4715d74..f01d7957edf7 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -166,11 +166,13 @@ else ifeq ($(KBUILD_CHECKSRC),2) cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< endif +ifeq ($(KBUILD_EXTMOD...
3a4d8bed0b47543b2dfce0b1d714b40d68ff2f7e
Analyze and fix the following issue in the Linux kernel code: selftests: ublk: derive TID automatically from script name
Problem Details: Add automatic TID derivation in test_common.sh based on the script filename. The TID is extracted by stripping the "test_" prefix and ".sh" suffix from the script name (e.g., test_loop_01.sh -> loop_01). This removes the need for each test script to manually define TID, reducing boilerplate and preven...
```diff diff --git a/tools/testing/selftests/ublk/test_batch_01.sh b/tools/testing/selftests/ublk/test_batch_01.sh index 9fa9fff5c62f..a18fb39af8be 100755 --- a/tools/testing/selftests/ublk/test_batch_01.sh +++ b/tools/testing/selftests/ublk/test_batch_01.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_co...
ed9f54cc1e335096733aed03c2a46de3d58922ed
Analyze and fix the following issue in the Linux kernel code: ublk: use READ_ONCE() to read struct ublksrv_ctrl_cmd
Problem Details: struct ublksrv_ctrl_cmd is part of the io_uring_sqe, which may lie in userspace-mapped memory. It's racy to access its fields with normal loads, as userspace may write to them concurrently. Use READ_ONCE() to copy the ublksrv_ctrl_cmd from the io_uring_sqe to the stack. Use the local copy in place of t...
```diff diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 01088194c8d3..8122b012a7ae 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -4731,12 +4731,11 @@ static int ublk_ctrl_del_dev(struct ublk_device **p_ub, bool wait) return 0; } -static inline void ublk_ctrl_cmd_dum...
da7e4b75e50c087d2031a92f6646eb90f7045a67
Analyze and fix the following issue in the Linux kernel code: ublk: Validate SQE128 flag before accessing the cmd
Problem Details: ublk_ctrl_cmd_dump() accesses (header *)sqe->cmd before IO_URING_F_SQE128 flag check. This could cause out of boundary memory access. Move the SQE128 flag check earlier in ublk_ctrl_uring_cmd() to return -EINVAL immediately if the flag is not set. Fixes: 71f28f3136af ("ublk_drv: add io_uring based us...
```diff diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 5efaf53261ce..01088194c8d3 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -5221,10 +5221,10 @@ static int ublk_ctrl_uring_cmd(struct io_uring_cmd *cmd, issue_flags & IO_URING_F_NONBLOCK) return -EAGAIN; - ...
23ea2a4c72323feb6e3e025e8a6f18336513d5ad
Analyze and fix the following issue in the Linux kernel code: ARM: 9468/1: fix memset64() on big-endian
Problem Details: On big-endian systems the 32-bit low and high halves need to be swapped for the underlying assembly implementation to work correctly. Fixes: fd1d362600e2 ("ARM: implement memset32 & memset64") Cc: stable@vger.kernel.org Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Reviewed-by: Mat...
```diff diff --git a/arch/arm/include/asm/string.h b/arch/arm/include/asm/string.h index 6c607c68f3ad..c35250c4991b 100644 --- a/arch/arm/include/asm/string.h +++ b/arch/arm/include/asm/string.h @@ -42,7 +42,10 @@ static inline void *memset32(uint32_t *p, uint32_t v, __kernel_size_t n) extern void *__memset64(uint64_t...
80f1a2c2332fee0edccd006fe87fc8a6db94bab3
Analyze and fix the following issue in the Linux kernel code: iommu/tegra241-cmdqv: Reset VCMDQ in tegra241_vcmdq_hw_init_user()
Problem Details: The Enable bits in CMDQV/VINTF/VCMDQ_CONFIG registers do not actually reset the HW registers. So, the driver explicitly clears all the registers when a VINTF or VCMDQ is being initialized calling its hw_deinit() function. However, a userspace VCMDQ is not properly reset, unlike an in-kernel VCMDQ gett...
```diff diff --git a/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c b/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c index 378104cd395e..04cc7a9036e4 100644 --- a/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c +++ b/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c @@ -1078,6 +1078,9 @@ static int tegra241_vcmdq_hw_init_u...
bc367775f60214312befa33f101b31fe74bba48a
Analyze and fix the following issue in the Linux kernel code: f2fs: introduce trace_f2fs_priority_update
Problem Details: This patch introduces two new tracepoints for debug purpose. Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
```diff diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 2f5a03e29d0b..4afa5d9a19fc 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -130,9 +130,13 @@ static void uplift_priority(struct f2fs_rwsem *sem, struct f2fs_lock_context *lc return; set_user_nice(current, lc->new_nice); lc->ne...
07de55cbf5762cb4a7e9e0db7aba5c10c8cfe079
Analyze and fix the following issue in the Linux kernel code: f2fs: fix lock priority inversion issue
Problem Details: If userspace thread has held f2fs rw semaphore, due to its low priority, it could be runnable or preempted state for long time, during the time, it will block high priority thread which is trying to grab the same rw semaphore, e.g. cp_rwsem, io_rwsem... To fix such issue, let's detect thread's priorit...
```diff diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs index 9a8ec2290f68..ea6474db8a31 100644 --- a/Documentation/ABI/testing/sysfs-fs-f2fs +++ b/Documentation/ABI/testing/sysfs-fs-f2fs @@ -963,3 +963,27 @@ Description: This sysfs entry can be used to change type of inje...
d860974a7e38d35e9e2c4dc8a9f4223b38b6ad99
Analyze and fix the following issue in the Linux kernel code: f2fs: optimize f2fs_overwrite_io() for f2fs_iomap_begin
Problem Details: When overwriting already allocated blocks, f2fs_iomap_begin() calls f2fs_overwrite_io() to check block mappings. However, f2fs_overwrite_io() iterates through all mapped blocks in the range, which can be inefficient for fragmented files with large I/O requests. This patch optimizes f2fs_overwrite_io()...
```diff diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 84746a06cd58..f70efb040c73 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1865,7 +1865,8 @@ out: return err; } -bool f2fs_overwrite_io(struct inode *inode, loff_t pos, size_t len) +static bool __f2fs_overwrite_io(struct inode *inode, loff_t pos, size...
df31a6b0a3057e66994ad6ccf5d95b9b9514f033
Analyze and fix the following issue in the Linux kernel code: Revert "net/smc: Introduce TCP ULP support"
Problem Details: This reverts commit d7cd421da9da2cc7b4d25b8537f66db5c8331c40. As reported by Al Viro, the TCP ULP support for SMC is fundamentally broken. The implementation attempts to convert an active TCP socket into an SMC socket by modifying the underlying `struct file`, dentry, and inode in-place, which violate...
```diff diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index f97f77b041d9..d8201eb3ac5f 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -3357,11 +3357,10 @@ int smc_create_clcsk(struct net *net, struct sock *sk, int family) return 0; } -static int __smc_create(struct net *net, struct socket *sock, int pr...
82fff3b055d498bde37104eab219be25af3ddbe9
Analyze and fix the following issue in the Linux kernel code: net: ax25: remove plumbing for never-implemented DAMA Master support
Problem Details: The AX25_DAMA_MASTER option has been unimplemented and marked broken ever since it was introduced in 2007 in commit 954b2e7f4c37 ("[NET] AX.25 Kconfig and docs updates and fixes"). At this point, it is very unlikely it will be implemented. Remove it. Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gma...
```diff diff --git a/include/net/ax25.h b/include/net/ax25.h index a7bba42dde15..ad3d7626130e 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h @@ -116,10 +116,6 @@ enum { AX25_PROTO_STD_DUPLEX, #ifdef CONFIG_AX25_DAMA_SLAVE AX25_PROTO_DAMA_SLAVE, -#ifdef CONFIG_AX25_DAMA_MASTER - AX25_PROTO_DAMA_MASTER, -#...
7d43252b3060b0ba4a192dce5dba85a3f39ffe39
Analyze and fix the following issue in the Linux kernel code: crypto: caam - fix netdev memory leak in dpaa2_caam_probe
Problem Details: When commit 0e1a4d427f58 ("crypto: caam: Unembed net_dev structure in dpaa2") converted embedded net_device to dynamically allocated pointers, it added cleanup in dpaa2_dpseci_disable() but missed adding cleanup in dpaa2_dpseci_free() for error paths. This causes memory leaks when dpaa2_dpseci_dpio_se...
```diff diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c index 107ccb2ade42..c6117c23eb25 100644 --- a/drivers/crypto/caam/caamalg_qi2.c +++ b/drivers/crypto/caam/caamalg_qi2.c @@ -4814,7 +4814,8 @@ static void dpaa2_dpseci_free(struct dpaa2_caam_priv *priv) { struct device *dev = p...
3d3135057ff567d5c09fff4c9ef6391a684e8042
Analyze and fix the following issue in the Linux kernel code: crypto: hisilicon/trng - support tfms sharing the device
Problem Details: Since the number of devices is limited, and the number of tfms may exceed the number of devices, to ensure that tfms can be successfully allocated, support tfms sharing the same device. Fixes: e4d9d10ef4be ("crypto: hisilicon/trng - add support for PRNG") Signed-off-by: Weili Qian <qianweili@huawei.co...
```diff diff --git a/drivers/crypto/hisilicon/trng/trng.c b/drivers/crypto/hisilicon/trng/trng.c index ac74df4a9471..5ca0b90859a8 100644 --- a/drivers/crypto/hisilicon/trng/trng.c +++ b/drivers/crypto/hisilicon/trng/trng.c @@ -40,6 +40,7 @@ #define SEED_SHIFT_24 24 #define SEED_SHIFT_16 16 #define SEED_SHIFT_8 8 ...
14f86a1155cca1176abf55987b2fce7f7fcb2455
Analyze and fix the following issue in the Linux kernel code: crypto: virtio - Remove duplicated virtqueue_kick in virtio_crypto_skcipher_crypt_req
Problem Details: With function virtio_crypto_skcipher_crypt_req(), there is already virtqueue_kick() call with spinlock held in function __virtio_crypto_skcipher_do_req(). Remove duplicated virtqueue_kick() function call here. Fixes: d79b5d0bbf2e ("crypto: virtio - support crypto engine framework") Cc: stable@vger.ker...
```diff diff --git a/drivers/crypto/virtio/virtio_crypto_skcipher_algs.c b/drivers/crypto/virtio/virtio_crypto_skcipher_algs.c index 1b3fb21a2a7d..11053d1786d4 100644 --- a/drivers/crypto/virtio/virtio_crypto_skcipher_algs.c +++ b/drivers/crypto/virtio/virtio_crypto_skcipher_algs.c @@ -541,8 +541,6 @@ int virtio_crypto...
b505047ffc8057555900d2d3a005d033e6967382
Analyze and fix the following issue in the Linux kernel code: crypto: virtio - Add spinlock protection with virtqueue notification
Problem Details: When VM boots with one virtio-crypto PCI device and builtin backend, run openssl benchmark command with multiple processes, such as openssl speed -evp aes-128-cbc -engine afalg -seconds 10 -multi 32 openssl processes will hangup and there is error reported like this: virtio_crypto virtio0: dataq.0...
```diff diff --git a/drivers/crypto/virtio/virtio_crypto_core.c b/drivers/crypto/virtio/virtio_crypto_core.c index 3d241446099c..ccc6b5c1b24b 100644 --- a/drivers/crypto/virtio/virtio_crypto_core.c +++ b/drivers/crypto/virtio/virtio_crypto_core.c @@ -75,15 +75,20 @@ static void virtcrypto_done_task(unsigned long data) ...
6d06bc83a5ae8777a5f7a81c32dd75b8d9b2fe04
Analyze and fix the following issue in the Linux kernel code: net: usb: r8152: fix resume reset deadlock
Problem Details: rtl8152 can trigger device reset during reset which potentially can result in a deadlock: **** DPM device timeout after 10 seconds; 15 seconds until panic **** Call Trace: <TASK> schedule+0x483/0x1370 schedule_preempt_disabled+0x15/0x30 __mutex_lock_common+0x1fd/0x470 __rtl8152_set_mac_address+...
```diff diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index fa5192583860..2f3baa5f6e9c 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -8535,19 +8535,6 @@ static int rtl8152_system_resume(struct r8152 *tp) usb_submit_urb(tp->intr_urb, GFP_NOIO); } - /* If the device is RTL8...
dccd23a673ca09505b53fe10bccdd0421ad6cf80
Analyze and fix the following issue in the Linux kernel code: net: wwan: core: split port creation and registration
Problem Details: Upcoming GNSS (NMEA) port type support requires exporting it via the GNSS subsystem. On another hand, we still need to do basic WWAN core work: find or allocate the WWAN device, make it the port parent, etc. To reuse as much code as possible, split the port creation function into the registration of a ...
```diff diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c index 1da935e84008..76f1d759d255 100644 --- a/drivers/net/wwan/wwan_core.c +++ b/drivers/net/wwan/wwan_core.c @@ -357,7 +357,8 @@ static void wwan_port_destroy(struct device *dev) { struct wwan_port *port = to_wwan_port(dev); - ida_fr...
b9879ba78dca3da61448b52751551da2bb52469c
Analyze and fix the following issue in the Linux kernel code: net: wwan: core: explicit WWAN device reference counting
Problem Details: We need information about existing WWAN device children since we remove the device after removing the last child. Previously, we tracked users implicitly by checking whether ops was registered and existence of a child device of the wwan_class class. Upcoming GNSS (NMEA) port type support breaks this ap...
```diff diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c index ade8bbffc93e..1da935e84008 100644 --- a/drivers/net/wwan/wwan_core.c +++ b/drivers/net/wwan/wwan_core.c @@ -42,6 +42,9 @@ static struct dentry *wwan_debugfs_dir; * struct wwan_device - The structure that defines a WWAN device * ...
f8db6475a83649689c087a8f52486fcc53e627e9
Analyze and fix the following issue in the Linux kernel code: macvlan: fix error recovery in macvlan_common_newlink()
Problem Details: valis provided a nice repro to crash the kernel: ip link add p1 type veth peer p2 ip link set address 00:00:00:00:00:20 dev p1 ip link set up dev p1 ip link set up dev p2 ip link add mv0 link p2 type macvlan mode source ip link add invalid% link p2 type macvlan mode source macaddr add 00:00:00:00:00:...
```diff diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index b4df7e184791..c509228be84d 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -1567,9 +1567,10 @@ destroy_macvlan_port: /* the macvlan port may be freed by macvlan_uninit when fail to register. * so we destroy the macvlan port ...
adcbadfd8e05d3558c9cfaa783f17c645181165f
Analyze and fix the following issue in the Linux kernel code: net: sfp: Fix quirk for Ubiquiti U-Fiber Instant SFP module
Problem Details: Commit fd580c9830316eda ("net: sfp: augment SFP parsing with phy_interface_t bitmap") did not add augumentation for the interface bitmap in the quirk for Ubiquiti U-Fiber Instant. The subsequent commit f81fa96d8a6c7a77 ("net: phylink: use phy_interface_t bitmaps for optical modules") then changed phyl...
```diff diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index 47f095bd91ce..3e023723887c 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -479,6 +479,8 @@ static void sfp_quirk_ubnt_uf_instant(const struct sfp_eeprom_id *id, linkmode_zero(caps->link_modes); linkmode_set_bit(ETHTOOL_LINK_...
da9934a6583adc40ac0c9cc21e7419617ad985fd
Analyze and fix the following issue in the Linux kernel code: dt-bindings: rtc: loongson: Correct Loongson-1C interrupts property
Problem Details: The `interrupts` property indicates an RTC alarm interrupt, which is required for RTCs that support the alarm feature, which is not supported by the Loongson-1C RTC. We exclude it for a more accurate description. Changing the `allowed` property is ABI-breaking behavior, but throughout the existing Loo...
```diff diff --git a/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml b/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml index f89c1f660aee..fac90a18153e 100644 --- a/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml +++ b/Documentation/devicetree/bindings/rtc/loongson,rtc.yaml @@ -42,6 +42,17 @@ re...
ed318b3fb4ab317c533d38d160326fa5d7569497
Analyze and fix the following issue in the Linux kernel code: i3c: dw-i3c-master: fix SIR reject bit mapping for dynamic addresses
Problem Details: The IBI_SIR_REQ_REJECT register is a 32-bit bitmap indexed by the dynamic address of each I3C slave. The DesignWare controller derives the bit index by folding the 7-bit dynamic address into a 5-bit value, using the sum of the lower 5 bits and the upper 2 bits, modulo 32. The current implementation in...
```diff diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c index d7df81c56667..7eb09ad10171 100644 --- a/drivers/i3c/master/dw-i3c-master.c +++ b/drivers/i3c/master/dw-i3c-master.c @@ -205,6 +205,10 @@ #define EXTENDED_CAPABILITY 0xe8 #define SLAVE_CONFIG 0xec +#define DYN_ADDR_...
2537089413514caaa9a5fdeeac3a34d45100f747
Analyze and fix the following issue in the Linux kernel code: i3c: dw: Fix memory leak in dw_i3c_master_i2c_xfers()
Problem Details: The dw_i3c_master_i2c_xfers() function allocates memory for the xfer structure using dw_i3c_master_alloc_xfer(). If pm_runtime_resume_and_get() fails, the function returns without freeing the allocated xfer, resulting in a memory leak. Add a dw_i3c_master_free_xfer() call to the error path to ensure t...
```diff diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c index e9b2c23ed171..cfc15aaf8c7b 100644 --- a/drivers/i3c/master/dw-i3c-master.c +++ b/drivers/i3c/master/dw-i3c-master.c @@ -1106,6 +1106,7 @@ static int dw_i3c_master_i2c_xfers(struct i2c_dev_desc *dev, dev_err(master->dev...
b58eaa4761ab02fc38c39d674a6bcdd55e00f388
Analyze and fix the following issue in the Linux kernel code: i3c: dw: Initialize spinlock to avoid upsetting lockdep
Problem Details: The devs_lock spinlock introduced when adding support for ibi:s was never initialized. Fixes: e389b1d72a624 ("i3c: dw: Add support for in-band interrupts") Suggested-by: Jani Nurminen <jani.nurminen@windriver.com> Signed-off-by: Fredrik Markstrom <fredrik.markstrom@est.tech> Reviewed-by: Ivar Holmqvis...
```diff diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c index 48af00659e19..e9b2c23ed171 100644 --- a/drivers/i3c/master/dw-i3c-master.c +++ b/drivers/i3c/master/dw-i3c-master.c @@ -1612,6 +1612,8 @@ int dw_i3c_common_probe(struct dw_i3c_master *master, spin_lock_init(&master->xfe...
c2012263047689e495e81c96d7d5b0586299578d
Analyze and fix the following issue in the Linux kernel code: crypto/ccp: Allow multiple streams on the same root bridge
Problem Details: With SEV-TIO the low-level TSM driver is responsible for allocating a Stream ID. The Stream ID needs to be unique within each IDE partner port. Fix the Stream ID selection to reuse the host bridge stream resource id which is a pool of 256 ids per host bridge on AMD platforms. Otherwise, only one device...
```diff diff --git a/drivers/crypto/ccp/sev-dev-tsm.c b/drivers/crypto/ccp/sev-dev-tsm.c index 7407b77c2ef2..40d02adaf3f6 100644 --- a/drivers/crypto/ccp/sev-dev-tsm.c +++ b/drivers/crypto/ccp/sev-dev-tsm.c @@ -198,8 +198,7 @@ static int stream_alloc(struct pci_dev *pdev, struct pci_ide **ide, if (!ide1) return -E...
403dd7da22461b0c7fd18d5cd4373b9a1ec8b5f7
Analyze and fix the following issue in the Linux kernel code: crypto/ccp: Use PCI bridge defaults for IDE
Problem Details: The current number of streams in AMD TSM is 1 which is too little, the core uses 255. Also, even if the module parameter is increased, calling pci_ide_set_nr_streams() second time triggers WARN_ON. Simplify the code by sticking to the PCI core defaults. Fixes: 4be423572da1 ("crypto/ccp: Implement SEV...
```diff diff --git a/drivers/crypto/ccp/sev-dev-tsm.c b/drivers/crypto/ccp/sev-dev-tsm.c index ea29cd5d0ff9..7407b77c2ef2 100644 --- a/drivers/crypto/ccp/sev-dev-tsm.c +++ b/drivers/crypto/ccp/sev-dev-tsm.c @@ -19,12 +19,6 @@ MODULE_IMPORT_NS("PCI_IDE"); -#define TIO_DEFAULT_NR_IDE_STREAMS 1 - -static uint nr_ide_...
76ed27608f7dd235b727ebbb12163438c2fbb617
Analyze and fix the following issue in the Linux kernel code: perf: sched: Fix perf crash with new is_user_task() helper
Problem Details: In order to do a user space stacktrace the current task needs to be a user task that has executed in user space. It use to be possible to test if a task is a user task or not by simply checking the task_struct mm field. If it was non NULL, it was a user task and if not it was a kernel task. But things...
```diff diff --git a/include/linux/sched.h b/include/linux/sched.h index da0133524d08..5f00b5ed0f3b 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1776,6 +1776,11 @@ static __always_inline bool is_percpu_thread(void) (current->nr_cpus_allowed == 1); } +static __always_inline bool is_user_task...
115135422562e2f791e98a6f55ec57b2da3b3a95
Analyze and fix the following issue in the Linux kernel code: sched/deadline: Fix 'stuck' dl_server
Problem Details: Andrea reported the dl_server getting stuck for him. He tracked it down to a state where dl_server_start() saw dl_defer_running==1, but the dl_server's job is no longer valid at the time of dl_server_start(). In the state diagram this corresponds to [4] D->A (or dl_server_stop() due to no more runnabl...
```diff diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index c509f2e7d69d..7bcde7114f1b 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1034,6 +1034,12 @@ static void update_dl_entity(struct sched_dl_entity *dl_se) return; } + /* + * When [4] D->A is followed by [1] A-...
4039fbedcbcb022704ff45533aa7860ce036ee6b
Analyze and fix the following issue in the Linux kernel code: NFS: fix delayed delegation return handling
Problem Details: Rework this code that was totally busted at least as of my most recent changes. Introduce a separate list for delayed delegations so that they can't get lost and don't clutter up the returns list. Add a missing spin_unlock in the helper marking it as a regular pending return. Fixes: 0ebe655bd033 ("NF...
```diff diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 6b9a65615a51..fd15731cf361 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -1063,6 +1063,7 @@ struct nfs_server *nfs_alloc_server(void) spin_lock_init(&server->delegations_lock); INIT_LIST_HEAD(&server->delegations_return); INIT_LIST_HEAD(&server-...
0207f94971e72a13380e28022c86da147e8e090f
Analyze and fix the following issue in the Linux kernel code: selftests/bpf: Fix kprobe multi stacktrace_ips test
Problem Details: We now include the attached function in the stack trace, fixing the test accordingly. Fixes: c9e208fa93cd ("selftests/bpf: Add stacktrace ips test for kprobe_multi/kretprobe_multi") Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel...
```diff diff --git a/tools/testing/selftests/bpf/prog_tests/stacktrace_ips.c b/tools/testing/selftests/bpf/prog_tests/stacktrace_ips.c index c9efdd2a5b18..c93718dafd9b 100644 --- a/tools/testing/selftests/bpf/prog_tests/stacktrace_ips.c +++ b/tools/testing/selftests/bpf/prog_tests/stacktrace_ips.c @@ -74,11 +74,20 @@ s...
aea251799998aa1b78eacdfb308f18ea114ea5b3
Analyze and fix the following issue in the Linux kernel code: x86/fgraph,bpf: Switch kprobe_multi program stack unwind to hw_regs path
Problem Details: Mahe reported missing function from stack trace on top of kprobe multi program. The missing function is the very first one in the stacktrace, the one that the bpf program is attached to. # bpftrace -e 'kprobe:__x64_sys_newuname* { print(kstack)}' Attaching 1 probe... do_syscall_64+134 ...
```diff diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h index b08c95872eed..c56e1e63b893 100644 --- a/arch/x86/include/asm/ftrace.h +++ b/arch/x86/include/asm/ftrace.h @@ -57,7 +57,7 @@ arch_ftrace_get_regs(struct ftrace_regs *fregs) } #define arch_ftrace_partial_regs(regs) do { \ - regs-...
8bc11700e0d23d4fdb7d8d5a73b2e95de427cabc
Analyze and fix the following issue in the Linux kernel code: x86/fgraph: Fix return_to_handler regs.rsp value
Problem Details: The previous change (Fixes commit) messed up the rsp register value, which is wrong because it's already adjusted with FRAME_SIZE, we need the original rsp value. This change does not affect fprobe current kernel unwind, the !perf_hw_regs path perf_callchain_kernel: if (perf_hw_regs(regs)) { ...
```diff diff --git a/arch/x86/kernel/ftrace_64.S b/arch/x86/kernel/ftrace_64.S index a132608265f6..62c1c93aa1c6 100644 --- a/arch/x86/kernel/ftrace_64.S +++ b/arch/x86/kernel/ftrace_64.S @@ -364,6 +364,9 @@ SYM_CODE_START(return_to_handler) UNWIND_HINT_UNDEFINED ANNOTATE_NOENDBR + /* Store original rsp for pt_reg...
6517dfbcc918f970a928d9dc17586904bac06893
Analyze and fix the following issue in the Linux kernel code: KVM: x86: Add x2APIC "features" to control EOI broadcast suppression
Problem Details: Add two flags for KVM_CAP_X2APIC_API to allow userspace to control support for Suppress EOI Broadcasts when using a split IRQCHIP (I/O APIC emulated by userspace), which KVM completely mishandles. When x2APIC support was first added, KVM incorrectly advertised and "enabled" Suppress EOI Broadcast, with...
```diff diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index 01a3abef8abb..f1f1d2e5dc7c 100644 --- a/Documentation/virt/kvm/api.rst +++ b/Documentation/virt/kvm/api.rst @@ -7835,8 +7835,10 @@ Will return -EBUSY if a VCPU has already been created. Valid feature flags in args[0] are:: -...
c0d6b8bbbced660e9c2efe079e2b2cb34b27d97f
Analyze and fix the following issue in the Linux kernel code: KVM: VMX: Print out "bad" offsets+value on VMCS config mismatch
Problem Details: When kvm-intel.ko refuses to load due to a mismatched VMCS config, print all mismatching offsets+values to make it easier to debug goofs during development, and to make it at least feasible to triage failures that occur during production. E.g. if a physical core is flaky or is running with the "wrong"...
```diff diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 8438799eed74..c105756e59f0 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -2921,8 +2921,23 @@ int vmx_check_processor_compat(void) } if (nested) nested_vmx_setup_ctls_msrs(&vmcs_conf, vmx_cap.ept); + if (memcmp(&vmc...
f8ade833b733ae0b72e87ac6d2202a1afbe3eb4a
Analyze and fix the following issue in the Linux kernel code: KVM: x86: Explicitly configure supported XSS from {svm,vmx}_set_cpu_caps()
Problem Details: Explicitly configure KVM's supported XSS as part of each vendor's setup flow to fix a bug where clearing SHSTK and IBT in kvm_cpu_caps, e.g. due to lack of CET XFEATURE support, makes kvm-intel.ko unloadable when nested VMX is enabled, i.e. when nested=1. The late clearing results in nested_vmx_setup_...
```diff diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 24d59ccfa40d..4394be40fe78 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -5284,6 +5284,8 @@ static __init void svm_set_cpu_caps(void) */ kvm_cpu_cap_clear(X86_FEATURE_BUS_LOCK_DETECT); kvm_cpu_cap_clear(X86_FEATURE_M...