id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
266e2fcfe2ea0d062ea392cd22f6250ae0d11c04
Analyze and fix the following issue in the Linux kernel code: drm/i915/dp_mst: Use the correct connector while computing the link BPP limit on MST
Problem Details: Atm, on an MST link in DSC mode intel_dp_compute_config_link_bpp_limits() calculates the maximum link bpp limit using the MST root connector's DSC capabilities. That's not correct in general: the decompression could be performed by a branch device downstream of the root branch device or the sink itself...
```diff diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 593b29b56714..ad1e4fc9c7fe 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -2524,6 +2524,7 @@ intel_dp_dsc_compute_pipe_bpp_limits(struct intel_dp *intel_dp,...
44b6535d8acebbbdb8b8e79b22118bb3d7fa93df
Analyze and fix the following issue in the Linux kernel code: drm/virtio: Fix NULL pointer deref in virtgpu_dma_buf_free_obj()
Problem Details: There is a chance that obj->dma_buf would be NULL by the time virtgpu_dma_buf_free_obj() is called. This can happen for imported prime objects, when drm_gem_object_exported_dma_buf_free() gets called on them before drm_gem_object_free(). This is because drm_gem_object_exported_dma_buf_free() explicitly...
```diff diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index f17660a71a3e..f7def8b42068 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -88,6 +88,7 @@ struct virtio_gpu_object_params { struct virtio_gpu_object { struct drm_ge...
386cd3dcfd63491619b4034b818737fc0219e128
Analyze and fix the following issue in the Linux kernel code: MAINTAINERS: Update Alexey Makhalov's email address
Problem Details: Fix a typo in an email address. Closes: https://lore.kernel.org/all/20240925-rational-succinct-vulture-cca9fb@lemur/T/ Reported-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org> Reported-by: Juergen Gross <jgross@suse.com> Signed-off-by: Alexey Makhalov <alexey.makhalov@broadcom.com> Signed-of...
```diff diff --git a/MAINTAINERS b/MAINTAINERS index 69511c3b2b76..0d3a252db2b6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -18373,7 +18373,7 @@ F: include/uapi/linux/ppdev.h PARAVIRT_OPS INTERFACE M: Juergen Gross <jgross@suse.com> R: Ajay Kaher <ajay.kaher@broadcom.com> -R: Alexey Makhalov <alexey.amakhalov@broa...
824c6384e8d9275d4ec7204f3f79a4ac6bc10379
Analyze and fix the following issue in the Linux kernel code: x86/mtrr: Check if fixed-range MTRRs exist in mtrr_save_fixed_ranges()
Problem Details: When suspending, save_processor_state() calls mtrr_save_fixed_ranges() to save fixed-range MTRRs. On platforms without fixed-range MTRRs like the ACRN hypervisor which has removed fixed-range MTRR emulation, accessing these MSRs will trigger an unchecked MSR access error. Make sure fixed-range MTRRs a...
```diff diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c index e2c6b471d230..8c18327eb10b 100644 --- a/arch/x86/kernel/cpu/mtrr/generic.c +++ b/arch/x86/kernel/cpu/mtrr/generic.c @@ -593,7 +593,7 @@ static void get_fixed_ranges(mtrr_type *frs) void mtrr_save_fixed_ranges(void *inf...
4ffb62fa8925c1c1591145ff0f5ccfd5918b40df
Analyze and fix the following issue in the Linux kernel code: RDMA/hns: Fix build error of hns_roce_trace
Problem Details: Add include path to find hns_roce_trace.h to fix the following build error: In file included from drivers/infiniband/hw/hns/hns_roce_trace.h:213, from drivers/infiniband/hw/hns/hns_roce_hw_v2.c:53: ./include/trace/define_trace.h:110:42: fatal error: ./hns_roce_trace.h: No such file or...
```diff diff --git a/drivers/infiniband/hw/hns/Makefile b/drivers/infiniband/hw/hns/Makefile index 7917af8e6380..baf592e6f21b 100644 --- a/drivers/infiniband/hw/hns/Makefile +++ b/drivers/infiniband/hw/hns/Makefile @@ -4,6 +4,7 @@ # ccflags-y := -I $(srctree)/drivers/net/ethernet/hisilicon/hns3 +ccflags-y += -I $...
69efbff69f89c9b2b72c4d82ad8b59706add768a
Analyze and fix the following issue in the Linux kernel code: fuse: fix race between concurrent setattrs from multiple nodes
Problem Details: When mounting a user-space filesystem on multiple clients, after concurrent ->setattr() calls from different node, stale inode attributes may be cached in some node. This is caused by fuse_setattr() racing with fuse_reverse_inval_inode(). When filesystem server receives setattr request, the client no...
```diff diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 1fb0b15a6088..b670f1da31e6 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1963,6 +1963,7 @@ int fuse_do_setattr(struct mnt_idmap *idmap, struct dentry *dentry, int err; bool trust_local_cmtime = is_wb; bool fault_blocked = false; + u64 attr_version; ...
42055939a3a4cac8afbebff85a29571c2bd3238c
Analyze and fix the following issue in the Linux kernel code: rust: devres: fix doctest build under `!CONFIG_PCI`
Problem Details: The doctest requires `CONFIG_PCI`: error[E0432]: unresolved import `kernel::pci` --> rust/doctests_kernel_generated.rs:2689:44 | 2689 | use kernel::{device::Core, devres::Devres, pci}; | ^^^ no `pci` in the root | ...
```diff diff --git a/rust/kernel/devres.rs b/rust/kernel/devres.rs index b67247db92c7..0f79a2ec9474 100644 --- a/rust/kernel/devres.rs +++ b/rust/kernel/devres.rs @@ -195,6 +195,7 @@ impl<T> Devres<T> { /// # Example /// /// ```no_run + /// # #![cfg(CONFIG_PCI)] /// # use kernel::{device::Core, d...
9c1798259b9420f38f1fa1b83e3d864c3eb1a83e
Analyze and fix the following issue in the Linux kernel code: drm/tiny: panel-mipi-dbi: Use drm_client_setup_with_fourcc()
Problem Details: Since commit 559358282e5b ("drm/fb-helper: Don't use the preferred depth for the BPP default"), RGB565 displays such as the CFAF240320X no longer render correctly: colors are distorted and the content is shown twice horizontally. This regression is due to the fbdev emulation layer defaulting to 32 bit...
```diff diff --git a/drivers/gpu/drm/tiny/panel-mipi-dbi.c b/drivers/gpu/drm/tiny/panel-mipi-dbi.c index 0460ecaef4bd..23914a9f7fd3 100644 --- a/drivers/gpu/drm/tiny/panel-mipi-dbi.c +++ b/drivers/gpu/drm/tiny/panel-mipi-dbi.c @@ -390,7 +390,10 @@ static int panel_mipi_dbi_spi_probe(struct spi_device *spi) spi_set_...
0169a24036848cf18205301673259bb6879eef97
Analyze and fix the following issue in the Linux kernel code: memory: stm32_omm: Fix NULL vs IS_ERR() check in probe()
Problem Details: The platform_get_resource_byname() function returns NULL on error. It doesn't return error pointers. Update the check to match. Fixes: 8181d061dcff ("memory: Add STM32 Octo Memory Manager driver") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/a1645f1eedaa9b2...
```diff diff --git a/drivers/memory/stm32_omm.c b/drivers/memory/stm32_omm.c index 8704c774e642..8523d9601af2 100644 --- a/drivers/memory/stm32_omm.c +++ b/drivers/memory/stm32_omm.c @@ -320,8 +320,8 @@ static int stm32_omm_probe(struct platform_device *pdev) return PTR_ERR(omm->io_base); omm->mm_res = platform_...
d44eeb20d9bedce11297a09628ba5dd39db236be
Analyze and fix the following issue in the Linux kernel code: memory: stm32_omm: Fix error handling in stm32_omm_configure()
Problem Details: There are two error handling bugs in the stm32_omm_configure() function. 1) The error code needs to be set if clk_get_rate() fails. 2) If devm_reset_control_get_exclusive() then call pm_runtime_put_sync_suspend() before returning. Fixes: 8181d061dcff ("memory: Add STM32 Octo Memory Manager driver")...
```diff diff --git a/drivers/memory/stm32_omm.c b/drivers/memory/stm32_omm.c index bef7cf4391d6..8704c774e642 100644 --- a/drivers/memory/stm32_omm.c +++ b/drivers/memory/stm32_omm.c @@ -222,6 +222,7 @@ static int stm32_omm_configure(struct device *dev) clk_rate = clk_get_rate(omm->clk_bulk[i].clk); if (!clk_rate...
9c03507fcd6feae37a94eff376a1aa79700dd54a
Analyze and fix the following issue in the Linux kernel code: memory: stm32: Fix spelling mistake "resset" -> "reset"
Problem Details: There is a spelling mistake in a dev_err message. Fix it. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20250509104459.28167-1-colin.i.king@gmail.com Fixes: 8181d061dcff ("memory: Add STM32 Octo Memory Manager driver") Signed-off-by: Krzysztof Kozlowski <krzysz...
```diff diff --git a/drivers/memory/stm32_omm.c b/drivers/memory/stm32_omm.c index 166baed0738a..bef7cf4391d6 100644 --- a/drivers/memory/stm32_omm.c +++ b/drivers/memory/stm32_omm.c @@ -173,7 +173,7 @@ static int stm32_omm_disable_child(struct device *dev) ret = reset_control_acquire(reset); if (ret) { stm32...
81214185e7e1fc6dfc8661a574c457accaf9a5a4
Analyze and fix the following issue in the Linux kernel code: clk: samsung: correct clock summary for hsi1 block
Problem Details: clk_summary shows wrong value for "mout_hsi1_usbdrd_user". It shows 400Mhz instead of 40Mhz as below. dout_shared2_div4 1 1 0 400000000 0 0 50000 Y ... mout_hsi1_usbdrd_user 0 0 0 400000000 0 0 50000 Y ... dout_clkcmu_hsi1_usbdrd 0 0 0 40000000 0 0 50000 Y ... Correct the clk_tre...
```diff diff --git a/drivers/clk/samsung/clk-exynosautov920.c b/drivers/clk/samsung/clk-exynosautov920.c index f8168eed4a66..da4afe8ac2ab 100644 --- a/drivers/clk/samsung/clk-exynosautov920.c +++ b/drivers/clk/samsung/clk-exynosautov920.c @@ -1729,7 +1729,7 @@ static const unsigned long hsi1_clk_regs[] __initconst = { ...
e0cd396d899805d56df91b989f8efad3a36df0da
Analyze and fix the following issue in the Linux kernel code: kbuild: fix typos "module.builtin" to "modules.builtin"
Problem Details: The filenames in the comments do not match the actual generated files. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
```diff diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux index 0c4bb1274a08..b64862dc6f08 100644 --- a/scripts/Makefile.vmlinux +++ b/scripts/Makefile.vmlinux @@ -97,7 +97,7 @@ ifdef CONFIG_BUILDTIME_TABLE_SORT $(vmlinux-final): scripts/sorttable endif -# module.builtin.ranges +# modules.builtin.ran...
8cf5b3f836147d8d4e7c6eb4c01945b97dab8297
Analyze and fix the following issue in the Linux kernel code: Revert "kbuild, rust: use -fremap-path-prefix to make paths relative"
Problem Details: This reverts commit dbdffaf50ff9cee3259a7cef8a7bd9e0f0ba9f13. --remap-path-prefix breaks the ability of debuggers to find the source file corresponding to object files. As there is no simple or uniform way to specify the source directory explicitly, this breaks developers workflows. Revert the uncond...
```diff diff --git a/Makefile b/Makefile index 52f84aaf1025..0eb9e6c49b32 100644 --- a/Makefile +++ b/Makefile @@ -1069,7 +1069,6 @@ KBUILD_CFLAGS += -fno-builtin-wcslen # change __FILE__ to the relative path to the source directory ifdef building_out_of_srctree KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map...
020d7f14489b8bc38c6bd4c5b3c25262e8b6de63
Analyze and fix the following issue in the Linux kernel code: Revert "kbuild: make all file references relative to source root"
Problem Details: This reverts commit cacd22ce69585a91c386243cd662ada962431e63. -ffile-prefix-map breaks the ability of debuggers to find the source file corresponding to object files. As there is no simple or uniform way to specify the source directory explicitly, this breaks developers workflows. Revert the uncondit...
```diff diff --git a/Documentation/kbuild/reproducible-builds.rst b/Documentation/kbuild/reproducible-builds.rst index a7762486c93f..f2dcc39044e6 100644 --- a/Documentation/kbuild/reproducible-builds.rst +++ b/Documentation/kbuild/reproducible-builds.rst @@ -46,6 +46,21 @@ The kernel embeds the building user and host n...
f0e4b333cf67b3d5da56bd01a125f45c102f7d27
Analyze and fix the following issue in the Linux kernel code: kbuild: fix dependency on sorttable
Problem Details: Commit ac4f06789b4f ("kbuild: Create intermediate vmlinux build with relocations preserved") missed replacing one occurrence of "vmlinux" that was added during the same development cycle. Fixes: ac4f06789b4f ("kbuild: Create intermediate vmlinux build with relocations preserved") Signed-off-by: Masahi...
```diff diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux index 85d60d986401..0c4bb1274a08 100644 --- a/scripts/Makefile.vmlinux +++ b/scripts/Makefile.vmlinux @@ -94,7 +94,7 @@ $(vmlinux-final): $(RESOLVE_BTFIDS) endif ifdef CONFIG_BUILDTIME_TABLE_SORT -vmlinux: scripts/sorttable +$(vmlinux-final): ...
5bd6bdd0f76e257c029ff34100f2959cd4992486
Analyze and fix the following issue in the Linux kernel code: kbuild: rpm-pkg: Add (elfutils-devel or libdw-devel) to BuildRequires
Problem Details: The dwarf.h header, which is included by scripts/gendwarfksyms/gendwarfksyms.h, resides within elfutils-devel or libdw-devel package. This portion of the code is compiled under the condition that CONFIG_GENDWARFKSYMS is enabled. Consequently, add (elfutils-devel or libdw-devel) to BuildRequires to pr...
```diff diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec index 726f34e11960..98f206cb7c60 100644 --- a/scripts/package/kernel.spec +++ b/scripts/package/kernel.spec @@ -16,6 +16,7 @@ Source1: config Source2: diff.patch Provides: kernel-%{KERNELRELEASE} BuildRequires: bc binutils bison dwarves +...
657f96cb7c06a2ef85d166f1b055baeb6511c324
Analyze and fix the following issue in the Linux kernel code: kbuild: deb-pkg: Add libdw-dev:native to Build-Depends-Arch
Problem Details: The dwarf.h header, which is included by scripts/gendwarfksyms/gendwarfksyms.h, resides within the libdw-dev package. This portion of the code is compiled under the condition that CONFIG_GENDWARFKSYMS is enabled. Consequently, add libdw-dev to Build-Depends-Arch to prevent unforeseen compilation fail...
```diff diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index 744ddba01d93..d4b007b38a47 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -210,7 +210,7 @@ Rules-Requires-Root: no Build-Depends: debhelper-compat (= 12) Build-Depends-Arch: bc, bison, flex, gcc-${host_gnu} <!pkg...
56045757accf5a51c9146585acd5f76fa4fbdb97
Analyze and fix the following issue in the Linux kernel code: usr/include: openrisc: don't HDRTEST bpf_perf_event.h
Problem Details: Since openrisc does not support PERF_EVENTS, omit the HDRTEST of bpf_perf_event.h for arch/openrisc/. Fixes a build error: usr/include/linux/bpf_perf_event.h:14:28: error: field 'regs' has incomplete type Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Acked-by: Stafford Horne <shorne@gmail.com> ...
```diff diff --git a/usr/include/Makefile b/usr/include/Makefile index e3d6b03527fe..f02f41941b60 100644 --- a/usr/include/Makefile +++ b/usr/include/Makefile @@ -59,6 +59,10 @@ ifeq ($(SRCARCH),arc) no-header-test += linux/bpf_perf_event.h endif +ifeq ($(SRCARCH),openrisc) +no-header-test += linux/bpf_perf_event.h...
9520a2b3f0b5e182f73410e45b9b92ea51d9b828
Analyze and fix the following issue in the Linux kernel code: kbuild: Require pahole <v1.28 or >v1.29 with GENDWARFKSYMS on X86
Problem Details: With CONFIG_GENDWARFKSYMS, __gendwarfksyms_ptr variables are added to the kernel in EXPORT_SYMBOL() to ensure DWARF type information is available for exported symbols in the TUs where they're actually exported. These symbols are dropped when linking vmlinux, but dangling references to them remain in DW...
```diff diff --git a/kernel/module/Kconfig b/kernel/module/Kconfig index d7762ef5949a..39278737bb68 100644 --- a/kernel/module/Kconfig +++ b/kernel/module/Kconfig @@ -192,6 +192,11 @@ config GENDWARFKSYMS depends on !DEBUG_INFO_REDUCED && !DEBUG_INFO_SPLIT # Requires ELF object files. depends on !LTO + # To avoid...
97855e7f1ccf4917f305baab199edb9f2595ff5b
Analyze and fix the following issue in the Linux kernel code: crypto: crypto4xx - Remove ahash-related code
Problem Details: The hash implementation in crypto4xx has been disabled since 2009. As nobody has tried to fix this remove all the dead code. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
```diff diff --git a/drivers/crypto/amcc/crypto4xx_alg.c b/drivers/crypto/amcc/crypto4xx_alg.c index 289750f34ccf..38e8a61e9166 100644 --- a/drivers/crypto/amcc/crypto4xx_alg.c +++ b/drivers/crypto/amcc/crypto4xx_alg.c @@ -12,9 +12,6 @@ #include <linux/interrupt.h> #include <linux/spinlock_types.h> #include <linux/s...
ccdb36cbe65fe05fd5349c7ee5a59e53be7fe195
Analyze and fix the following issue in the Linux kernel code: KVM: PPC: Book3S HV: Fix IRQ map warnings with XICS on pSeries KVM Guest
Problem Details: The commit 9576730d0e6e ("KVM: PPC: select IRQ_BYPASS_MANAGER") enabled IRQ_BYPASS_MANAGER when CONFIG_KVM was set. Subsequently, commit c57875f5f9be ("KVM: PPC: Book3S HV: Enable IRQ bypass") enabled IRQ bypass and added the necessary callbacks to create/remove the mappings between host real IRQ and t...
```diff diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 19f4d298dd17..7667563fb9ff 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -6541,10 +6541,6 @@ static struct kvmppc_ops kvm_ops_hv = { .fast_vcpu_kick = kvmppc_fast_vcpu_kick_hv, .arch_vm_ioctl = ...
09e1d93a421fa5f6699a9dbdbfc09c1008de4b9a
Analyze and fix the following issue in the Linux kernel code: scripts/gdb: update documentation for lx_per_cpu
Problem Details: Commit db08c53fdd542bb7f83b ("scripts/gdb: fix parameter handling in $lx_per_cpu") changed the parameter handling of lx_per_cpu to use GdbValue instead of parsing the variable name. Update the documentation to reflect the new lx_per_cpu usage. Update the hrtimer_bases example to use rb_tree instead o...
```diff diff --git a/Documentation/process/debugging/gdb-kernel-debugging.rst b/Documentation/process/debugging/gdb-kernel-debugging.rst index 895285c037c7..9475c759c722 100644 --- a/Documentation/process/debugging/gdb-kernel-debugging.rst +++ b/Documentation/process/debugging/gdb-kernel-debugging.rst @@ -127,35 +127,3...
6be7045c7756caf2d445dc66473e45ac5779cd55
Analyze and fix the following issue in the Linux kernel code: scripts/gdb: fix kgdb probing on single-core systems
Problem Details: Patch series "scripts/gdb: Fixes related to lx_per_cpu()". These patches (1) fix kgdb detection on systems featuring a single CPU and (2) update the documentation to reflect the current usage of lx_per_cpu() and update an outdated example of its usage. This patch (of 2): When requested the list of ...
```diff diff --git a/scripts/gdb/linux/utils.py b/scripts/gdb/linux/utils.py index 03ebdccf5f69..877404e92dbb 100644 --- a/scripts/gdb/linux/utils.py +++ b/scripts/gdb/linux/utils.py @@ -200,7 +200,7 @@ def get_gdbserver_type(): def probe_kgdb(): try: - thread_info = gdb.execute("info thread ...
f11c1efe46ad84555a0948401c7bdb63d711088d
Analyze and fix the following issue in the Linux kernel code: selftests: fix some typos in tools/testing/selftests
Problem Details: Fix multiple spelling errors: - "rougly" -> "roughly" - "fielesystems" -> "filesystems" - "Can'" -> "Can't" Link: https://lkml.kernel.org/r/20250503211959.507815-1-chelsyratnawat2001@gmail.com Signed-off-by: Chelsy Ratnawat <chelsyratnawat2001@gmail.com> Cc: Christian Brauner <brauner@kernel.org> ...
```diff diff --git a/tools/testing/selftests/filesystems/file_stressor.c b/tools/testing/selftests/filesystems/file_stressor.c index 1136f93a9977..01dd89f8e52f 100644 --- a/tools/testing/selftests/filesystems/file_stressor.c +++ b/tools/testing/selftests/filesystems/file_stressor.c @@ -156,7 +156,7 @@ TEST_F_TIMEOUT(fi...
8e39fbb1edbb4ec9d7c1124f403877fc167fcecd
Analyze and fix the following issue in the Linux kernel code: nilfs2: do not propagate ENOENT error from nilfs_btree_propagate()
Problem Details: In preparation for writing logs, in nilfs_btree_propagate(), which makes parent and ancestor node blocks dirty starting from a modified data block or b-tree node block, if the starting block does not belong to the b-tree, i.e. is isolated, nilfs_btree_do_lookup() called within the function fails with ...
```diff diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c index 0d8f7fb15c2e..dd0c8e560ef6 100644 --- a/fs/nilfs2/btree.c +++ b/fs/nilfs2/btree.c @@ -2102,11 +2102,13 @@ static int nilfs_btree_propagate(struct nilfs_bmap *btree, ret = nilfs_btree_do_lookup(btree, path, key, NULL, level + 1, 0); if (ret < 0) { - ...
f43f02429295486059605997bc43803527d69791
Analyze and fix the following issue in the Linux kernel code: nilfs2: add pointer check for nilfs_direct_propagate()
Problem Details: Patch series "nilfs2: improve sanity checks in dirty state propagation". This fixes one missed check for block mapping anomalies and one improper return of an error code during a preparation step for log writing, thereby improving checking for filesystem corruption on writeback. This patch (of 2): ...
```diff diff --git a/fs/nilfs2/direct.c b/fs/nilfs2/direct.c index 893ab36824cc..2d8dc6b35b54 100644 --- a/fs/nilfs2/direct.c +++ b/fs/nilfs2/direct.c @@ -273,6 +273,9 @@ static int nilfs_direct_propagate(struct nilfs_bmap *bmap, dat = nilfs_bmap_get_dat(bmap); key = nilfs_bmap_data_get_key(bmap, bh); ptr = nilfs...
c91d78622e16f628176d7248044106b03818af6d
Analyze and fix the following issue in the Linux kernel code: util_macros.h: fix the reference in kernel-doc
Problem Details: In PTR_IF() description the text refers to the parameter as (ptr) while the kernel-doc format asks for @ptr. Fix this accordingly. Link: https://lkml.kernel.org/r/20250428072737.3265239-1-andriy.shevchenko@linux.intel.com Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Alexandr...
```diff diff --git a/include/linux/util_macros.h b/include/linux/util_macros.h index 7b64fb597f85..8183ac610cc5 100644 --- a/include/linux/util_macros.h +++ b/include/linux/util_macros.h @@ -85,7 +85,7 @@ * @ptr: A pointer to assign if @cond is true. * * PTR_IF(IS_ENABLED(CONFIG_FOO), ptr) evaluates to @ptr if CO...
1785c67e2adc4d1899685b36dd10f7ebbf117178
Analyze and fix the following issue in the Linux kernel code: ocfs2: remove unnecessary NULL check before unregister_sysctl_table()
Problem Details: unregister_sysctl_table() checks for NULL pointers internally. Remove unneeded NULL check here. Link: https://lkml.kernel.org/r/20250422073051.1334310-1-nichen@iscas.ac.cn Signed-off-by: Chen Ni <nichen@iscas.ac.cn> Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com> Cc: Mark Fasheh <mark@fasheh.com...
```diff diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c index ddd761cf44c8..a28c127b9934 100644 --- a/fs/ocfs2/stackglue.c +++ b/fs/ocfs2/stackglue.c @@ -691,8 +691,7 @@ static void __exit ocfs2_stack_glue_exit(void) memset(&locking_max_version, 0, sizeof(struct ocfs2_protocol_version)); ocfs2_sys...
cdc3ed3035d0fe934aa1d9b78ce256752fd3bb7d
Analyze and fix the following issue in the Linux kernel code: ocfs2: fix possible memory leak in ocfs2_finish_quota_recovery
Problem Details: If ocfs2_finish_quota_recovery() exits due to an error before passing all rc_list elements to ocfs2_recover_local_quota_file() then it can lead to a memory leak as rc_list may still contain elements that have to be freed. Release all memory allocated by ocfs2_add_recovery_chunk() using ocfs2_free_quot...
```diff diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c index e272429da3db..de7f12858729 100644 --- a/fs/ocfs2/quota_local.c +++ b/fs/ocfs2/quota_local.c @@ -674,7 +674,7 @@ out_put: break; } out: - kfree(rec); + ocfs2_free_quota_recovery(rec); return status; } ```
d66adabe91803ef34a8b90613c81267b5ded1472
Analyze and fix the following issue in the Linux kernel code: ipc: fix to protect IPCS lookups using RCU
Problem Details: syzbot reported that it discovered a use-after-free vulnerability, [0] [0]: https://lore.kernel.org/all/67af13f8.050a0220.21dd3.0038.GAE@google.com/ idr_for_each() is protected by rwsem, but this is not enough. If it is not protected by RCU read-critical region, when idr_for_each() calls radix_tree_...
```diff diff --git a/ipc/shm.c b/ipc/shm.c index 99564c870084..492fcc699985 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -431,8 +431,11 @@ static int shm_try_destroy_orphaned(int id, void *p, void *data) void shm_destroy_orphaned(struct ipc_namespace *ns) { down_write(&shm_ids(ns).rwsem); - if (shm_ids(ns).in_use) + i...
9c7b53b21fb1df20f85e3822160b4687f98ff7b3
Analyze and fix the following issue in the Linux kernel code: compiler_types.h: fix "unused variable" in __compiletime_assert()
Problem Details: This refines commit c03567a8e8d5 ("include/linux/compiler.h: don't perform compiletime_assert with -O0") and restores #ifdef __OPTIMIZE__ symmetry by evaluating the 'condition' variable in both compile-time variants of __compiletimeassert(). As __OPTIMIZE__ is always true by default, this commit does ...
```diff diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index 501cffddc2f4..1f2eee8331d3 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -525,6 +525,12 @@ struct ftrace_likely_data { sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) #ifdef __OP...
3dc32adf98147b36b25dc579bb438c9ea086b1b4
Analyze and fix the following issue in the Linux kernel code: maccess: fix strncpy_from_user_nofault() empty string handling
Problem Details: strncpy_from_user_nofault() should return the length of the copied string including the trailing NUL, but if the argument unsafe_addr points to an empty string ({'\0'}), the return value is 0. This happens as strncpy_from_user() copies terminal symbol into dst and returns 0 (as expected), but strncpy_...
```diff diff --git a/mm/maccess.c b/mm/maccess.c index 8f0906180a94..831b4dd7296c 100644 --- a/mm/maccess.c +++ b/mm/maccess.c @@ -196,7 +196,7 @@ long strncpy_from_user_nofault(char *dst, const void __user *unsafe_addr, if (ret >= count) { ret = count; dst[ret - 1] = '\0'; - } else if (ret > 0) { + } else if (...
7123dbbef88cfd9f09e8a7899b0911834600cfa3
Analyze and fix the following issue in the Linux kernel code: watchdog: fix watchdog may detect false positive of softlockup
Problem Details: When updating `watchdog_thresh`, there is a race condition between writing the new `watchdog_thresh` value and stopping the old watchdog timer. If the old timer triggers during this window, it may falsely detect a softlockup due to the old interval and the new `watchdog_thresh` value being used. The ...
```diff diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 9fa2af9dbf2c..2d283e92be5a 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -47,6 +47,7 @@ int __read_mostly watchdog_user_enabled = 1; static int __read_mostly watchdog_hardlockup_user_enabled = WATCHDOG_HARDLOCKUP_DEFAULT; static int __read_m...
2e27fa943b74c9fc5fdf93090508c3c722531c66
Analyze and fix the following issue in the Linux kernel code: treewide: fix typo "previlege"
Problem Details: There are some spelling mistakes of 'previlege' in comments which should be 'privilege'. Fix them and add it to scripts/spelling.txt. The typo in arch/loongarch/kvm/main.c was corrected by a different patch [1] and is therefore not included in this submission. [1]. https://lore.kernel.org/all/202504...
```diff diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c index dac85294d2f5..e284eea331d7 100644 --- a/drivers/s390/char/vmlogrdr.c +++ b/drivers/s390/char/vmlogrdr.c @@ -255,7 +255,7 @@ static int vmlogrdr_recording(struct vmlogrdr_priv_t * logptr, /* * The recording commands needs to be...
f0eba23cb70a945ea0947bdbf0706ca00da50d26
Analyze and fix the following issue in the Linux kernel code: crash: fix spelling mistake "crahskernel" -> "crashkernel"
Problem Details: There is a spelling mistake in a pr_warn message. Fix it. Link: https://lkml.kernel.org/r/20250418120331.535086-1-colin.i.king@gmail.com Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Acked-by: Baoquan He <bhe@redhat.com> Cc: Dave Young <dyoung@redhat.com> Cc: Vivek Goyal <vgoyal@redhat.com> S...
```diff diff --git a/kernel/crash_reserve.c b/kernel/crash_reserve.c index aff7c0fdbefa..acb6bf42e30d 100644 --- a/kernel/crash_reserve.c +++ b/kernel/crash_reserve.c @@ -131,7 +131,7 @@ static int __init parse_crashkernel_mem(char *cmdline, cur++; *crash_base = memparse(cur, &tmp); if (cur == tmp) { - p...
1abf729e9d9f4eb42c01fa9cb86eeb1766ecd49f
Analyze and fix the following issue in the Linux kernel code: samples: extend hung_task detector test with semaphore support
Problem Details: Extend the existing hung_task detector test module to support multiple lock types, including mutex and semaphore, with room for future additions (e.g., spinlock, etc.). This module creates dummy files under <debugfs>/hung_task, such as 'mutex' and 'semaphore'. The read process on any of these files w...
```diff diff --git a/samples/Kconfig b/samples/Kconfig index 09011be2391a..753ed1f170b5 100644 --- a/samples/Kconfig +++ b/samples/Kconfig @@ -304,10 +304,11 @@ config SAMPLE_HUNG_TASK tristate "Hung task detector test code" depends on DETECT_HUNG_TASK && DEBUG_FS help - Build a module which provide a simple de...
50af973cd71ab9eea3b18429343659f4a6ebd825
Analyze and fix the following issue in the Linux kernel code: ocfs2: o2net_idle_timer: Rename del_timer_sync in comment
Problem Details: Commit 8fa7292fee5c ("treewide: Switch/rename to timer_delete[_sync]()") switched del_timer_sync to timer_delete_sync, but did not modify the comment for o2net_idle_timer(). Now fix it. Link: https://lkml.kernel.org/r/BDDB1E4E2876C36C+20250411102610.165946-1-wangyuli@uniontech.com Signed-off-by: Wang...
```diff diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index fce9beb214f0..43e652a2adaf 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c @@ -1483,7 +1483,7 @@ static void o2net_sc_send_keep_req(struct work_struct *work) sc_put(sc); } -/* socket shutdown does a del_timer_sync against t...
734aa85390ea693bb7eaf2240623d41b03705c84
Analyze and fix the following issue in the Linux kernel code: Squashfs: check return result of sb_min_blocksize
Problem Details: Syzkaller reports an "UBSAN: shift-out-of-bounds in squashfs_bio_read" bug. Syzkaller forks multiple processes which after mounting the Squashfs filesystem, issues an ioctl("/dev/loop0", LOOP_SET_BLOCK_SIZE, 0x8000). Now if this ioctl occurs at the same time another process is in the process of mount...
```diff diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c index 67c55fe32ce8..992ea0e37257 100644 --- a/fs/squashfs/super.c +++ b/fs/squashfs/super.c @@ -202,6 +202,11 @@ static int squashfs_fill_super(struct super_block *sb, struct fs_context *fc) msblk->panic_on_errors = (opts->errors == Opt_errors_panic); ...
df3d527495376e29333035e087ead194580ea3b2
Analyze and fix the following issue in the Linux kernel code: checkpatch: dont warn about unused macro arg on empty body
Problem Details: Patch series "2 checkpatch fixes, one pr_info_once". 2 small tweaks to checkpatch, 1 reducing several pages of powernow "not-relevant-here" log-msgs to a few lines This patch (of 3): We currently get: WARNING: Argument 'name' is not used in function-like macro on: #define DRM_CLASSMAP_USE(name)...
```diff diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 3d22bf863eec..75349f766b89 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -6024,7 +6024,7 @@ sub process { } # check if this is an unused argument - if ($define_stmt !~ /\b$arg\b/) { + if ($define_stmt !~ /\b$arg\b...
65c66047259fad1b868d4454bc5af95b46a5f954
Analyze and fix the following issue in the Linux kernel code: proc: fix the issue of proc_mem_open returning NULL
Problem Details: proc_mem_open() can return an errno, NULL, or mm_struct*. If it fails to acquire mm, it returns NULL, but the caller does not check for the case when the return value is NULL. The following conditions lead to failure in acquiring mm: - The task is a kernel thread (PF_KTHREAD) - The task is exiti...
```diff diff --git a/fs/proc/base.c b/fs/proc/base.c index b0d4e1908b22..85a3f5e253d4 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -827,7 +827,13 @@ static const struct file_operations proc_single_file_operations = { .release = single_release, }; - +/* + * proc_mem_open() can return errno, NULL or mm_struct...
3dfd79cc8772bc2f02e060aa8c0bbbba8c1a1e45
Analyze and fix the following issue in the Linux kernel code: lib/rbtree.c: fix the example typo
Problem Details: Replace `sr` with `Sr`. The condition `!tmp1 || rb_is_black(tmp1)` ensures that `tmp1` (which is `sibling->rb_right`) is either NULL or a black node. Therefore, the right child of the sibling must be black, and the example should use `Sr` instead of `sr`. Link: https://lkml.kernel.org/r/202504031126...
```diff diff --git a/lib/rbtree.c b/lib/rbtree.c index 989c2d615f92..5114eda6309c 100644 --- a/lib/rbtree.c +++ b/lib/rbtree.c @@ -297,9 +297,9 @@ ____rb_erase_color(struct rb_node *parent, struct rb_root *root, * / \ / \ * N S --> N sl * / \ \ - * sl sr ...
247021624a99a35e0b04cfd784a84bd65b5a0c59
Analyze and fix the following issue in the Linux kernel code: crash: export PAGE_UNACCEPTED_MAPCOUNT_VALUE to vmcoreinfo
Problem Details: On Intel TDX guest, unaccepted memory is unusable free memory which is not managed by buddy, until it's accepted by guest. Before that, it cannot be accessed by the first kernel as well as the kexec'ed kernel. The kexec'ed kernel will skip these pages and fill in zero data for the reader of vmcore. ...
```diff diff --git a/Documentation/admin-guide/kdump/vmcoreinfo.rst b/Documentation/admin-guide/kdump/vmcoreinfo.rst index 0f714fc945ac..8cf4614385b7 100644 --- a/Documentation/admin-guide/kdump/vmcoreinfo.rst +++ b/Documentation/admin-guide/kdump/vmcoreinfo.rst @@ -331,8 +331,8 @@ PG_lru|PG_private|PG_swapcache|PG_swa...
3330dc1b2074629c74008ea0ee0b4fb279ce8992
Analyze and fix the following issue in the Linux kernel code: init/main.c: log initcall level when initcall_debug is used
Problem Details: When initcall_debug is specified on the command line, the start and return point for each initcall is printed. However, no information on the initcall level is reported. Add to the initcall_debug infrastructure an additional print that informs when a new initcall level is entered. This is particular...
```diff diff --git a/init/main.c b/init/main.c index 7f0a2a3dbd29..6b14e6116a1f 100644 --- a/init/main.c +++ b/init/main.c @@ -1214,6 +1214,12 @@ trace_initcall_finish_cb(void *data, initcall_t fn, int ret) fn, ret, (unsigned long long)ktime_us_delta(rettime, *calltime)); } +static __init_or_module void +trace_i...
dec92bf95f5a710287b588cb203ff27abcd24706
Analyze and fix the following issue in the Linux kernel code: mm/mempolicy: support memory hotplug in weighted interleave
Problem Details: The weighted interleave policy distributes page allocations across multiple NUMA nodes based on their performance weight, thereby improving memory bandwidth utilization. The weight values for each node are configured through sysfs. Previously, sysfs entries for configuring weighted interleave were cr...
```diff diff --git a/mm/mempolicy.c b/mm/mempolicy.c index c99bae7d8219..9a2b4b36f558 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -113,6 +113,7 @@ #include <asm/tlbflush.h> #include <asm/tlb.h> #include <linux/uaccess.h> +#include <linux/memory.h> #include "internal.h" @@ -3429,6 +3430,7 @@ struct iw_no...
bb52e89d8bdbfdf896f6899a830fead3c9344a60
Analyze and fix the following issue in the Linux kernel code: mm/mempolicy: fix memory leaks in weighted interleave sysfs
Problem Details: Patch series "Enhance sysfs handling for memory hotplug in weighted interleave", v9. The following patch series enhances the weighted interleave policy in the memory management subsystem by improving sysfs handling, fixing memory leaks, and introducing dynamic sysfs updates for memory hotplug support....
```diff diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 4d2dc8b63965..b8c7cce61103 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -3471,8 +3471,8 @@ static ssize_t node_store(struct kobject *kobj, struct kobj_attribute *attr, static struct iw_node_attr **node_attrs; -static void sysfs_wi_node_release(struc...
6e14fd33f148cf36db9bcee7561f2b5b6c3b65aa
Analyze and fix the following issue in the Linux kernel code: mm: memcontrol: remove unnecessary NULL check before free_percpu()
Problem Details: free_percpu() checks for NULL pointers internally. Remove unneeded NULL check here. Link: https://lkml.kernel.org/r/20250417084330.937380-1-nichen@iscas.ac.cn Signed-off-by: Chen Ni <nichen@iscas.ac.cn> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Michal Hocko <mhocko@kernel.org> Cc: Muchun Song <muc...
```diff diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c index 4a9cf27a70af..54c49cbfc968 100644 --- a/mm/memcontrol-v1.c +++ b/mm/memcontrol-v1.c @@ -2198,8 +2198,7 @@ bool memcg1_alloc_events(struct mem_cgroup *memcg) void memcg1_free_events(struct mem_cgroup *memcg) { - if (memcg->events_percpu) - free_perc...
7a73348e5d4715b5565a53f21c01ea7b54e46cbd
Analyze and fix the following issue in the Linux kernel code: lib/test_vmalloc.c: replace RWSEM to SRCU for setup
Problem Details: The test has the initialization step during which threads are created. To prevent the workers from starting prematurely a write lock was previously used by the main setup thread, while each worker would block on a read lock. Replace this RWSEM based synchronization with a simpler SRCU based approach....
```diff diff --git a/lib/test_vmalloc.c b/lib/test_vmalloc.c index f585949ff696..399751022eea 100644 --- a/lib/test_vmalloc.c +++ b/lib/test_vmalloc.c @@ -13,9 +13,9 @@ #include <linux/moduleparam.h> #include <linux/completion.h> #include <linux/delay.h> -#include <linux/rwsem.h> #include <linux/mm.h> #include <li...
1477b8cd26883a78362057954a247dab3bc5d2fb
Analyze and fix the following issue in the Linux kernel code: samples/damon/prcl: fix a comment typo
Problem Details: This patch just fixes a typo in the comment. Link: https://lkml.kernel.org/r/20250411073800.1444481-1-lienze@kylinos.cn Signed-off-by: Enze Li <lienze@kylinos.cn> Reviewed-by: SeongJae Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
```diff diff --git a/samples/damon/prcl.c b/samples/damon/prcl.c index c3acbdab7a62..056b1b21a0fe 100644 --- a/samples/damon/prcl.c +++ b/samples/damon/prcl.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* * proactive reclamation: monitor access pattern of a given process, find - * regiosn that seems not ac...
ede27b7ee2e6c0c5148d4bab04e5d287d6fbc771
Analyze and fix the following issue in the Linux kernel code: mm/gup: remove unneeded checking in follow_page_pte()
Problem Details: Patch series "mm/gup: Minor fix, cleanup and improvements", v4. These were made from code inspection in mm/gup.c. This patch (of 3): In __get_user_pages(), it will traverse page table and take a reference to the page the given user address corresponds to if GUP_GET or GUP_PIN is set. However, it's...
```diff diff --git a/mm/gup.c b/mm/gup.c index 84461d384ae2..eb668da933e1 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -844,11 +844,6 @@ static struct page *follow_page_pte(struct vm_area_struct *vma, pte_t *ptep, pte; int ret; - /* FOLL_GET and FOLL_PIN are mutually exclusive. */ - if (WARN_ON_ONCE((flags & (FOLL_PIN...
f736953e2b1f1d7096e70580180f98744c9c9c86
Analyze and fix the following issue in the Linux kernel code: selftests/damon: remove the remaining test scripts for DAMON debugfs interface
Problem Details: DAMON has dropped debugfs support; therefore, remove these unused scripts. Link: https://lkml.kernel.org/r/20250411024332.1373861-1-enze.li@linux.dev Fixes: 5ec4333b1967 ("mm/damon: remove DAMON debugfs interface") Signed-off-by: Enze Li <lienze@kylinos.cn> Reviewed-by: SeongJae Park <sj@kernel.org> C...
```diff diff --git a/tools/testing/selftests/damon/Makefile b/tools/testing/selftests/damon/Makefile index ecbf07afc6dd..ff21524be458 100644 --- a/tools/testing/selftests/damon/Makefile +++ b/tools/testing/selftests/damon/Makefile @@ -3,7 +3,7 @@ TEST_GEN_FILES += access_memory access_memory_even -TEST_FILES = _ch...
585a9145886ad1d06b39ddcd72d457f37ebb4ff4
Analyze and fix the following issue in the Linux kernel code: selftests/mm: restore default nr_hugepages value during cleanup in hugetlb_reparenting_test.sh
Problem Details: During cleanup, the value of /proc/sys/vm/nr_hugepages is currently being set to 0. At the end of the test, if all tests pass, the original nr_hugepages value is restored. However, if any test fails, it remains set to 0. With this patch, we ensure that the original nr_hugepages value is restored dur...
```diff diff --git a/tools/testing/selftests/mm/hugetlb_reparenting_test.sh b/tools/testing/selftests/mm/hugetlb_reparenting_test.sh index 9245549b66cf..0dd31892ff67 100755 --- a/tools/testing/selftests/mm/hugetlb_reparenting_test.sh +++ b/tools/testing/selftests/mm/hugetlb_reparenting_test.sh @@ -56,7 +56,7 @@ functio...
271152a973cb01c135d29e91d1a05f51fbd88a9c
Analyze and fix the following issue in the Linux kernel code: maple_tree: add sufficient height
Problem Details: In order to support rebalancing and spanning stores using less than the worst case number of nodes, we need to track more than just the vacant height. Using only vacant height to reduce the worst case maple node allocation count can lead to a shortcoming of nodes in the following scenarios. For rebal...
```diff diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h index 657adb33e61e..9ef129038224 100644 --- a/include/linux/maple_tree.h +++ b/include/linux/maple_tree.h @@ -464,6 +464,7 @@ struct ma_wr_state { void *entry; /* The entry to write */ void *content; /* The existing entry that is being...
066c770437835d2bd2072bd2c88a71fcbbd5ccb3
Analyze and fix the following issue in the Linux kernel code: mm/madvise: define and use madvise_behavior struct for madvise_do_behavior()
Problem Details: Patch series "mm/madvise: batch tlb flushes for MADV_DONTNEED and MADV_FREE", v3. When process_madvise() is called to do MADV_DONTNEED[_LOCKED] or MADV_FREE with multiple address ranges, tlb flushes happen for each of the given address ranges. Because such tlb flushes are for the same process, doing ...
```diff diff --git a/mm/madvise.c b/mm/madvise.c index b17f684322ad..26fa868b41af 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -48,6 +48,11 @@ struct madvise_walk_private { bool pageout; }; +struct madvise_behavior { + int behavior; + struct mmu_gather *tlb; +}; + /* * Any behaviour which results in changes ...
10d288964d48e52354f002f7e0f64d1df9496ab1
Analyze and fix the following issue in the Linux kernel code: tools/testing/selftests: assert that anon merge cases behave as expected
Problem Details: Prior to the recently applied commit that permits this merge, mprotect()'ing a faulted VMA, adjacent to an unfaulted VMA, such that the two share characteristics would fail to merge due to what appear to be unintended consequences of commit 965f55dea0e3 ("mmap: avoid merging cloned VMAs"). Now we have...
```diff diff --git a/MAINTAINERS b/MAINTAINERS index 9eea95043c12..022a19cb9aa0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -15670,6 +15670,7 @@ F: mm/mseal.c F: mm/vma.c F: mm/vma.h F: mm/vma_internal.h +F: tools/testing/selftests/mm/merge.c F: tools/testing/vma/ MEMORY MAPPING - LOCKING diff --git a/tools/te...
879bca0a2c4f40b08d09a95a2a0c3c6513060b5c
Analyze and fix the following issue in the Linux kernel code: mm/vma: fix incorrectly disallowed anonymous VMA merges
Problem Details: Patch series "fix incorrectly disallowed anonymous VMA merges", v2. It appears that we have been incorrectly rejecting merge cases for 15 years, apparently by mistake. Imagine a range of anonymous mapped momemory divided into two VMAs like this, with incompatible protection bits: RW ...
```diff diff --git a/mm/vma.c b/mm/vma.c index 839d12f02c88..8a6c5e835759 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -57,6 +57,22 @@ struct mmap_state { .state = VMA_MERGE_START, \ } +/* + * If, at any point, the VMA had unCoW'd mappings from parents, it will maintain + * more than one anon_vma_chain connecting ...
114ba9b9e8191925438365089c0d300f4f1b6fb1
Analyze and fix the following issue in the Linux kernel code: mm: rust: add mmput_async support
Problem Details: Adds an MmWithUserAsync type that uses mmput_async when dropped but is otherwise identical to MmWithUser. This has to be done using a separate type because the thing we are changing is the destructor. Rust Binder needs this to avoid a certain deadlock. See commit 9a9ab0d96362 ("binder: fix race betw...
```diff diff --git a/rust/kernel/mm.rs b/rust/kernel/mm.rs index c160fb52603f..615907a0f3b4 100644 --- a/rust/kernel/mm.rs +++ b/rust/kernel/mm.rs @@ -111,6 +111,50 @@ impl Deref for MmWithUser { } } +/// A wrapper for the kernel's `struct mm_struct`. +/// +/// This type is identical to `MmWithUser` except that...
ce906d7679e1f1feab54bdddac4d39df846d663a
Analyze and fix the following issue in the Linux kernel code: vmalloc: switch to for_each_vmap_node() helper
Problem Details: There are places which can be updated easily to use the helper to iterate over all vmap-nodes. This is what this patch does. The aim is to improve readability and simplify the code. [akpm@linux-foundation.org: fix build warning] Link: https://lkml.kernel.org/r/20250408151549.77937-2-urezki@gmail.com...
```diff diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 55949360a5cb..e80783fa4d2c 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1061,12 +1061,11 @@ find_vmap_area_exceed_addr_lock(unsigned long addr, struct vmap_area **va) { unsigned long va_start_lowest; struct vmap_node *vn; - int i; repeat: - for (i = 0, ...
4c97a17a252bf8396f7bd65efced00bf401a8c25
Analyze and fix the following issue in the Linux kernel code: xarray: make xa_alloc_cyclic() return 0 on all success cases
Problem Details: Change xa_alloc_cyclic() to return 0 even on wrap-around. Do the same for xa_alloc_cyclic_irq() and xa_alloc_cyclic_bh(). This will prevent any future bug of treating return of 1 as an error: int ret = xa_alloc_cyclic(...) if (ret) // currently mishandles ret==1 goto failure; If there will be so...
```diff diff --git a/include/linux/xarray.h b/include/linux/xarray.h index 78eede109b1a..be850174e802 100644 --- a/include/linux/xarray.h +++ b/include/linux/xarray.h @@ -965,10 +965,12 @@ static inline int __must_check xa_alloc_irq(struct xarray *xa, u32 *id, * Must only be operated on an xarray initialized with fla...
79049bb48a76333646d076e29d4f99fedefdaf0d
Analyze and fix the following issue in the Linux kernel code: mm/debug: fix parameter passed to page_mapcount_is_type()
Problem Details: As the comments of page_mapcount_is_type() indicate, the parameter passed to the function should be one more than page->_mapcount. However, page->_mapcount is passed to the function by commit 4ffca5a96678 ("mm: support only one page_type per page") where page_type_has_type() is replaced by page_mapcou...
```diff diff --git a/mm/debug.c b/mm/debug.c index db83e381a8ae..907382257062 100644 --- a/mm/debug.c +++ b/mm/debug.c @@ -71,10 +71,12 @@ static void __dump_folio(struct folio *folio, struct page *page, unsigned long pfn, unsigned long idx) { struct address_space *mapping = folio_mapping(folio); - int mapcount =...
979f3ef0f798d9b4fda4806d37fb1a264fc38566
Analyze and fix the following issue in the Linux kernel code: mm: fix parameter passed to page_mapcount_is_type()
Problem Details: Patch series "Fix parameter passed to page_mapcount_is_type()", v2. Found by code inspection. There are two places where the parameter passed to page_mapcount_is_type() is (page->_mapcount), which is incorrect since it should be one more than the value, as explained in the comments to page_mapcount_i...
```diff diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index e6a21b62dcce..d3909cb1e576 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -982,7 +982,7 @@ static inline bool page_mapcount_is_type(unsigned int mapcount) static inline bool page_has_type(const struct page...
17fc7b8f9bce5d3d61ef347dd8cfccb6365dcaa1
Analyze and fix the following issue in the Linux kernel code: syscall.h: add syscall_set_arguments()
Problem Details: This function is going to be needed on all HAVE_ARCH_TRACEHOOK architectures to implement PTRACE_SET_SYSCALL_INFO API. This partially reverts commit 7962c2eddbfe ("arch: remove unused function syscall_set_arguments()") by reusing some of old syscall_set_arguments() implementations. [nathan@kernel.org...
```diff diff --git a/arch/arc/include/asm/syscall.h b/arch/arc/include/asm/syscall.h index 9709256e31c8..89c1e1736356 100644 --- a/arch/arc/include/asm/syscall.h +++ b/arch/arc/include/asm/syscall.h @@ -67,6 +67,20 @@ syscall_get_arguments(struct task_struct *task, struct pt_regs *regs, } } +static inline void +sy...
ec9827cd28b13b88517812eb08b13d0ed97ae8f1
Analyze and fix the following issue in the Linux kernel code: mm: swap: replace cluster_swap_free_nr() with swap_entries_put_[map/cache]()
Problem Details: Replace cluster_swap_free_nr() with swap_entries_put_[map/cache]() to remove repeat code and leverage batch-remove for entries with last flag. After removing cluster_swap_free_nr, only functions with "_nr" suffix could free entries spanning cross clusters. Add corresponding description in comment of ...
```diff diff --git a/mm/swapfile.c b/mm/swapfile.c index 953dcd99006e..b86637cfb17a 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1520,6 +1520,11 @@ locked_fallback: } +/* + * Only functions with "_nr" suffix are able to free entries spanning + * cross multi clusters, so ensure the range is within a single cl...
9c1c38bcdc9215f0bd231591b662bd0fbe8b7045
Analyze and fix the following issue in the Linux kernel code: mm: swap: rename __swap_[entry/entries]_free[_locked] to swap_[entry/entries]_put[_locked]
Problem Details: Patch series "Minor cleanups and improvements to swap freeing code", v4. This series contains some cleanups and improvements which are made during learning swapfile. Here is a summary of the changes: 1. Function naming improvments. - Use "put" instead of "free" to name functions which only do actu...
```diff diff --git a/mm/swapfile.c b/mm/swapfile.c index f214843612dc..ea01cf05b0cb 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1355,9 +1355,9 @@ out: return NULL; } -static unsigned char __swap_entry_free_locked(struct swap_info_struct *si, - unsigned long offset, - unsigned char usage)...
cf42d4cccf0d01e375175393776a16dc47b9996f
Analyze and fix the following issue in the Linux kernel code: zram: modernize writeback interface
Problem Details: The writeback interface supports a page_index=N parameter which performs writeback of the given page. Since we rarely need to writeback just one single page, the typical use case involves a number of writeback calls, each performing writeback of one page: echo page_index=100 > zram0/writeback ......
```diff diff --git a/Documentation/admin-guide/blockdev/zram.rst b/Documentation/admin-guide/blockdev/zram.rst index 9bdb30901a93..b8d36134a151 100644 --- a/Documentation/admin-guide/blockdev/zram.rst +++ b/Documentation/admin-guide/blockdev/zram.rst @@ -369,6 +369,23 @@ they could write a page index into the interface...
0bf19a357e0eaf03e757ac9482c45a797e40157a
Analyze and fix the following issue in the Linux kernel code: selftests/mm: convert page_size to unsigned long
Problem Details: Cppcheck warning: int result is assigned to long long variable. If the variable is long long to avoid loss of information, then you have loss of information. This patch changes the type of page_size from 'unsigned int' to 'unsigned long' instead of using ULL suffixes. Changing hpage_size to 'unsigned ...
```diff diff --git a/tools/testing/selftests/mm/pagemap_ioctl.c b/tools/testing/selftests/mm/pagemap_ioctl.c index 57b4bba2b45f..fe5ae8b25ff6 100644 --- a/tools/testing/selftests/mm/pagemap_ioctl.c +++ b/tools/testing/selftests/mm/pagemap_ioctl.c @@ -34,7 +34,7 @@ #define PAGEMAP "/proc/self/pagemap" int pagemap_fd; ...
2e976567233228ff928c2405f7e03ebb7fb7aa50
Analyze and fix the following issue in the Linux kernel code: mm: annotate data race in update_hiwater_rss
Problem Details: mm_struct.hiwater_rss can be accessed concurrently without proper synchronization as reported by KCSAN. This data race is benign as it only affects accounting information. Annotate it with data_race() to make KCSAN happy. Link: https://lkml.kernel.org/r/20250331-mm-maxrss-data-race-v2-1-cf958e6205bf@...
```diff diff --git a/include/linux/mm.h b/include/linux/mm.h index dcdb798184ef..1690f21e7808 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -12,6 +12,7 @@ #include <linux/rbtree.h> #include <linux/atomic.h> #include <linux/debug_locks.h> +#include <linux/compiler.h> #include <linux/mm_types.h> #inclu...
cd348c5e6af3b4220eb37a08fdaf9c924a2e1c19
Analyze and fix the following issue in the Linux kernel code: mm: page_alloc: remove redundant READ_ONCE
Problem Details: In the current code, batch is a local variable, and it cannot be concurrently modified. It's unnecessary to use READ_ONCE here, so remove it. Link: https://lkml.kernel.org/r/CAA=HWd1kn01ym8YuVFuAqK2Ggq3itEGkqX8T6eCXs_C7tiv-Jw@mail.gmail.com Fixes: 51a755c56dc0 ("mm: tune PCP high automatically") Sign...
```diff diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 8258349e49ac..1ee0e8265888 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2675,7 +2675,7 @@ static void free_frozen_page_commit(struct zone *zone, free_high = (pcp->free_count >= batch && (pcp->flags & PCPF_PREV_FREE_HIGH_ORDER) && ...
56e5a103a721d0ef139bba7ff3d3ada6c8217d5b
Analyze and fix the following issue in the Linux kernel code: zsmalloc: prefer the the original page's node for compressed data
Problem Details: Currently, zsmalloc, zswap's and zram's backend memory allocator, does not enforce any policy for the allocation of memory for the compressed data, instead just adopting the memory policy of the task entering reclaim, or the default policy (prefer local node) if no such policy is specified. This can l...
```diff diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index fda7d8624889..0ba18277ed7b 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1694,7 +1694,7 @@ static int write_incompressible_page(struct zram *zram, struct page *page, */ handle = zs_malloc(z...
7b7aa8a4adb62e3c3312d1c6086891014addc567
Analyze and fix the following issue in the Linux kernel code: mm: remove mk_huge_pte()
Problem Details: The only remaining user of mk_huge_pte() is the debug code, so remove the API and replace its use with pfn_pte() which lets us remove the conversion to a page first. We should always call arch_make_huge_pte() to turn this PTE into a huge PTE before operating on it with huge_pte_mkdirty() etc. Link: h...
```diff diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h index 2afc95bf1655..3e0a8fe9b108 100644 --- a/include/asm-generic/hugetlb.h +++ b/include/asm-generic/hugetlb.h @@ -5,11 +5,6 @@ #include <linux/swap.h> #include <linux/swapops.h> -static inline pte_t mk_huge_pte(struct page *page, p...
f83f362d40ccceb647f7d80eb92206733d76a36b
Analyze and fix the following issue in the Linux kernel code: mm: fix ratelimit_pages update error in dirty_ratio_handler()
Problem Details: In dirty_ratio_handler(), vm_dirty_bytes must be set to zero before calling writeback_set_ratelimit(), as global_dirty_limits() always prioritizes the value of vm_dirty_bytes. It's domain_dirty_limits() that's relevant here, not node_dirty_ok: dirty_ratio_handler writeback_set_ratelimit g...
```diff diff --git a/mm/page-writeback.c b/mm/page-writeback.c index c81624bc3969..20e1d76f1eba 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -520,8 +520,8 @@ static int dirty_ratio_handler(const struct ctl_table *table, int write, void *b ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos)...
75cb1cca2c880179a11c7dd9380b6f14e41a06a4
Analyze and fix the following issue in the Linux kernel code: mm: userfaultfd: correct dirty flags set for both present and swap pte
Problem Details: As David pointed out, what truly matters for mremap and userfaultfd move operations is the soft dirty bit. The current comment and implementation—which always sets the dirty bit for present PTEs and fails to set the soft dirty bit for swap PTEs—are incorrect. This could break features like Checkpoint...
```diff diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c index 7d5d709cc838..e0db855c89b4 100644 --- a/mm/userfaultfd.c +++ b/mm/userfaultfd.c @@ -1064,8 +1064,13 @@ static int move_present_pte(struct mm_struct *mm, src_folio->index = linear_page_index(dst_vma, dst_addr); orig_dst_pte = mk_pte(&src_folio->page, d...
02f5bf89f0b0a50f821425932a3590eeb9f193ac
Analyze and fix the following issue in the Linux kernel code: zsmalloc: don't underflow size calculation in zs_obj_write()
Problem Details: Do not mix class->size and object size during offsets/sizes calculation in zs_obj_write(). Size classes can merge into clusters, based on objects-per-zspage and pages-per-zspage characteristics, so some size classes can store objects smaller than class->size. This becomes problematic when object size...
```diff diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 961b270f023c..d14a7e317ac8 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1243,19 +1243,19 @@ void zs_obj_write(struct zs_pool *pool, unsigned long handle, class = zspage_class(pool, zspage); off = offset_in_page(class->size * obj_idx); - if (off + clas...
fefc075182275057ce607effaa3daa9e6e3bdc73
Analyze and fix the following issue in the Linux kernel code: mm/page_alloc: fix race condition in unaccepted memory handling
Problem Details: The page allocator tracks the number of zones that have unaccepted memory using static_branch_enc/dec() and uses that static branch in hot paths to determine if it needs to deal with unaccepted memory. Borislav and Thomas pointed out that the tracking is racy: operations on static_branch are not seria...
```diff diff --git a/mm/internal.h b/mm/internal.h index 25a29872c634..5c7a2b43ad76 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1590,7 +1590,6 @@ unsigned long move_page_tables(struct pagetable_move_control *pmc); #ifdef CONFIG_UNACCEPTED_MEMORY void accept_page(struct page *page); -void unaccepted_cleanup_w...
23fa022a07555a9cd2dcfe827c769a89c4c2e21e
Analyze and fix the following issue in the Linux kernel code: mm/page_alloc: ensure try_alloc_pages() plays well with unaccepted memory
Problem Details: try_alloc_pages() will not attempt to allocate memory if the system has *any* unaccepted memory. Memory is accepted as needed and can remain in the system indefinitely, causing the interface to always fail. Rather than immediately giving up, attempt to use already accepted memory on free lists. Pass...
```diff diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 1b00e14a9780..7248e300d36e 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -290,7 +290,8 @@ EXPORT_SYMBOL(nr_online_nodes); #endif static bool page_contains_unaccepted(struct page *page, unsigned int order); -static bool cond_accept_memory(struct zo...
0ae0227fa31dda5bfc6b5a0145952d46fe57408b
Analyze and fix the following issue in the Linux kernel code: mm/codetag: move tag retrieval back upfront in __free_pages()
Problem Details: Commit 51ff4d7486f0 ("mm: avoid extra mem_alloc_profiling_enabled() checks") introduces a possible use-after-free scenario, when page is non-compound, page[0] could be released by other thread right after put_page_testzero failed in current thread, pgalloc_tag_sub_pages afterwards would manipulate an ...
```diff diff --git a/include/linux/pgalloc_tag.h b/include/linux/pgalloc_tag.h index c74077977830..8a7f4f802c57 100644 --- a/include/linux/pgalloc_tag.h +++ b/include/linux/pgalloc_tag.h @@ -188,6 +188,13 @@ static inline struct alloc_tag *__pgalloc_tag_get(struct page *page) return tag; } +static inline struct al...
4b7c0857f87a4c56e6e0a774939c2504b7afdc00
Analyze and fix the following issue in the Linux kernel code: mm/memory: fix mapcount / refcount sanity check for mTHP reuse
Problem Details: The following WARNING was triggered during swap stress test with mTHP enabled: [ 6609.335758] ------------[ cut here ]------------ [ 6609.337758] WARNING: CPU: 82 PID: 755116 at mm/memory.c:3794 do_wp_page+0x1084/0x10e0 [ 6609.340922] Modules linked in: zram virtiofs [ 6609.342699] CPU: 82 UID: 0 PID:...
```diff diff --git a/mm/memory.c b/mm/memory.c index ba3ea0a82f7f..49199410805c 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3751,7 +3751,7 @@ static bool __wp_can_reuse_large_anon_folio(struct folio *folio, /* Stabilize the mapcount vs. refcount and recheck. */ folio_lock_large_mapcount(folio); - VM_WARN_ON_ON...
e9f180d7cfde23b9f8eebd60272465176373ab2c
Analyze and fix the following issue in the Linux kernel code: kernel/fork: only call untrack_pfn_clear() on VMAs duplicated for fork()
Problem Details: Not intuitive, but vm_area_dup() located in kernel/fork.c is not only used for duplicating VMAs during fork(), but also for duplicating VMAs when splitting VMAs or when mremap()'ing them. VM_PFNMAP mappings can at least get ordinarily mremap()'ed (no change in size) and apparently also shrunk during m...
```diff diff --git a/kernel/fork.c b/kernel/fork.c index c4b26cd8998b..168681fc4b25 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -498,10 +498,6 @@ struct vm_area_struct *vm_area_dup(struct vm_area_struct *orig) vma_numab_state_init(new); dup_anon_vma_name(orig, new); - /* track_pfn_copy() will later take car...
a833a693a490ecff8ba377654c6d4d333718b6b1
Analyze and fix the following issue in the Linux kernel code: mm: hugetlb: fix incorrect fallback for subpool
Problem Details: During our testing with hugetlb subpool enabled, we observe that hstate->resv_huge_pages may underflow into negative values. Root cause analysis reveals a race condition in subpool reservation fallback handling as follow: hugetlb_reserve_pages() /* Attempt subpool reservation */ gbl_reserve =...
```diff diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 6ea1be71aa42..7ae38bfb9096 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3010,7 +3010,7 @@ struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, struct hugepage_subpool *spool = subpool_vma(vma); struct hstate *h = hstate_vma(vma); struct folio *fo...
adbdd746e8ba10088ad3efebee1ec278106a1a38
Analyze and fix the following issue in the Linux kernel code: nfsd: add a tracepoint for nfsd_setattr
Problem Details: Turn Sargun's internal kprobe based implementation of this into a normal static tracepoint. Also, remove the dprintk's that got added recently with the fix for zero-length ACLs. Cc: Sargun Dillon <sargun@sargun.me> Signed-off-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever...
```diff diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h index fc373c4d5fdd..b435276a1aaa 100644 --- a/fs/nfsd/trace.h +++ b/fs/nfsd/trace.h @@ -11,6 +11,7 @@ #include <linux/tracepoint.h> #include <linux/sunrpc/clnt.h> #include <linux/sunrpc/xprt.h> +#include <trace/misc/fs.h> #include <trace/misc/nfs.h> #include <...
8ac6fcae5dc0e801f1c82a83f5ae2c0a4db19932
Analyze and fix the following issue in the Linux kernel code: svcrdma: Unregister the device if svc_rdma_accept() fails
Problem Details: To handle device removal, svc_rdma_accept() requests removal notification for the underlying device when accepting a connection. However svc_rdma_free() is not invoked if svc_rdma_accept() fails. There needs to be a matching "unregister" in that case; otherwise the device cannot be removed. Fixes: c4d...
```diff diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c index aca8bdf65d72..5940a56023d1 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c @@ -575,6 +575,7 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt...
b31da62889e6d610114d81dc7a6edbcaa503fcf8
Analyze and fix the following issue in the Linux kernel code: nfsd: Initialize ssc before laundromat_work to prevent NULL dereference
Problem Details: In nfs4_state_start_net(), laundromat_work may access nfsd_ssc through nfs4_laundromat -> nfsd4_ssc_expire_umount. If nfsd_ssc isn't initialized, this can cause NULL pointer dereference. Normally the delayed start of laundromat_work allows sufficient time for nfsd_ssc initialization to complete. Howev...
```diff diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 9b3d6cff0e1e..8ed143ef8b41 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -396,13 +396,13 @@ static int nfsd_startup_net(struct net *net, const struct cred *cred) if (ret) goto out_filecache; +#ifdef CONFIG_NFSD_V4_2_INTER_SSC + nfsd4_ssc_in...
0813c5f01249dbc32ccbc68d27a24fde5bf2901c
Analyze and fix the following issue in the Linux kernel code: nfsd: fix access checking for NLM under XPRTSEC policies
Problem Details: When an export policy with xprtsec policy is set with "tls" and/or "mtls", but an NFS client is doing a v3 xprtsec=tls mount, then NLM locking calls fail with an error because there is currently no support for NLM with TLS. Until such support is added, allow NLM calls under TLS-secured policy. Fixes:...
```diff diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index 0363720280d4..88ae410b4113 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c @@ -1124,7 +1124,8 @@ __be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp, test_bit(XPT_PEER_AUTH, &xprt->xpt_flags)) goto ok; } - goto denied; ...
9fe5ea760e64f04412dbed51645a0dac7220d40a
Analyze and fix the following issue in the Linux kernel code: NFSD: Add /sys/kernel/debug/nfsd
Problem Details: Create a small sandbox under /sys/kernel/debug for experimental NFS server feature settings. There is no API/ABI compatibility guarantee for these settings. The only documentation for such settings, if any documentation exists, is in the kernel source code. Reviewed-by: Jeff Layton <jlayton@kernel.or...
```diff diff --git a/fs/nfsd/Makefile b/fs/nfsd/Makefile index 2f687619f65b..55744bb786c9 100644 --- a/fs/nfsd/Makefile +++ b/fs/nfsd/Makefile @@ -24,6 +24,7 @@ nfsd-$(CONFIG_NFSD_BLOCKLAYOUT) += blocklayout.o blocklayoutxdr.o nfsd-$(CONFIG_NFSD_SCSILAYOUT) += blocklayout.o blocklayoutxdr.o nfsd-$(CONFIG_NFSD_FLEXFIL...
f7fb730cac9aafda8b9813b55d04e28a9664d17c
Analyze and fix the following issue in the Linux kernel code: NFSD: fix race between nfsd registration and exports_proc
Problem Details: As of now nfsd calls create_proc_exports_entry() at start of init_nfsd and cleanup by remove_proc_entry() at last of exit_nfsd. Which causes kernel OOPs if there is race between below 2 operations: (i) exportfs -r (ii) mount -t nfsd none /proc/fs/nfsd for 5.4 kernel ARM64: CPU 1: el1_irq+0xbc/0x180 ...
```diff diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index d773481bcf10..f9763ced743d 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -2291,12 +2291,9 @@ static int __init init_nfsd(void) if (retval) goto out_free_pnfs; nfsd_lockd_init(); /* lockd->nfsd callbacks */ - retval = create_proc_exports_ent...
ff12eb379554eea7932ad6caea55e3091701cce4
Analyze and fix the following issue in the Linux kernel code: NFSD: unregister filesystem in case genl_register_family() fails
Problem Details: With rpc_status netlink support, unregister of register_filesystem() was missed in case of genl_register_family() fails. Correcting it by making new label. Fixes: bd9d6a3efa97 ("NFSD: add rpc_status netlink support") Cc: stable@vger.kernel.org Signed-off-by: Maninder Singh <maninder1.s@samsung.com> R...
```diff diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index ac265d6fde35..d773481bcf10 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -2305,7 +2305,7 @@ static int __init init_nfsd(void) goto out_free_cld; retval = register_filesystem(&nfsd_fs_type); if (retval) - goto out_free_all; + goto out_free...
2298abcbe11e9b553d03c0f1d084da786f7eff88
Analyze and fix the following issue in the Linux kernel code: sunrpc: fix race in cache cleanup causing stale nextcheck time
Problem Details: When cache cleanup runs concurrently with cache entry removal, a race condition can occur that leads to incorrect nextcheck times. This can delay cache cleanup for the cache_detail by up to 1800 seconds: 1. cache_clean() sets nextcheck to current time plus 1800 seconds 2. While scanning a non-empty bu...
```diff diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index bbaa77d7bbc8..131090f31e6a 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -464,24 +464,21 @@ static int cache_clean(void) } } + spin_lock(&current_detail->hash_lock); + /* find a non-empty bucket in the table */ - while (current_de...
5ca00634c8bbb2979c73465588f486b9632f5ed5
Analyze and fix the following issue in the Linux kernel code: sunrpc: update nextcheck time when adding new cache entries
Problem Details: The cache_detail structure uses a "nextcheck" field to control hash table scanning intervals. When a table scan begins, nextcheck is set to current time plus 1800 seconds. During scanning, if cache_detail is not empty and a cache entry's expiry time is earlier than the current nextcheck, the nextcheck ...
```diff diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 7ce5e28a6c03..bbaa77d7bbc8 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -135,6 +135,8 @@ static struct cache_head *sunrpc_cache_add_entry(struct cache_detail *detail, hlist_add_head_rcu(&new->cache_list, head); detail->entries++; + ...
f94ffc3f0b90bf4880e0abf2c056fc465e2c3be8
Analyze and fix the following issue in the Linux kernel code: platform/mellanox: mlxreg-dpu: Fix smatch warnings
Problem Details: Add missed call to release adapter. Remove wrong error pointer conversion. Fixes: 3e75f2954116 ("platform/mellanox: mlxreg-dpu: Add initial support for Nvidia DPU") Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> Link: https://lore.kernel.org/r/20250508203139.55171-1-vadimp@nvidia.com Reviewed-by: ...
```diff diff --git a/drivers/platform/mellanox/mlxreg-dpu.c b/drivers/platform/mellanox/mlxreg-dpu.c index 277e4b8cc5cb..52260106a9f1 100644 --- a/drivers/platform/mellanox/mlxreg-dpu.c +++ b/drivers/platform/mellanox/mlxreg-dpu.c @@ -535,8 +535,10 @@ static int mlxreg_dpu_probe(struct platform_device *pdev) return ...
8e725ff0419ad74dc79abfbdcd4cfba936a5d167
Analyze and fix the following issue in the Linux kernel code: platform: mellanox: nvsw-sn2200: Fix .items in nvsw_sn2201_busbar_hotplug
Problem Details: Clang warns (or errors with CONFIG_WERROR=y): drivers/platform/mellanox/nvsw-sn2201.c:531:32: error: variable 'nvsw_sn2201_busbar_items' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration] 531 | static struct mlxreg_core_item nvsw_sn2201_busbar_items[] = { | ...
```diff diff --git a/drivers/platform/mellanox/nvsw-sn2201.c b/drivers/platform/mellanox/nvsw-sn2201.c index 8c31189a94dd..db31c8bf2255 100644 --- a/drivers/platform/mellanox/nvsw-sn2201.c +++ b/drivers/platform/mellanox/nvsw-sn2201.c @@ -551,7 +551,7 @@ static struct mlxreg_core_item nvsw_sn2201_busbar_items[] = { ...
34b2f7b883fed54fae357f513d545b5d5fb9f31f
Analyze and fix the following issue in the Linux kernel code: arm64: dts: rockchip: drop wrong spdif clock from edp1 on rk3588
Problem Details: As described, the analogix-dp controller on rk3588 only supports 2 clocks and the edp0 node handles that correctly. The edp1 node on the other hand seems to have a dangling 3rd clock called spdif, that probably only exists in the vendor-tree. As that is not handled at all, remove it for now so that w...
```diff diff --git a/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi index 9d81d3b9444e..90414486e466 100644 --- a/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi @@ -255,8 +255,8 @@ edp1: edp@fded0000 { compatible ...
ceb6ef1ea9002669afc0e1ef258e530d3c05d91a
Analyze and fix the following issue in the Linux kernel code: arm64: dts: rockchip: Add RK3562 evb2 devicetree
Problem Details: DRAM: DDR4 Storage: eMMC PMIC: RK809 Audio: Headphone and speaker Interface: - USB3.0 HOST - USB2.0 HOST - PCIe x4 slot(pcie2x1 available) - SD card slot - GMAC - debug UART0 NOTE: the USB3.0 and the PCIe reuse the comboPHY, so the USB3.0 work in USB2 only mode. Signed-off-by: Finley Xiao <finley.xia...
```diff diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile index c3fd329acc6a..e63c3f5eb6fe 100644 --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile @@ -82,6 +82,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire.dtb dtb-$(CONFIG_ARCH_ROCKC...
dd33993a9721ab1dae38bd37c9f665987d554239
Analyze and fix the following issue in the Linux kernel code: ALSA: ump: Fix a typo of snd_ump_stream_msg_device_info
Problem Details: s/devince/device/ It's used only internally, so no any behavior changes. Fixes: 37e0e14128e0 ("ALSA: ump: Support UMP Endpoint and Function Block parsing") Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://patch.msgid.link/20250511141147.10246-1-tiwai@suse.de Signed-off-by: Taka...
```diff diff --git a/drivers/usb/gadget/function/f_midi2.c b/drivers/usb/gadget/function/f_midi2.c index 12e866fb311d..0a800ba53816 100644 --- a/drivers/usb/gadget/function/f_midi2.c +++ b/drivers/usb/gadget/function/f_midi2.c @@ -475,7 +475,7 @@ static void reply_ump_stream_ep_info(struct f_midi2_ep *ep) /* reply a U...
ff7b190aef6cccdb6f14d20c5753081fe6420e0b
Analyze and fix the following issue in the Linux kernel code: ALSA: seq: Fix delivery of UMP events to group ports
Problem Details: When an event with UMP message is sent to a UMP client, the EP port receives always no matter where the event is sent to, as it's a catch-all port. OTOH, if an event is sent to EP port, and if the event has a certain UMP Group, it should have been delivered to the associated UMP Group port, too, but t...
```diff diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index 198c598a5393..880240924bfd 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -732,15 +732,21 @@ static int snd_seq_deliver_single_event(struct snd_seq_client *client, */ static int __deliver_t...
499a8cee812588905cc940837e69918c1649a19e
Analyze and fix the following issue in the Linux kernel code: iio: adc: ad4851: fix ad4858 chan pointer handling
Problem Details: The pointer returned from ad4851_parse_channels_common() is incremented internally as each channel is populated. In ad4858_parse_channels(), the same pointer was further incremented while setting ext_scan_type fields for each channel. This resulted in indio_dev->channels being set to a pointer past the...
```diff diff --git a/drivers/iio/adc/ad4851.c b/drivers/iio/adc/ad4851.c index 98ebc853db79..f1d2e2896f2a 100644 --- a/drivers/iio/adc/ad4851.c +++ b/drivers/iio/adc/ad4851.c @@ -1034,7 +1034,7 @@ static int ad4858_parse_channels(struct iio_dev *indio_dev) struct device *dev = &st->spi->dev; struct iio_chan_spec *a...
f7387eff4bad33d12719c66c43541c095556ae4e
Analyze and fix the following issue in the Linux kernel code: x86/sev: Fix operator precedence in GHCB_MSR_VMPL_REQ_LEVEL macro
Problem Details: The GHCB_MSR_VMPL_REQ_LEVEL macro lacked parentheses around the bitmask expression, causing the shift operation to bind too early. As a result, when requesting VMPL1 (e.g., GHCB_MSR_VMPL_REQ_LEVEL(1)), incorrect values such as 0x000000016 were generated instead of the intended 0x100000016 (the requeste...
```diff diff --git a/arch/x86/include/asm/sev-common.h b/arch/x86/include/asm/sev-common.h index acb85b9346d8..0020d77a0800 100644 --- a/arch/x86/include/asm/sev-common.h +++ b/arch/x86/include/asm/sev-common.h @@ -116,7 +116,7 @@ enum psc_op { #define GHCB_MSR_VMPL_REQ 0x016 #define GHCB_MSR_VMPL_REQ_LEVEL(v) \ ...
094ac8cff7858bee5fa4554f6ea66c964f8e160e
Analyze and fix the following issue in the Linux kernel code: futex: Relax the rcu_assign_pointer() assignment of mm->futex_phash in futex_mm_init()
Problem Details: The following commit added an rcu_assign_pointer() assignment to futex_mm_init() in <linux/futex.h>: bd54df5ea7ca ("futex: Allow to resize the private local hash") Which breaks the build on older compilers (gcc-9, x86-64 defconfig): CC io_uring/futex.o In file included from ./arch/x86/i...
```diff diff --git a/include/linux/futex.h b/include/linux/futex.h index eccc99751bd9..168ffd5996b4 100644 --- a/include/linux/futex.h +++ b/include/linux/futex.h @@ -88,7 +88,14 @@ void futex_hash_free(struct mm_struct *mm); static inline void futex_mm_init(struct mm_struct *mm) { - rcu_assign_pointer(mm->futex_ph...
93406e9d024058b3bf487656ddd0ac552e5a366e
Analyze and fix the following issue in the Linux kernel code: Input: xpad - fix xpad_device sorting
Problem Details: A recent commit put one entry in the wrong place. This just moves it to the right place. Signed-off-by: Vicki Pfau <vi@endrift.com> Link: https://lore.kernel.org/r/20250328234345.989761-5-vi@endrift.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
```diff diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 418553cadc03..57a5ff3d1992 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -141,9 +141,9 @@ static const struct xpad_device { { 0x044f, 0x0f00, "Thrustmaster Wheel", 0, XTYPE_XBOX }, { 0x044f, ...
4ef46367073b107ec22f46fe5f12176e87c238e8
Analyze and fix the following issue in the Linux kernel code: Input: xpad - fix Share button on Xbox One controllers
Problem Details: The Share button, if present, is always one of two offsets from the end of the file, depending on the presence of a specific interface. As we lack parsing for the identify packet we can't automatically determine the presence of that interface, but we can hardcode which of these offsets is correct for a...
```diff diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 2c935cf79ddc..8ee7d8e5d1c7 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -77,12 +77,13 @@ * xbox d-pads should map to buttons, as is required for DDR pads * but we map them to axes when possi...
d05a424bea9aa3435009d5c462055008cc1545d8
Analyze and fix the following issue in the Linux kernel code: Input: xpad - fix two controller table values
Problem Details: Two controllers -- Mad Catz JOYTECH NEO SE Advanced and PDP Mirror's Edge Official -- were missing the value of the mapping field, and thus wouldn't detect properly. Signed-off-by: Vicki Pfau <vi@endrift.com> Link: https://lore.kernel.org/r/20250328234345.989761-1-vi@endrift.com Fixes: 540602a43ae5 ("...
```diff diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index c933e47173bd..2c935cf79ddc 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -205,7 +205,7 @@ static const struct xpad_device { { 0x0738, 0x9871, "Mad Catz Portable Drum", 0, XTYPE_XBOX360 }, { 0...