id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
6851161feb01cea41358c9ec304bd2f981fc8505
Analyze and fix the following issue in the Linux kernel code: Revert "esp: fix page frag reference leak on skb_to_sgvec failure"
Problem Details: This reverts commit 2982e599fff6faa21c8df147d96fc7af6c1a2f24. The patch does not fully fix the issue and the Author does not match the 'Signed-off-by:' tag, so revert it for now. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
```diff diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index 5d3a8656687e..513c8215c947 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c @@ -96,7 +96,7 @@ static inline struct scatterlist *esp_req_sg(struct crypto_aead *aead, __alignof__(struct scatterlist)); } -static void esp_ssg_unref(struct xfrm_state...
c852faa9817981eb3fccd69e9a650d729e17d24a
Analyze and fix the following issue in the Linux kernel code: gpu: nova-core: refactor SEC2 booter loading into BooterFirmware::run()
Problem Details: Move the SEC2 reset/load/boot sequence into a BooterFirmware::run() method. This is mostly refactoring, with no significant behavior change, done in preparation for adding an alternative FSP boot path. Suggested-by: Danilo Krummrich <dakr@kernel.org> Signed-off-by: John Hubbard <jhubbard@nvidia.com> R...
```diff diff --git a/drivers/gpu/nova-core/firmware/booter.rs b/drivers/gpu/nova-core/firmware/booter.rs index de2a4536b532..e45e5dc8d5d2 100644 --- a/drivers/gpu/nova-core/firmware/booter.rs +++ b/drivers/gpu/nova-core/firmware/booter.rs @@ -1,4 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 +// SPDX-FileCopyrightText: ...
5ab62dd3687bcc2cc542b99385aabac5c996db6f
Analyze and fix the following issue in the Linux kernel code: drm: prevent integer overflows in dumb buffer creation helpers
Problem Details: Fix integer overflow issues in the dumb buffer creation path: 1. drm_mode_create_dumb() does not bound width, height, or bpp before passing them to driver callbacks. Downstream helpers (e.g. drm_gem_dma_dumb_create_internal) perform pitch/size alignment in u32 arithmetic that can overflow fo...
```diff diff --git a/drivers/gpu/drm/drm_dumb_buffers.c b/drivers/gpu/drm/drm_dumb_buffers.c index e2b62e5fb891..cc99681a9ed0 100644 --- a/drivers/gpu/drm/drm_dumb_buffers.c +++ b/drivers/gpu/drm/drm_dumb_buffers.c @@ -70,8 +70,11 @@ static int drm_mode_align_dumb(struct drm_mode_create_dumb *args, if (!pitch) ret...
4c600ab0d8cfc9d75b92f3426dbcb2ad85eac91d
Analyze and fix the following issue in the Linux kernel code: crypto: loongson - Select CRYPTO_RNG
Problem Details: This driver registers a rng_alg, so it requires CRYPTO_RNG. Fixes: 766b2d724c8d ("crypto: loongson - add Loongson RNG driver support") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202605201622.qWOiiZTV-lkp@intel.com/ Cc: stable@vger.kernel.org Signed-off...
```diff diff --git a/drivers/crypto/loongson/Kconfig b/drivers/crypto/loongson/Kconfig index 15475da8fc11..f4e1544ffbb4 100644 --- a/drivers/crypto/loongson/Kconfig +++ b/drivers/crypto/loongson/Kconfig @@ -1,5 +1,6 @@ config CRYPTO_DEV_LOONGSON_RNG tristate "Support for Loongson RNG Driver" depends on MFD_LOONGSO...
50e506201bab875545c7a9443bd7e1c71804e553
Analyze and fix the following issue in the Linux kernel code: crypto: ccp/tsm - Enable the root port after the endpoint
Problem Details: The PCIe r7.0, chapter "6.33.8 Other IDE Rules" mandates if selective IDE is enabled for config requersts, a stream must be enabled on the endpoint before enabling it on the rootport: === For Selective IDE, the Stream must not be used until it has been enabled in both Partner Ports. For cases where on...
```diff diff --git a/drivers/crypto/ccp/sev-dev-tsm.c b/drivers/crypto/ccp/sev-dev-tsm.c index f303d8f55991..46f2539d2d5a 100644 --- a/drivers/crypto/ccp/sev-dev-tsm.c +++ b/drivers/crypto/ccp/sev-dev-tsm.c @@ -58,13 +58,13 @@ static int stream_enable(struct pci_ide *ide) struct pci_dev *rp = pcie_find_root_port(ide-...
5c6f845e77ec35f9b7b047cc8f9789bf397cdd3e
Analyze and fix the following issue in the Linux kernel code: crypto: qat - protect service table iterations with service_lock
Problem Details: The service_table list is protected by service_lock when entries are added or removed (in adf_service_add() and adf_service_remove()), but several functions iterate over the list without holding this lock. A concurrent adf_service_register() or adf_service_unregister() call could modify the list durin...
```diff diff --git a/drivers/crypto/intel/qat/qat_common/adf_init.c b/drivers/crypto/intel/qat/qat_common/adf_init.c index f9f5696ed476..1c7f9e49914d 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_init.c +++ b/drivers/crypto/intel/qat/qat_common/adf_init.c @@ -155,15 +155,18 @@ static int adf_dev_init(struct adf_...
7d3ed20f7e46b3e991936fedd7a28f3ff4aec8d2
Analyze and fix the following issue in the Linux kernel code: crypto: qat - fix restarting state leak on allocation failure
Problem Details: In adf_dev_aer_schedule_reset(), ADF_STATUS_RESTARTING is set before allocating reset_data. If the allocation fails, the function returns -ENOMEM without queuing reset work, so nothing ever clears the bit. This leaves the device permanently stuck in the restarting state, causing all subsequent reset at...
```diff diff --git a/drivers/crypto/intel/qat/qat_common/adf_aer.c b/drivers/crypto/intel/qat/qat_common/adf_aer.c index af028488e660..3fc7d13e882c 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_aer.c +++ b/drivers/crypto/intel/qat/qat_common/adf_aer.c @@ -207,13 +207,14 @@ static int adf_dev_aer_schedule_reset(s...
ecf3edd349dfabee9bc8a46c5ff91c9ebd858d48
Analyze and fix the following issue in the Linux kernel code: crypto: s390 - add select CRYPTO_AEAD for aes
Problem Details: The aes driver registers both skcipher and aead algorithms, but when aead is not enabled this causes a link failure: s390-linux-ld: arch/s390/crypto/aes_s390.o: in function `aes_s390_fini': arch/s390/crypto/aes_s390.c:969:(.text+0x115e): undefined reference to `crypto_unregister_aead' s390-linux-ld: a...
```diff diff --git a/arch/s390/crypto/Kconfig b/arch/s390/crypto/Kconfig index 00051d27db95..228570a1b233 100644 --- a/arch/s390/crypto/Kconfig +++ b/arch/s390/crypto/Kconfig @@ -4,6 +4,7 @@ menu "Accelerated Cryptographic Algorithms for CPU (s390)" config CRYPTO_AES_S390 tristate "Ciphers: AES, modes: ECB, CBC, C...
690a5f9e5c972a580565ce544ed1627ccf1e84de
Analyze and fix the following issue in the Linux kernel code: crypto: tegra - Return ENOMEM when input buffer allocation fails for ccm
Problem Details: Ensure the ENOMEM error value is set when the input buffer allocation fails in tegra_ccm_do_one_req. Fixes: 1e245948ca0c ("crypto: tegra - finalize crypto req on error") Reported-by: Vladislav Dronov <vdronov@redhat.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Reviewed-by: Vladislav Dr...
```diff diff --git a/drivers/crypto/tegra/tegra-se-aes.c b/drivers/crypto/tegra/tegra-se-aes.c index 5086e7f140c3..9094c03e991f 100644 --- a/drivers/crypto/tegra/tegra-se-aes.c +++ b/drivers/crypto/tegra/tegra-se-aes.c @@ -1215,16 +1215,15 @@ static int tegra_ccm_do_one_req(struct crypto_engine *engine, void *areq) r...
03215b8457784540acc741e6331e355b62c6c8ab
Analyze and fix the following issue in the Linux kernel code: crypto: tegra - Fix dma_free_coherent size error
Problem Details: When freeing a coherent DMA buffer, the size must match the value that was used during the allocation. Unfortunately the size field in the tegra driver gets overwritten by this point so it no longer matches and creates a warning. Fix this by saving a copy of the size on the stack. Note that the ccm ...
```diff diff --git a/drivers/crypto/tegra/tegra-se-aes.c b/drivers/crypto/tegra/tegra-se-aes.c index 30c78afe3dea..5086e7f140c3 100644 --- a/drivers/crypto/tegra/tegra-se-aes.c +++ b/drivers/crypto/tegra/tegra-se-aes.c @@ -1201,6 +1201,7 @@ static int tegra_ccm_do_one_req(struct crypto_engine *engine, void *areq) str...
85a61bf9145d4097c740ffcf3aa832d930a8913b
Analyze and fix the following issue in the Linux kernel code: crypto: inside-secure/eip93 - Add check for devm_request_threaded_irq
Problem Details: As the potential failure of the devm_request_threaded_irq(), it should be better to check the return value and return error if fails. Fixes: 9739f5f93b78 ("crypto: eip93 - Add Inside Secure SafeXcel EIP-93 crypto engine support") Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl> Signed-off-by: Her...
```diff diff --git a/drivers/crypto/inside-secure/eip93/eip93-main.c b/drivers/crypto/inside-secure/eip93/eip93-main.c index 320a37d1f7dc..1a8dabc4ada4 100644 --- a/drivers/crypto/inside-secure/eip93/eip93-main.c +++ b/drivers/crypto/inside-secure/eip93/eip93-main.c @@ -433,6 +433,8 @@ static int eip93_crypto_probe(str...
e71dc5602b9a29027f6aedd5990d3e8c4f638c8c
Analyze and fix the following issue in the Linux kernel code: crypto: hisilicon/qm - disable error report before flr
Problem Details: Before function level reset, driver first disable device error report and then waits for the device reset to complete. However, when the error is recovered, the error bits will be enabled again, resulting in invalid disable. It is modified to detect that there is no error before disable error report, a...
```diff diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index 2b3132595e42..90b447b934c6 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -5004,8 +5004,6 @@ void hisi_qm_reset_prepare(struct pci_dev *pdev) u32 delay = 0; int ret; - hisi_qm_dev_err_uninit...
1aee05e814d292064bf5fa15733741040cdc48ba
Analyze and fix the following issue in the Linux kernel code: erofs: fix use-after-free on sbi->sync_decompress
Problem Details: z_erofs_decompress_kickoff() can race with filesystem unmount, causing a use-after-free on sbi->sync_decompress. When I/O completes, z_erofs_endio() calls z_erofs_decompress_kickoff() to queue z_erofs_decompressqueue_work() asynchronously. Then, after all folios are unlocked, unmount workflow can proc...
```diff diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 27ab7bd844ec..c6240dccbb0f 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -1455,6 +1455,9 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io, if (atomic_add_return(bios, &io->pending_bios)) return; if (z_erofs_in_at...
7ebc672fab7a76e1e47e0f2fc1ee48118d27fde4
Analyze and fix the following issue in the Linux kernel code: ocfs2: reject non-inline dinodes with i_size and zero i_clusters
Problem Details: On a volume mounted without OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC, a non-inline regular file with non-zero i_size and zero i_clusters is structurally malformed: the extent map declares no allocated clusters yet the size header claims content exists. Keep rejecting that shape, but express it through a sh...
```diff diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 992980ea9804..432eac01c176 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c @@ -82,6 +82,24 @@ static bool ocfs2_dinode_has_unexpected_rdev(struct ocfs2_dinode *di) return !S_ISCHR(mode) && !S_ISBLK(mode) && di->id1.dev1.i_rdev != 0; } +static bool...
51407c2d249987a466416890a5c931a2354a46aa
Analyze and fix the following issue in the Linux kernel code: ocfs2: reject dinodes whose i_rdev disagrees with the file type
Problem Details: id1.dev1.i_rdev is the device-number arm of the ocfs2_dinode id1 union. It is only meaningful for character and block device inodes. For any other user-visible file type the on-disk value must be zero. ocfs2_populate_inode() currently copies id1.dev1.i_rdev into inode->i_rdev before the S_IFMT switc...
```diff diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index e149ccbdc03c..992980ea9804 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c @@ -72,6 +72,16 @@ static bool ocfs2_valid_inode_mode(umode_t mode) return fs_umode_to_ftype(mode) != FT_UNKNOWN; } +static bool ocfs2_dinode_has_unexpected_rdev(struct ocf...
5366a017099c6a3c443be908a05f26fd72af12a1
Analyze and fix the following issue in the Linux kernel code: ocfs2: reject dinodes with non-canonical i_mode type
Problem Details: Patch series "ocfs2: harden inode validators against forged metadata", v2. This series adds three structural checks to OCFS2 dinode validation so malformed on-disk fields are rejected before ocfs2_populate_inode() copies them into the in-core inode. The checks cover: - i_mode values whose type bit...
```diff diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index a510a0eb1adc..e149ccbdc03c 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c @@ -13,6 +13,7 @@ #include <linux/pagemap.h> #include <linux/quotaops.h> #include <linux/iversion.h> +#include <linux/fs_dirent.h> #include <asm/byteorder.h> @@ -64,7 +6...
f5b1910e23f1233c8d4185268b2e659df2bc5dbf
Analyze and fix the following issue in the Linux kernel code: ocfs2: kill osb->system_file_mutex lock
Problem Details: Commit 43b10a20372d ("ocfs2: avoid system inode ref confusion by adding mutex lock") tried to avoid a refcount leak caused by allowing multiple threads to call igrab(inode). But addition of osb->system_file_mutex made locking dependency complicated and is causing lockdep to warn about possibility of A...
```diff diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index 7b50e03dfa66..62cad6522c7a 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h @@ -494,8 +494,6 @@ struct ocfs2_super struct rb_root osb_rf_lock_tree; struct ocfs2_refcount_tree *osb_ref_tree_lru; - struct mutex system_file_mutex; - /* * OCFS2 n...
fa0c812c0aa58d4375317d804dd54e44b8bcf5e3
Analyze and fix the following issue in the Linux kernel code: raid6_kunit: randomize parameters and increase limits
Problem Details: The current test has double-quadratic behavior in the selection for the updated ("XORed") disks, and in the selection of updated pointers, which makes scaling it to more tests difficult. At the same time it only ever tests with the maximum number of disks, which leaves a coverage hole for smaller ones...
```diff diff --git a/lib/raid/raid6/tests/raid6_kunit.c b/lib/raid/raid6/tests/raid6_kunit.c index 152d5d1c3a88..71adf8932e93 100644 --- a/lib/raid/raid6/tests/raid6_kunit.c +++ b/lib/raid/raid6/tests/raid6_kunit.c @@ -8,18 +8,21 @@ #include <kunit/test.h> #include <linux/prandom.h> #include <linux/vmalloc.h> +#incl...
2790045a62eb52a5052eed06ddcc10b03b007a39
Analyze and fix the following issue in the Linux kernel code: raid6: warn when using less than four devices
Problem Details: Quoting H. Peter Anvin who came up with the RAID6 P/Q algorithm, and who wrote the initial implementation, then still part of the md driver: The RAID-6 code has *never* supported only 3 units, and if it ever worked for *any* of the implementations it was purely by accident. Speaking as the orig...
```diff diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h index 425a227591c0..87e3cb55bf07 100644 --- a/include/linux/raid/pq.h +++ b/include/linux/raid/pq.h @@ -11,6 +11,8 @@ #include <linux/blkdev.h> #include <linux/mm.h> +#define RAID6_MIN_DISKS 4 + void raid6_gen_syndrome(int disks, size_t bytes,...
3626738bc7147d52cb49f3994a9846aa2d34810a
Analyze and fix the following issue in the Linux kernel code: raid6: move to lib/raid/
Problem Details: Move the raid6 code to live in lib/raid/ with the XOR code, and change the internal organization so that each architecture has a subdirectory similar to the CRC, crypto and XOR libraries, and fix up the Makefile to only build files actually needed. Also move the kunit test case from the history test/ ...
```diff diff --git a/MAINTAINERS b/MAINTAINERS index 236b0785bf3d..49a264b999e2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -24823,7 +24823,7 @@ F: drivers/md/md* F: drivers/md/raid* F: include/linux/raid/ F: include/uapi/linux/raid/ -F: lib/raid6/ +F: lib/raid/raid6/ SOLIDRUN CLEARFOG SUPPORT M: Russell King ...
442082297e3d38f3a59754ff56fc07d72a93fdbd
Analyze and fix the following issue in the Linux kernel code: riscv: fix building compressed EFI image
Problem Details: When building vmlinuz.efi with CONFIG_EFI_ZBOOT enabled, '__lshrdi3()' is also needed to fix yet another link error observed when building riscv32 and loongarch32 images: riscv32-linux-gnu-ld: drivers/firmware/efi/libstub/lib-cmdline.stub.o: in function `__efistub_.L49': __efistub_cmdline.c:(.init.tex...
```diff diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile index cfedb3025c26..77a2b2d74f3f 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile @@ -95,8 +95,10 @@ CFLAGS_zboot-decompress-gzip.o += -I$(srctree)/lib/zlib_inflate zboot-obj...
a354b8de9ad607c0a11419a402df46b46503f921
Analyze and fix the following issue in the Linux kernel code: riscv: add platform-specific double word shifts for riscv32
Problem Details: Add riscv32-specific '__ashldi3()', '__ashrdi3()', and '__lshrdi3()'. Initially it was intended to fix the following link error observed when building EFI-enabled kernel with CONFIG_EFI_STUB=y and CONFIG_EFI_GENERIC_STUB=y: riscv32-linux-gnu-ld: ./drivers/firmware/efi/libstub/lib-cmdline.stub.o: in f...
```diff diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index c5754942cf85..0d10b299bad8 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -404,9 +404,6 @@ config ARCH_RV32I bool "RV32I" depends on NONPORTABLE select 32BIT - select GENERIC_LIB_ASHLDI3 - select GENERIC_LIB_ASHRDI3 - select GENERIC_L...
117d2bfa0ab1bec88d600c50884000334f034338
Analyze and fix the following issue in the Linux kernel code: lib/cmdline: adjust a few comments to fix kernel-doc -Wreturn warnings
Problem Details: Fix 'get_option()', 'memparse()' and 'parse_option_str()' comments to match the commonly used style as suggested by kernel-doc -Wreturn. Link: https://lore.kernel.org/20260519172259.908980-6-dmantipov@yandex.ru Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Suggested-by: Andy Shevchenko <andriy.s...
```diff diff --git a/lib/cmdline.c b/lib/cmdline.c index f6e4b113ca9f..16cce6621cec 100644 --- a/lib/cmdline.c +++ b/lib/cmdline.c @@ -43,7 +43,7 @@ static int get_range(char **str, int *pint, int n) * When @pint is NULL the function can be used as a validator of * the current option in the string. * - * Return v...
ab90fc1007245380988c500ddf7eff6da1b10056
Analyze and fix the following issue in the Linux kernel code: lib: add more string to 64-bit integer conversion overflow tests
Problem Details: Add a few more string to 64-bit integer conversion tests to check whether 'kstrtoull()', 'kstrtoll()', 'kstrtou64()' and 'kstrtos64()' can handle overflows reported by '_parse_integer_limit()'. Link: https://lore.kernel.org/20260519172259.908980-4-dmantipov@yandex.ru Signed-off-by: Dmitry Antipov <dma...
```diff diff --git a/lib/test-kstrtox.c b/lib/test-kstrtox.c index ee87fef66cb5..811128d0df16 100644 --- a/lib/test-kstrtox.c +++ b/lib/test-kstrtox.c @@ -198,6 +198,7 @@ static void __init test_kstrtoull_fail(void) {"10000000000000000000000000000000000000000000000000000000000000000", 2}, {"2000000000000000000000...
9a4580db6e9f83428813f671a79486469684069f
Analyze and fix the following issue in the Linux kernel code: lib: fix memparse() to handle overflow
Problem Details: Since '_parse_integer_limit()' (and so 'simple_strtoull()') is now capable to handle overflow, adjust 'memparse()' to handle overflow (denoted by ULLONG_MAX) returned from 'simple_strtoull()'. Also use 'check_shl_overflow()' to catch an overflow possibly caused by processing size suffix and denote it ...
```diff diff --git a/lib/cmdline.c b/lib/cmdline.c index 90ed997d9570..f6e4b113ca9f 100644 --- a/lib/cmdline.c +++ b/lib/cmdline.c @@ -150,39 +150,46 @@ EXPORT_SYMBOL(get_options); unsigned long long memparse(const char *ptr, char **retptr) { char *endptr; /* local pointer to end of parsed string */ - unsigned lo...
6e30111dbb4075e3c26c230417b32bc4a1c66831
Analyze and fix the following issue in the Linux kernel code: lib: fix _parse_integer_limit() to handle overflow
Problem Details: Patch series "lib and lib/cmdline enhancements", v11. This series is a merge of the recently posted [1] and [2]. The first one is intended to adjust '_parse_integer_limit()' and 'memparse()' to not ignore overflows, extend string to 64-bit integer conversion tests, add KUnit-based test for 'memparse(...
```diff diff --git a/lib/kstrtox.c b/lib/kstrtox.c index 97be2a39f537..edc4eb7c1bca 100644 --- a/lib/kstrtox.c +++ b/lib/kstrtox.c @@ -39,25 +39,30 @@ const char *_parse_integer_fixup_radix(const char *s, unsigned int *base) return s; } -/* - * Convert non-negative integer string representation in explicitly given...
2f5026b8d4fe34601d692ae7f7cd27367e002266
Analyze and fix the following issue in the Linux kernel code: selftests/perf_events: fix mmap() error check in sigtrap_threads
Problem Details: In sigtrap_threads(), the return value of mmap() is checked against NULL. mmap() returns MAP_FAILED, which is (void *)-1, not NULL, when it fails. Since MAP_FAILED is non-zero and non-NULL, the condition "p == NULL" will never be true on failure, causing the program to proceed with an invalid pointer...
```diff diff --git a/tools/testing/selftests/perf_events/watermark_signal.c b/tools/testing/selftests/perf_events/watermark_signal.c index 0f64b9b17081..a84709cabd8b 100644 --- a/tools/testing/selftests/perf_events/watermark_signal.c +++ b/tools/testing/selftests/perf_events/watermark_signal.c @@ -102,7 +102,7 @@ TEST(...
1c56b9cb489e7aa820dd61860e3dd892bdebe80c
Analyze and fix the following issue in the Linux kernel code: lib/bug: cleanup comment style, types and modernize logging
Problem Details: Improve the overall code quality of lib/bug.c by: - Reformatting the main documentation block to follow the standard kernel multi-line comment style. - Replacing 'unsigned' with the preferred 'unsigned int'. - Converting legacy printk() calls to modern pr_warn() and pr_info() macros to include prop...
```diff diff --git a/lib/bug.c b/lib/bug.c index 224f4cfa4aa3..f4a4df3991b0 100644 --- a/lib/bug.c +++ b/lib/bug.c @@ -1,41 +1,41 @@ // SPDX-License-Identifier: GPL-2.0 /* - Generic support for BUG() - - This respects the following config options: - - CONFIG_BUG - emit BUG traps. Nothing happens without this. - ...
bda614e6b4f27d3535ee86a96a6bab3b9b4f5e87
Analyze and fix the following issue in the Linux kernel code: ocfs2: validate inline xattr header before reflinking inline xattrs
Problem Details: [BUG] A corrupt inline xattr header can make ocfs2_reflink_xattr_inline() lock, copy, and reflink xattr state from an unchecked ibody xattr header. [CAUSE] The inline reflink path still trusted di->i_xattr_inline_size to compute header_off, xh, and new_xh before handing the source header to the reflin...
```diff diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 4877406a83ce..fcddd3c13acd 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c @@ -6511,12 +6511,10 @@ static int ocfs2_reflink_xattr_inline(struct ocfs2_xattr_reflink *args) handle_t *handle; struct ocfs2_super *osb = OCFS2_SB(args->old_inode->i_sb); ...
4523ba0ee2e9ab6ee9c4b20b2867c3e4aa01f503
Analyze and fix the following issue in the Linux kernel code: ocfs2: validate inline xattr header before inline refcount attach
Problem Details: [BUG] A corrupt inline xattr header can make ocfs2_xattr_inline_attach_refcount() feed an unchecked header into the refcount-attachment walk for inline xattr values. [CAUSE] The inline refcount-attach path still derived the header directly from di->i_xattr_inline_size and then passed it to code that i...
```diff diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index bbb25a01b097..4877406a83ce 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c @@ -6016,14 +6016,17 @@ static int ocfs2_xattr_inline_attach_refcount(struct inode *inode, struct ocfs2_cached_dealloc_ctxt *dealloc) { struct ocfs2_dinode *di = (struct...
b8ba8bbe69ad8a37e2f9bc2792c1b825f1964c91
Analyze and fix the following issue in the Linux kernel code: ocfs2: validate inline xattr header before ibody remove
Problem Details: [BUG] A corrupt inline xattr header can make ocfs2_xattr_ibody_remove() pass an unchecked header into ocfs2_remove_value_outside() during inode xattr teardown. [CAUSE] ocfs2_xattr_ibody_remove() still rebuilt the ibody xattr header directly from di->i_xattr_inline_size and then handed it to code that ...
```diff diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 05f6f0a886cf..bbb25a01b097 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c @@ -2476,9 +2476,9 @@ static int ocfs2_xattr_ibody_remove(struct inode *inode, .vb_access = ocfs2_journal_access_di, }; - header = (struct ocfs2_xattr_header *) - ((voi...
a61b83dd83ed44e937de7aead2b4ddd3ad32e3f8
Analyze and fix the following issue in the Linux kernel code: ocfs2: validate inline xattr header before checking outside values
Problem Details: [BUG] A corrupt inline xattr header can make ocfs2_has_inline_xattr_value_outside() walk xh_count from an unchecked header while refcount-tree teardown decides whether inline xattrs still point outside the inode body. [CAUSE] ocfs2_has_inline_xattr_value_outside() still computed the inline header dire...
```diff diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 3a5a17cdcf7e..05f6f0a886cf 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c @@ -989,11 +989,12 @@ int ocfs2_has_inline_xattr_value_outside(struct inode *inode, struct ocfs2_dinode *di) { struct ocfs2_xattr_header *xh; + int ret; int i; - x...
bef1006da49c91e8e154223d3005829a394f8f78
Analyze and fix the following issue in the Linux kernel code: ocfs2: validate inline xattr header before ibody lookups
Problem Details: Patch series "ocfs2: validate inline xattr header consumers". Corrupt i_xattr_inline_size can move the computed inode-body xattr header outside the dinode block. Several OCFS2 paths then trust xh_count or xattr entry geometry from that unchecked header. The reported KASAN splat hits the ibody lookup ...
```diff diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 86cfd4c2adf9..3a5a17cdcf7e 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c @@ -950,6 +950,41 @@ static int ocfs2_xattr_list_entries(struct inode *inode, return result; } +static int ocfs2_xattr_ibody_lookup_header(struct inode *inode, + str...
c0438198c28b1d22c272751af5e717c11d9fa8dd
Analyze and fix the following issue in the Linux kernel code: ocfs2: don't BUG_ON an invalid journal dinode
Problem Details: [BUG] A fuzzed OCFS2 image can corrupt the current slot journal dinode while mount is still in progress. The mount path first reports the invalid journal block and then crashes in shutdown: kernel BUG at fs/ocfs2/journal.c:1034! Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI RIP: 0010:ocfs2_journal_t...
```diff diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index f9bf3bac085d..fc54cc798ce3 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c @@ -1022,11 +1022,8 @@ static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb, struct ocfs2_dinode *fe; fe = (struct ocfs2_dinode *)bh->b_data; - - /* The j...
738ce4979c802ba0f1f8249a893aa7db1fbb2cf8
Analyze and fix the following issue in the Linux kernel code: ocfs2: reject inconsistent inode size before truncate
Problem Details: [BUG] openat(..., O_WRONLY|O_CREAT|O_TRUNC) can hit: kernel BUG at fs/ocfs2/file.c:454! Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI RIP: 0010:ocfs2_truncate_file+0x1204/0x13c0 fs/ocfs2/file.c:454 Call Trace: ocfs2_setattr+0xa6d/0x1fd0 fs/ocfs2/file.c:1212 notify_change+0x4b5/0x1030 fs/attr.c:546...
```diff diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 7df9921c1a38..d6e977ba6565 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -444,21 +444,26 @@ int ocfs2_truncate_file(struct inode *inode, struct ocfs2_dinode *fe = NULL; struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); - /* We trust di_bh because...
56cb9b7d96b28a1173a510ab25354b6599ad3a33
Analyze and fix the following issue in the Linux kernel code: gcov: use atomic counter updates to fix concurrent access crashes
Problem Details: GCC's GCOV instrumentation can merge global branch counters with loop induction variables as an optimization. In inflate_fast(), the inner copy loops get transformed so that the GCOV counter value is loaded multiple times to compute the loop base address, start index, and end bound. Since GCOV counte...
```diff diff --git a/Makefile b/Makefile index f056c921ea9c..8813f24b1ff4 100644 --- a/Makefile +++ b/Makefile @@ -826,12 +826,6 @@ endif # KBUILD_EXTMOD # Defaults to vmlinux, but the arch makefile usually adds further targets all: vmlinux -CFLAGS_GCOV := -fprofile-arcs -ftest-coverage -ifdef CONFIG_CC_IS_GCC -CFL...
e4f5f6f3c199ae7fbe142da6b79a97a504ac7e55
Analyze and fix the following issue in the Linux kernel code: kfence: fix KASAN HW tags bypass via runtime sample_interval change
Problem Details: If a user writes a non-zero value to the sample_interval module parameter at runtime, the missing KASAN HW tags check in the late init path allows KFENCE to be enabled alongside KASAN HW tags, bypassing the boot restriction. This patch adds the missing check to param_set_sample_interval() to reject th...
```diff diff --git a/mm/kfence/core.c b/mm/kfence/core.c index 655dc5ce3240..ee6ae01de5ae 100644 --- a/mm/kfence/core.c +++ b/mm/kfence/core.c @@ -77,6 +77,11 @@ static int param_set_sample_interval(const char *val, const struct kernel_param WRITE_ONCE(kfence_enabled, false); } + if (num && kasan_hw_tags_enabled...
fc15e3a30ddd950f009c76765331783b9af94a87
Analyze and fix the following issue in the Linux kernel code: rapidio/tsi721: prevent a bad dereference in tsi721_db_dpc()
Problem Details: With a list_for_each() loop, if we don't find the item we are looking for in the list, then the loop exits with the iterator, which is "dbell" in this loop, pointing to invalid memory. This code uses the "found" variable to determine if we have found the doorbell we are looking for or not. However, t...
```diff diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c index 66331e67cf4e..71b87bf8c31d 100644 --- a/drivers/rapidio/devices/tsi721.c +++ b/drivers/rapidio/devices/tsi721.c @@ -394,7 +394,6 @@ static void tsi721_db_dpc(struct work_struct *work) idb_work); struct rio_mport ...
bd99fcfc6219ebe36ae4d0bf5333b5ecc17b53df
Analyze and fix the following issue in the Linux kernel code: uaccess: minimize INLINE_COPY_USER-related ifdefery
Problem Details: Now that we've got the same config selecting inline vs outline copy_to_user() and copy_from_user(), we can simplify the corresponding logic in the uaccess.h. Link: https://lore.kernel.org/20260425020857.356850-4-ynorov@nvidia.com Fixes: 1f9a8286bc0c ("uaccess: always export _copy_[from|to]_user with C...
```diff diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index 6100f1046546..e0c3d6e29301 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h @@ -190,10 +190,6 @@ fail: memset(to + (n - res), 0, res); return res; } -#ifndef INLINE_COPY_USER -extern __must_check unsigned long -_copy_fro...
f829d4d911cc296b32d14436a8a517e907228475
Analyze and fix the following issue in the Linux kernel code: rust: uaccess: use INLINE_COPY_TO_USER to guard copy_to_user()
Problem Details: Patch series "uaccess: unify inline vs outline copy_{from,to}_user() selection", v2. The kernel allows arches to select between inline and outline implementations of the copy_{from,to}_user() by defining individual INLINE_COPY_FROM_USER and INLINE_COPY_TO_USER, correspondingly. However, all arches en...
```diff diff --git a/rust/helpers/uaccess.c b/rust/helpers/uaccess.c index d9625b9ee046..aff22f16ab38 100644 --- a/rust/helpers/uaccess.c +++ b/rust/helpers/uaccess.c @@ -20,7 +20,9 @@ unsigned long rust_helper__copy_from_user(void *to, const void __user *from, uns { return _inline_copy_from_user(to, from, n); } +#...
f424800c2a23d9fdc1355bdaf46ad2bc89741436
Analyze and fix the following issue in the Linux kernel code: lib/base64: fix copy-pasted @padding doc in base64_decode()
Problem Details: The @padding kernel-doc for base64_decode() says "whether to append '=' padding characters", which was copy-pasted from base64_encode(). In the decode context, it controls whether the input is expected to include padding, not whether to append it. Link: https://lore.kernel.org/20260324223210.47676-3-...
```diff diff --git a/lib/base64.c b/lib/base64.c index 20dacee25f65..325c7332b049 100644 --- a/lib/base64.c +++ b/lib/base64.c @@ -122,7 +122,7 @@ EXPORT_SYMBOL_GPL(base64_encode); * @src: the string to decode. Doesn't need to be NUL-terminated. * @srclen: the length of @src in bytes * @dst: (output) the decoded...
cae29a5787e38ce7ec7727a87ac7e393a85cb1ef
Analyze and fix the following issue in the Linux kernel code: lib/base64: validate before writing in decode tail path
Problem Details: Patch series "lib/base64: decode fixes", v2. Two small fixes for lib/base64.c: 1. base64_decode() writes a decoded byte to the output buffer before validating the input in the trailing-bytes path. Move the validity checks before any writes so dst is untouched on invalid input. 2. The @padding ...
```diff diff --git a/lib/base64.c b/lib/base64.c index 41961a444028..20dacee25f65 100644 --- a/lib/base64.c +++ b/lib/base64.c @@ -168,15 +168,16 @@ int base64_decode(const char *src, int srclen, u8 *dst, bool padding, enum base6 return -1; val = (base64_rev_tables[s[0]] << 12) | (base64_rev_tables[s[1]] << 6); ...
97bd80a91858ea72be5aa4565af2721fb732eba6
Analyze and fix the following issue in the Linux kernel code: treewide: fix indentation and whitespace in Kconfig files
Problem Details: Clean up inconsistent indentation (mixing tabs and spaces) and remove extraneous whitespace in several Kconfig files across the tree. This is a purely cosmetic change to improve readability. Adjust indentation from spaces to tab (+optional two spaces) as in coding style with command like: $ sed -e '...
```diff diff --git a/certs/Kconfig b/certs/Kconfig index 8e39a80c7abe..9d2bf7fb5b9e 100644 --- a/certs/Kconfig +++ b/certs/Kconfig @@ -6,14 +6,14 @@ config MODULE_SIG_KEY default "certs/signing_key.pem" depends on MODULE_SIG || (IMA_APPRAISE_MODSIG && MODULES) help - Provide the file name of a private key...
09d8b39563e84fc245d642182715a7e0e024b0f2
Analyze and fix the following issue in the Linux kernel code: get_maintainer: add --json output mode
Problem Details: Add a --json flag to get_maintainer.pl that emits structured JSON output, making results machine-parseable for CI systems, IDE integrations, and AI-assisted development tools. The JSON output includes a maintainers array with structured name, email, and role fields, plus optional arrays for scm, statu...
```diff diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index f0ca0db6ddc2..16b80a700d4a 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -21,6 +21,7 @@ use Cwd; use File::Find; use File::Spec::Functions; use open qw(:std :encoding(UTF-8)); +use JSON::PP; my $cur_path =...
f13f1b0cb56491547243e502988282e5be50bc44
Analyze and fix the following issue in the Linux kernel code: seq_buf: export seq_buf_putmem_hex() and add KUnit tests
Problem Details: The seq_buf KUnit suite does not exercise seq_buf_putmem_hex(). Add one test for the len > 8 chunking path and one overflow test where a later chunk no longer fits in the buffer. Export seq_buf_putmem_hex() as well so SEQ_BUF_KUNIT_TEST=m links cleanly. Without the export, modpost reports seq_buf_put...
```diff diff --git a/lib/seq_buf.c b/lib/seq_buf.c index f3f3436d60a9..b59488fa8135 100644 --- a/lib/seq_buf.c +++ b/lib/seq_buf.c @@ -298,6 +298,7 @@ int seq_buf_putmem_hex(struct seq_buf *s, const void *mem, } return 0; } +EXPORT_SYMBOL_GPL(seq_buf_putmem_hex); /** * seq_buf_path - copy a path into the sequ...
20e4b31f8e837d923eee91cd5458f823a11cca9a
Analyze and fix the following issue in the Linux kernel code: selftests/acct: add taskstats TGID retention test
Problem Details: Add a kselftest for the taskstats TGID aggregation fix. The test creates a worker thread, snapshots TGID taskstats while the worker is still alive, lets the worker exit, and then verifies that the TGID CPU total does not regress after the thread has been reaped. The pass/fail check intentionally keys...
```diff diff --git a/tools/testing/selftests/acct/.gitignore b/tools/testing/selftests/acct/.gitignore index 7e78aac19038..9e9c61c5bfd6 100644 --- a/tools/testing/selftests/acct/.gitignore +++ b/tools/testing/selftests/acct/.gitignore @@ -1,3 +1,4 @@ acct_syscall +taskstats_fill_stats_tgid config -process_log \ No ne...
b3e4fbb04220efc3bc022bcf31b5689d39c6b111
Analyze and fix the following issue in the Linux kernel code: taskstats: retain dead thread stats in TGID queries
Problem Details: Patch series "taskstats: fix TGID dead-thread stat retention", v3. This series fixes a taskstats TGID aggregation bug where fields added in the TGID query path were not preserved after thread exit, and adds a kselftest covering the regression. The first patch keeps the cached TGID aggregate used for ...
```diff diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 73bd6a6a7893..2cd0172d0516 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c @@ -210,13 +210,39 @@ static int fill_stats_for_pid(pid_t pid, struct taskstats *stats) return 0; } +static void tgid_stats_add_task(struct taskstats *stats, + s...
99df2a8eba347e901e5355ee66bdb2ade76ff847
Analyze and fix the following issue in the Linux kernel code: clang-format: fix formatting of guard() and scoped_guard() statements
Problem Details: Without this patch clang-format formats guard() and scoped_guard() statements as follows: guard(...)(...) { ... } With this patch clang-format formats guard() and scoped_guard() statements as follows: guard(...)(...) { ... } Link: https://lore.kernel.org/20260413182348.1865138-1-bvanassche...
```diff diff --git a/.clang-format b/.clang-format index 1cc151e2adcc..6a3de86ab27a 100644 --- a/.clang-format +++ b/.clang-format @@ -481,6 +481,7 @@ ForEachMacros: - 'genradix_for_each' - 'genradix_for_each_from' - 'genradix_for_each_reverse' + - 'guard' - 'hash_for_each' - 'hash_for_each_possible' ...
93c8c6ea90be9e9df8fe14048ad4e3caad0770a6
Analyze and fix the following issue in the Linux kernel code: ocfs2: use kzalloc for quota recovery bitmap allocation
Problem Details: ocfs2 quota recovery allocates a bitmap buffer with kmalloc and does not fully initialize it. This can lead to use of uninitialized bits during quota recovery from a corrupted filesystem image. Use kzalloc instead to ensure the bitmap is zero-initialized. Link: https://lore.kernel.org/20260418131048...
```diff diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c index 12cbb4fccda0..f55810c59b1b 100644 --- a/fs/ocfs2/quota_local.c +++ b/fs/ocfs2/quota_local.c @@ -302,7 +302,7 @@ static int ocfs2_add_recovery_chunk(struct super_block *sb, if (!rc) return -ENOMEM; rc->rc_chunk = chunk; - rc->rc_bitmap = k...
0e75190fe40093d85c0c698d9f8dca66df842605
Analyze and fix the following issue in the Linux kernel code: tools/accounting/getdelays: fix -Wformat-truncation warning in format_timespec
Problem Details: Reproduce with GCC 13.3.0: $ cd tools/accounting $ make This emits: getdelays.c: In function `format_timespec': getdelays.c:218:67: warning: `:' directive output may be truncated writing 1 byte into a region of size between 0 and 16 [-Wformat-truncation=] 218 | snprintf(buffer, sizeof(...
```diff diff --git a/tools/accounting/getdelays.c b/tools/accounting/getdelays.c index 368a622ca027..caa5fe9dd573 100644 --- a/tools/accounting/getdelays.c +++ b/tools/accounting/getdelays.c @@ -241,13 +241,7 @@ static const char *format_timespec(struct __kernel_timespec *ts) if (localtime_r(&time_sec, &tm_info) == N...
77d100d11c87e62010fe65a9a4d117ca0a05f8d0
Analyze and fix the following issue in the Linux kernel code: mm/kmemleak: dedupe verbose scan output by allocation backtrace
Problem Details: Patch series "mm/kmemleak: dedupe verbose scan output", v3. I am starting to run with kmemleak in verbose enabled in some "probe points" across the my employers fleet so that suspected leaks land in dmesg without needing a separate read of /sys/kernel/debug/kmemleak. The downside is that workloads wh...
```diff diff --git a/mm/kmemleak.c b/mm/kmemleak.c index 2eff0d6b622b..7c7ba17ce7af 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c @@ -92,6 +92,7 @@ #include <linux/nodemask.h> #include <linux/mm.h> #include <linux/workqueue.h> +#include <linux/xarray.h> #include <linux/crc32.h> #include <asm/sections.h> @@ -157...
66366d291f666ddeda5f8c84f253e308de3e6b55
Analyze and fix the following issue in the Linux kernel code: mm/swap: add cond_resched() in swap_reclaim_full_clusters to prevent softlockup
Problem Details: We hit a real softlockup in an internal stress test environment. The workload was LTP memory/swap stress on a large arm64 machine, with 320 CPUs, about 1TB memory and an 8.6GB swap device. The system was under heavy load and the swap device had a large number of full clusters. The softlockup was tri...
```diff diff --git a/mm/swapfile.c b/mm/swapfile.c index 9174f1eeffb0..74a1e324449d 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1054,6 +1054,7 @@ static void swap_reclaim_full_clusters(struct swap_info_struct *si, bool force) swap_cluster_unlock(ci); if (to_scan <= 0) break; + cond_resched(); } } `...
9d5685286aa8c5ef70d8e1a34cef5daf518ae237
Analyze and fix the following issue in the Linux kernel code: highmem-internal.h: fix typo in the comment for kunmap_atomic()
Problem Details: Replace `PREEMP_RT` with `PREEMPT_RT` in the header comment to match the correct kernel configuration name. Link: https://lore.kernel.org/20260505021125.1941691-1-zhouzhouyi@gmail.com Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com> Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signe...
```diff diff --git a/include/linux/highmem-internal.h b/include/linux/highmem-internal.h index 0574c21ca45d..bb71e7dba4f7 100644 --- a/include/linux/highmem-internal.h +++ b/include/linux/highmem-internal.h @@ -262,7 +262,7 @@ static inline bool is_kmap_addr(const void *x) * @__addr: Virtual address to be unmap...
ca9caa098f70e25c0edd812a640c6367e711c886
Analyze and fix the following issue in the Linux kernel code: selftests/cgroup: fix hardcoded page size in test_percpu_basic
Problem Details: Patch series "selftests/cgroup: Fix false positive failures in test_percpu_basic", v2. This patch series addresses two separate issues that cause false positive failures in the test_percpu_basic test within the cgroup kmem selftests. The first issue stems from a hardcoded assumption about the system ...
```diff diff --git a/tools/testing/selftests/cgroup/test_kmem.c b/tools/testing/selftests/cgroup/test_kmem.c index 12f59925500b..69cb1b50988c 100644 --- a/tools/testing/selftests/cgroup/test_kmem.c +++ b/tools/testing/selftests/cgroup/test_kmem.c @@ -24,7 +24,7 @@ * the maximum discrepancy between charge and vmstat e...
5ebb2064da361ca860c052bca9ae37962adef3f7
Analyze and fix the following issue in the Linux kernel code: mm: use zone lock guard in reserve_highatomic_pageblock()
Problem Details: Patch series "mm: use spinlock guards for zone lock", v3. This series uses spinlock guard for zone lock across several mm functions to replace explicit lock/unlock patterns with automatic scope-based cleanup. This simplifies the control flow by removing 'flags' variables, goto labels, and redundant u...
```diff diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d9c6313e69f3..36d37e9ff3b9 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3442,7 +3442,7 @@ static void reserve_highatomic_pageblock(struct page *page, int order, struct zone *zone) { int mt; - unsigned long max_managed, flags; + unsigned lo...
3b9e3cc0405b422db884054ea2417b7b85220c56
Analyze and fix the following issue in the Linux kernel code: mm/damon/core: introduce damon_ctx->paused
Problem Details: Patch series "mm/damon: let DAMON be paused and resumed", v2. DAMON utilizes a few mechanisms that enhance itself over time. Adaptive regions adjustment, goal-based DAMOS quota auto-tuning and monitoring intervals auto-tuning like self-training mechanisms are such examples. It also adds access frequ...
```diff diff --git a/include/linux/damon.h b/include/linux/damon.h index d3a231275c23..f2370a3a4a9a 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -801,6 +801,7 @@ struct damon_attrs { * @ops: Set of monitoring operations for given use cases. * @addr_unit: Scale factor for core to ops address con...
0b20c36c118d2122f57982c644e526c0fcd4a947
Analyze and fix the following issue in the Linux kernel code: mm/madvise: reject invalid process_madvise() advice for zero-length vectors
Problem Details: process_madvise() used to validate the advice while walking each imported iovec. If the vector has zero total length, vector_madvise() does not enter the loop and can return success without checking whether the advice value is valid. For a local mm, such as process_madvise(PIDFD_SELF, ...), the remot...
```diff diff --git a/mm/madvise.c b/mm/madvise.c index 69708e953cf5..cd9bb077072c 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -1834,50 +1834,29 @@ static void madvise_finish_tlb(struct madvise_behavior *madv_behavior) tlb_finish_mmu(madv_behavior->tlb); } -static bool is_valid_madvise(unsigned long start, siz...
de3c60e1c8314f3408a72836483772e17f279aca
Analyze and fix the following issue in the Linux kernel code: mm/damon: add synchronous commit for commit_inputs
Problem Details: Problem ======= Writing invalid parameters to sysfs followed by 'commit_inputs=Y' fails silently (no error returned to shell), because the validation happens asynchronously in the kdamond. Solution ======== To fix this, the commit_inputs_store() callback now uses damon_call() to synchronously commit p...
```diff diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c index 8494040b1ee4..7569e471160a 100644 --- a/mm/damon/lru_sort.c +++ b/mm/damon/lru_sort.c @@ -39,7 +39,6 @@ static bool enabled __read_mostly; * the re-reading, DAMON_LRU_SORT will be disabled. */ static bool commit_inputs __read_mostly; -module_para...
abdca14655fe4ec821791c031d5764fdd1e9484d
Analyze and fix the following issue in the Linux kernel code: Docs/admin-guide/mm/damon: fix 'parametrs' typo
Problem Details: Fix the misspelling of "parametrs" as "parameters" in reclaim.rst and lru_sort.rst. Link: https://lore.kernel.org/20260426231619.107231-3-sj@kernel.org Signed-off-by: Cheng-Han Wu <hank20010209@gmail.com> Signed-off-by: SeongJae Park <sj@kernel.org> Reviewed-by: SeongJae Park <sj@kernel.org> Cc: Asier...
```diff diff --git a/Documentation/admin-guide/mm/damon/lru_sort.rst b/Documentation/admin-guide/mm/damon/lru_sort.rst index 14cc6b2db897..25e2f042a383 100644 --- a/Documentation/admin-guide/mm/damon/lru_sort.rst +++ b/Documentation/admin-guide/mm/damon/lru_sort.rst @@ -75,7 +75,7 @@ Make DAMON_LRU_SORT reads the input...
1d258000b0f28ca34faa7ce699e873666724aaa3
Analyze and fix the following issue in the Linux kernel code: mm/damon/ops-common: optimize damon_hot_score() using ilog2()
Problem Details: Patch series "mm/damon: repost non-hotfix reviewed patches in damon/next tree", v2. The first patch from Liew Rui Yan add a minor performance optimization using ilog2() instead of inefficient manual implementation of the functionality. The second patch from Cheng-Han Wu fixes a minor typo: s/parametr...
```diff diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c index 8c6d613425c1..3a0ddc3ac719 100644 --- a/mm/damon/ops-common.c +++ b/mm/damon/ops-common.c @@ -117,9 +117,12 @@ int damon_hot_score(struct damon_ctx *c, struct damon_region *r, damon_max_nr_accesses(&c->attrs); age_in_sec = (unsigned long)r-...
cd681403a87085562499d60325b7b45d3be11217
Analyze and fix the following issue in the Linux kernel code: mm/mm_init: fix uninitialized struct pages for ZONE_DEVICE
Problem Details: If DAX memory is hotplugged into an unoccupied subsection of an early section, section_activate() reuses the unoptimized boot memmap. However, compound_nr_pages() still assumes that vmemmap optimization is in effect and initializes only the reduced number of struct pages. As a result, the remaining t...
```diff diff --git a/mm/mm_init.c b/mm/mm_init.c index cfc76953e249..bd466a3c10c8 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -1055,10 +1055,17 @@ static void __ref __init_zone_device_page(struct page *page, unsigned long pfn, * of how the sparse_vmemmap internals handle compound pages in the lack * of an altma...
94405c6136839f7c462249c8b4b957bcb9527a9d
Analyze and fix the following issue in the Linux kernel code: mm/mm_init: fix pageblock migratetype for ZONE_DEVICE compound pages
Problem Details: The memmap_init_zone_device() function only initializes the migratetype of the first pageblock of a compound page. If the compound page size exceeds pageblock_nr_pages (e.g., 1GB hugepages with 2MB pageblocks), subsequent pageblocks in the compound page remain uninitialized. Move the migratetype init...
```diff diff --git a/mm/mm_init.c b/mm/mm_init.c index f9f8e1af921c..cfc76953e249 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -674,6 +674,20 @@ static inline void fixup_hashdist(void) static inline void fixup_hashdist(void) {} #endif /* CONFIG_NUMA */ +#ifdef CONFIG_ZONE_DEVICE +static __meminit void pageblock_...
721a73e30c9e3e8fcffe1725bcede1bbd20b4918
Analyze and fix the following issue in the Linux kernel code: mm/sparse-vmemmap: fix DAX vmemmap accounting with optimization
Problem Details: When vmemmap optimization is enabled for DAX, the nr_memmap_pages counter in /proc/vmstat is incorrect. The current code always accounts for the full, non-optimized vmemmap size, but vmemmap optimization reduces the actual number of vmemmap pages by reusing tail pages. This causes the system to overc...
```diff diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c index eafb7c6eb71e..112ccf9c71ca 100644 --- a/mm/sparse-vmemmap.c +++ b/mm/sparse-vmemmap.c @@ -647,6 +647,31 @@ void offline_mem_sections(unsigned long start_pfn, unsigned long end_pfn) } } +static int __meminit section_nr_vmemmap_pages(unsigned long ...
2fac4afa0e2e68841334c78c1821e49f74fbc66a
Analyze and fix the following issue in the Linux kernel code: mm/memory_hotplug: fix incorrect altmap passing in error path
Problem Details: In create_altmaps_and_memory_blocks(), when arch_add_memory() succeeds with memmap_on_memory enabled, the vmemmap pages are allocated from params.altmap. If create_memory_block_devices() subsequently fails, the error path calls arch_remove_memory() with a NULL altmap instead of params.altmap. This is...
```diff diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 40c7915dabe0..cf4f77108c43 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1470,7 +1470,7 @@ static int create_altmaps_and_memory_blocks(int nid, struct memory_group *group, ret = create_memory_block_devices(cur_start, memblock_size,...
c373f7f98e6ad591c85d40548cf8b6443be69311
Analyze and fix the following issue in the Linux kernel code: mm/sparse-vmemmap: fix vmemmap accounting underflow
Problem Details: Patch series "mm: Fix vmemmap optimization accounting and initialization", v8. The series fixes several bugs in vmemmap optimization, mainly around incorrect page accounting and memmap initialization in DAX and memory hotplug paths. It also fixes pageblock migratetype initialization and struct page i...
```diff diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c index 43f82621dd92..60e55e78d7ff 100644 --- a/mm/sparse-vmemmap.c +++ b/mm/sparse-vmemmap.c @@ -651,7 +651,12 @@ static struct page * __meminit populate_section_memmap(unsigned long pfn, unsigned long nr_pages, int nid, struct vmem_altmap *altmap, str...
8aa442cfce79e2d69e72fc8e0c0864ac2971149d
Analyze and fix the following issue in the Linux kernel code: dax/kmem: account for partial discontiguous resource upon removal
Problem Details: When dev_dax_kmem_probe() partially succeeds (at least one range is mapped) but a subsequent range fails request_mem_region() or add_memory_driver_managed(), the probe silently continues, ultimately returning success, but with the corresponding range resource NULL'ed out. dev_dax_kmem_remove() iterate...
```diff diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c index 2cc8749bc871..a18e2b968e4d 100644 --- a/drivers/dax/kmem.c +++ b/drivers/dax/kmem.c @@ -227,6 +227,12 @@ static void dev_dax_kmem_remove(struct dev_dax *dev_dax) if (rc) continue; + /* range was never added during probe */ + if (!data->res[i]...
15807d0ddde37407af72859426b654f3d1972b00
Analyze and fix the following issue in the Linux kernel code: mm/hugetlb: fix hugetlb cgroup rsvd charge/uncharge mismatch
Problem Details: In alloc_hugetlb_folio(), a single h_cg pointer is used for both the rsvd and non-rsvd hugetlb cgroup charges. When map_chg is set, hugetlb_cgroup_charge_cgroup_rsvd() stores the charged cgroup in h_cg, but the immediately following hugetlb_cgroup_charge_cgroup() overwrites h_cg with the non-rsvd cgro...
```diff diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 4b80b167cc9c..bcc657abbe35 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2859,6 +2859,7 @@ struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, map_chg_state map_chg; int ret, idx; struct hugetlb_cgroup *h_cg = NULL; + struct hugetlb_cgroup *h_cg_...
94e0bcde055ee1bd758218ec3a4ff098874123ac
Analyze and fix the following issue in the Linux kernel code: mm, page_alloc: reintroduce page allocation stall warning
Problem Details: Previously, we had warnings when a single page allocation took longer than reasonably expected. This was introduced in commit 63f53dea0c98 ("mm: warn about allocations which stall for too long"). The warning was subsequently reverted in commit 400e22499dd9 ("mm: don't warn about allocations which sta...
```diff diff --git a/mm/page_alloc.c b/mm/page_alloc.c index baf41005f90e..d9c6313e69f3 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -285,6 +285,14 @@ EXPORT_SYMBOL(nr_node_ids); EXPORT_SYMBOL(nr_online_nodes); #endif +/* + * When page allocations stall for longer than a threshold, + * ALLOC_STALL_WARN_MSE...
781b0e74748f14b0e732eb736370bbbed181fe4d
Analyze and fix the following issue in the Linux kernel code: mm/page_owner: fix %pGp format specifier argument type
Problem Details: The %pGp format specifier expects an argument of type 'unsigned long *', but page->flags is now of type 'memdesc_flags_t' (a struct containing an unsigned long member 'f') after the introduction of memdesc_flags_t. Fix the type mismatch by passing &page->flags.f instead of &page->flags, which matches ...
```diff diff --git a/mm/page_owner.c b/mm/page_owner.c index 8178e0be557f..2dddcb6510aa 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -573,7 +573,7 @@ print_page_owner(char __user *buf, size_t count, unsigned long pfn, migratetype_names[page_mt], pfn >> pageblock_order, migratetype_names[pageblock_m...
d86c9e971af2315119a78c564a802fafcebf1b6b
Analyze and fix the following issue in the Linux kernel code: mm: fix mmap errno value when MAP_DROPPABLE is not supported
Problem Details: Patch series "fix MAP_DROPPABLE not supported errno", v4. Mark Brown reported seeing a regression in -next on 32 bit arm with the mlock selftests. Before exiting and marking the tests failed, the following message was logged after an attempt to create a MAP_DROPPABLE mapping: Bail out! mmap error: U...
```diff diff --git a/mm/mmap.c b/mm/mmap.c index 5754d1c36462..2311ae7c2ff4 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -504,7 +504,7 @@ unsigned long do_mmap(struct file *file, unsigned long addr, break; case MAP_DROPPABLE: if (VM_DROPPABLE == VM_NONE) - return -ENOTSUPP; + return -EOPNOTSUPP; /* ...
eb8fc9d285f95cd14697ef3df2b0c2e41c76cbdd
Analyze and fix the following issue in the Linux kernel code: mm/vmscan: fix typos in comments
Problem Details: Fix three typos in comments: - Line 112: "zome_reclaim_mode" -> "zone_reclaim_mode" - Line 6208: "prioities" -> "priorities" - Line 7067: "that that high" -> "that the high" (duplicated word) Link: https://lore.kernel.org/20260416062302.727468-1-gxxa03070307@gmail.com Signed-off-by: Xiang Gao <gaoxia...
```diff diff --git a/mm/vmscan.c b/mm/vmscan.c index b2d89ed69d22..a9fd43b23a58 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -109,7 +109,7 @@ struct scan_control { /* zone_reclaim_mode */ unsigned int may_unmap:1; - /* zome_reclaim_mode, boost reclaim, cgroup restrictions */ + /* zone_reclaim_mode, boost reclaim...
883015a9c328eaeac48395db36f9e5f864f6473d
Analyze and fix the following issue in the Linux kernel code: selftest/cgroup: fix zswap attempt_writeback() on 64K pagesize system
Problem Details: In attempt_writeback(), a memsize of 4M only covers 64 pages on 64K page size systems. When memory.reclaim is called, the kernel prefers reclaiming clean file pages (binary, libc, linker, etc.) over swapping anonymous pages. With only 64 pages of anonymous memory, the reclaim target can be largely or...
```diff diff --git a/tools/testing/selftests/cgroup/test_zswap.c b/tools/testing/selftests/cgroup/test_zswap.c index 8f0478923bd0..5fe0cffb5575 100644 --- a/tools/testing/selftests/cgroup/test_zswap.c +++ b/tools/testing/selftests/cgroup/test_zswap.c @@ -268,14 +268,14 @@ out: This will move it into zswap. * 3...
a19b474927519c8822193f8bdc010641ec6ba404
Analyze and fix the following issue in the Linux kernel code: selftest/cgroup: fix zswap test_no_invasive_cgroup_shrink on large pagesize system
Problem Details: test_no_invasive_cgroup_shrink sets up two cgroups: wb_group, which is expected to trigger zswap writeback, and a control group (renamed to zw_group), which should only have pages sitting in zswap without any writeback. There are two problems with the current test: 1) The data patterns are reversed. ...
```diff diff --git a/tools/testing/selftests/cgroup/test_zswap.c b/tools/testing/selftests/cgroup/test_zswap.c index 23ff11390a33..8f0478923bd0 100644 --- a/tools/testing/selftests/cgroup/test_zswap.c +++ b/tools/testing/selftests/cgroup/test_zswap.c @@ -11,6 +11,7 @@ #include <string.h> #include <sys/wait.h> #inclu...
9f40c3cdf0fa3011c3a15f8acc0b9ffb3ed11171
Analyze and fix the following issue in the Linux kernel code: selftests/cgroup: skip test_zswap if zswap is globally disabled
Problem Details: Patch series "selftests/cgroup: improve zswap tests robustness and support large page sizes", v7. This patchset aims to fix various spurious failures and improve the overall robustness of the cgroup zswap selftests. The primary motivation is to make the tests compatible with architectures that use no...
```diff diff --git a/tools/testing/selftests/cgroup/test_zswap.c b/tools/testing/selftests/cgroup/test_zswap.c index a7bdcdd09d62..a94238a2e048 100644 --- a/tools/testing/selftests/cgroup/test_zswap.c +++ b/tools/testing/selftests/cgroup/test_zswap.c @@ -15,6 +15,9 @@ #include "kselftest.h" #include "cgroup_util.h" ...
c7ec7d5f6b3d1fc36d04baaabd8d2756a5e937b1
Analyze and fix the following issue in the Linux kernel code: mm/damon/core: handle <min_region_sz remaining quota as empty
Problem Details: Patch series "mm/damon: introduce DAMOS failed region quota charge ratio". Let users set different DAMOS quota charge ratios for DAMOS action failed regions, for deterministic and consistent DAMOS action progress. Common Reports: Unexpectedly Slow DAMOS ======================================= One co...
```diff diff --git a/mm/damon/core.c b/mm/damon/core.c index e4229294353e..df51a5661d46 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -2065,6 +2065,20 @@ static void damos_walk_cancel(struct damon_ctx *ctx) mutex_unlock(&ctx->walk_control_lock); } +static bool damos_quota_is_full(struct damos_quota *quota,...
5a2d162e22bf33eb89d53e802d0fc1ec422e19b6
Analyze and fix the following issue in the Linux kernel code: mm/damon/core: make charge_addr_from aware of end-address exclusivity
Problem Details: DAMON region end address is exclusive one, but charge_addr_from is assigned assuming the end address is inclusive. As a result, DAMOS action to next up to min_region_sz memory can be skipped. This is quite negligible user impact. But, the bug is a bug that can be very simply fixed. Fix the wrong as...
```diff diff --git a/mm/damon/core.c b/mm/damon/core.c index 3dbbbfdeff71..901ffdaefb7f 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -2106,7 +2106,7 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t, if (damos_quota_is_set(quota) && quota->charged_sz >= quota->esz) { quo...
60ced5818f64ac356620d1ad3e0d473c457dbf5b
Analyze and fix the following issue in the Linux kernel code: vmalloc: optimize vfree with free_pages_bulk()
Problem Details: Whenever vmalloc allocates high order pages (e.g. for a huge mapping) it must immediately split_page() to order-0 so that it remains compatible with users that want to access the underlying struct page. Commit a06157804399 ("mm/vmalloc: request large order pages from buddy allocator") recently made i...
```diff diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 87259e309dee..cdf95a9f0b87 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -239,6 +239,8 @@ unsigned long alloc_pages_bulk_noprof(gfp_t gfp, int preferred_nid, struct page **page_array); #define __alloc_pages_bulk(...) alloc_hook...
4aa4abf1f14bd6d0748b7d35a803cc2376a8e20b
Analyze and fix the following issue in the Linux kernel code: mm/page_alloc: optimize free_contig_range()
Problem Details: Patch series "mm: Free contiguous order-0 pages efficiently", v6. A recent change to vmalloc caused some performance benchmark regressions (see [1]). I'm attempting to fix that (and at the same time significantly improve beyond the baseline) by freeing a contiguous set of order-0 pages as a batch. A...
```diff diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 51ef13ed756e..87259e309dee 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -467,6 +467,8 @@ void free_contig_frozen_range(unsigned long pfn, unsigned long nr_pages); void free_contig_range(unsigned long pfn, unsigned long nr_pages); #e...
085a7acf732f6040fd36b002e6a49c90b76db41c
Analyze and fix the following issue in the Linux kernel code: mm/huge_memory: fix outdated comment about freeing subpages in __folio_split
Problem Details: The comment appears to be outdated. add_to_swap() no longer exists, and the explanation of why we need to call put_page() after splitting could be made more general. Link: https://lore.kernel.org/20260423034917.8234-1-baohua@kernel.org Signed-off-by: Barry Song (Xiaomi) <baohua@kernel.org> Acked-by: ...
```diff diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 970e077019b7..4586f3ccb133 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -4190,11 +4190,10 @@ fail: folio_unlock(new_folio); /* - * Subpages may be freed if there wasn't any mapping - * like if add_to_swap() is running on a lru page th...
eb92d97f7e6a325607b9c3981131067c0469bfcf
Analyze and fix the following issue in the Linux kernel code: Revert "tmpfs: don't enable large folios if not supported"
Problem Details: This reverts commit 5a90c155defa684f3a21f68c3f8e40c056e6114c. Currently, when shmem mounts are initialized, they only use 'sbinfo->huge' to determine whether the shmem mount supports large folios. However, for anonymous shmem, whether it supports large folios can be dynamically configured via sysfs i...
```diff diff --git a/mm/shmem.c b/mm/shmem.c index 3b5dc21b323c..bab3529af23c 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3101,10 +3101,7 @@ static struct inode *__shmem_get_inode(struct mnt_idmap *idmap, cache_no_acl(inode); if (sbinfo->noswap) mapping_set_unevictable(inode->i_mapping); - - /* Don't consider '...
1d224e7cbeac00292f15564310cdfa3976785b0e
Analyze and fix the following issue in the Linux kernel code: selftests/mm: respect build verbosity settings for 32/64-bit targets
Problem Details: Patch series "selftests/mm: clean up build output and verbosity", v3. Currently, the build process for the mm selftests is unnecessarily noisy. First, it leaks raw compiler errors during the liburing feature probe if the headers are missing, which is confusing since the build system already handles t...
```diff diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index cd24596cdd27..6195770eba6e 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -216,7 +216,8 @@ ifeq ($(CAN_BUILD_I386),1) $(BINARIES_32): CFLAGS += -m32 -mxsave $(BINARIES_32...
00739e4dd46dde2b39dd9dd19a27e3c8af4ca0d0
Analyze and fix the following issue in the Linux kernel code: mm/cma: fix reserved page leak on activation failure
Problem Details: If cma_activate_area() fails after allocating only part of the range bitmaps, the cleanup path still has to release the reserved pages when CMA_RESERVE_PAGES_ON_ERROR is clear. That is still worth doing even in this __init path. A bitmap_zalloc() failure does not necessarily mean the system cannot ma...
```diff diff --git a/mm/cma.c b/mm/cma.c index c7ca567f4c5c..a13ce4999b39 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -188,10 +188,13 @@ cleanup: /* Expose all pages to the buddy, they are useless for CMA. */ if (!test_bit(CMA_RESERVE_PAGES_ON_ERROR, &cma->flags)) { - for (r = 0; r < allocrange; r++) { + for (r = 0...
3c2d42b8ee345b17a4ba56b0f6492d1ff4c1178e
Analyze and fix the following issue in the Linux kernel code: mm/memory-failure: fix hugetlb_lock AA deadlock in get_huge_page_for_hwpoison
Problem Details: Two concurrent madvise(MADV_HWPOISON) calls on the same hugetlb page can trigger a recursive spinlock self-deadlock (AA deadlock) on hugetlb_lock when racing with a concurrent unmap: thread#0 thread#1 -------- -------- madvise(folio, MADV...
```diff diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 5957bc25efa8..2abaf99321e9 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -153,8 +153,6 @@ long hugetlb_unreserve_pages(struct inode *inode, long start, long end, long freed); bool folio_isolate_hugetlb(struct fo...
40c81856e622a9dc59294a90d169ac07ea25b0b0
Analyze and fix the following issue in the Linux kernel code: mm/hugetlb: restore reservation on error in hugetlb folio copy paths
Problem Details: Two sites in mm/hugetlb.c allocate a hugetlb folio via alloc_hugetlb_folio() (consuming a VMA reservation) and then call copy_user_large_folio(), which became int-returning in commit 1cb9dc4b475c ("mm: hwpoison: support recovery from HugePage copy-on-write faults") and can now fail (e.g. -EHWPOISON on...
```diff diff --git a/mm/hugetlb.c b/mm/hugetlb.c index ece86d9339ce..1b1d4f87a3a4 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -4977,6 +4977,7 @@ again: addr, dst_vma); folio_put(pte_folio); if (ret) { + restore_reserve_on_error(h, dst_vma, addr, new_folio); folio_put(new_folio); ...
c0ca59beb5252ea2bd4fdaef009d003dedc2030e
Analyze and fix the following issue in the Linux kernel code: mm/cma_debug: fix invalid accesses for inactive CMA areas
Problem Details: cma_activate_area() can fail after allocating range bitmaps. Its cleanup path frees those bitmaps, but only clears cma->count and cma->available_count. It leaves cma->nranges and each range's count in place, so cma_debugfs_init() can still register debugfs files for an area that never activated succe...
```diff diff --git a/mm/cma_debug.c b/mm/cma_debug.c index 5ae38f5abbcc..523ba4a0f9f7 100644 --- a/mm/cma_debug.c +++ b/mm/cma_debug.c @@ -205,7 +205,8 @@ static int __init cma_debugfs_init(void) cma_debugfs_root = debugfs_create_dir("cma", NULL); for (i = 0; i < cma_area_count; i++) - cma_debugfs_add_one(&cma_a...
c0cafe24d3f6534294c4b2bc2d47734ff7cbd313
Analyze and fix the following issue in the Linux kernel code: memcg: use round-robin victim selection in refill_stock
Problem Details: Harry Yoo reported that get_random_u32_below() is not safe to call in the nmi context and memcg charge draining can happen in nmi context. More specifically get_random_u32_below() is neither reentrant- nor NMI-safe: it acquires a per-cpu local_lock via local_lock_irqsave() on the batched_entropy_u32 s...
```diff diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 177732fef010..1a4fd2504bcd 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -2011,6 +2011,7 @@ struct memcg_stock_pcp { struct work_struct work; unsigned long flags; + uint8_t drain_idx; }; static DEFINE_PER_CPU_ALIGNED(struct memcg_stock_pcp, ...
b4aea43cd37afad714b5684fe9fdfcb0e78dba26
Analyze and fix the following issue in the Linux kernel code: mm/hugetlb: avoid false positive lockdep assertion
Problem Details: Commit 081056dc00a2 ("mm/hugetlb: unshare page tables during VMA split, not before") changed the locking model around hugetlbfs PMD unsharing on VMA split, but did not update the function which asserts the locks, hugetlb_vma_assert_locked(). This function asserts that either the hugetlb VMA lock is he...
```diff diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 4b80b167cc9c..ece86d9339ce 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -118,6 +118,9 @@ static int hugetlb_acct_memory(struct hstate *h, long delta); static void hugetlb_vma_lock_free(struct vm_area_struct *vma); static void hugetlb_vma_lock_alloc(struct vm_a...
9b435d23f51e55b62dda3a345a9f8931248ca514
Analyze and fix the following issue in the Linux kernel code: bpf: Fix race between bpf_map_new_fd() and close_fd()
Problem Details: Because there is time gap between bpf_map_new_fd() and close_fd(), a concurrent thread is able to close the new fd and opens a new, unrelated file with the exact same fd number. Thereafter, this close_fd() might inadvertently close the unrelated file. To avoid such regression, do finalize log before s...
```diff diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 8d4ea700aac6..9e91fb2fb492 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -1359,7 +1359,8 @@ free_map_tab: #define BPF_MAP_CREATE_LAST_FIELD excl_prog_hash_size /* called via syscall */ -static int __map_create(union bpf_attr *a...
6b4f48728faa8bb514368f7eacda05565dea8696
Analyze and fix the following issue in the Linux kernel code: net/9p: fix infinite loop in p9_client_rpc on fatal signal
Problem Details: When p9_client_rpc() is called with type P9_TFLUSH and the transport has no peer (e.g. fd transport backed by pipes with no 9p server), a fatal signal causes an infinite loop: again: err = io_wait_event_killable(req->wq, ...) /* SIGKILL wakes the task, returns -ERESTARTSYS */ if (err == -ERESTAR...
```diff diff --git a/net/9p/client.c b/net/9p/client.c index b7d947910037..69d3efd340c0 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -600,6 +600,8 @@ again: if (err == -ERESTARTSYS && c->status == Connected && type == P9_TFLUSH) { + if (fatal_signal_pending(current)) + goto recalc_sigpending; s...
38ba49580e875786b85bad1d3895aa9b9f4b3431
Analyze and fix the following issue in the Linux kernel code: docs/filesystems/9p: fix broken external links
Problem Details: The xcpu.org links for xcpu-talk, kvmfs, and cellfs-talk are dead with no archived snapshots available on the Wayback Machine, so remove them. The PROSE I/O link redirects to a dead server; replace it with an archived version from web.archive.org. Signed-off-by: Aayush Patil <aayushpatilsch@gmail.com>...
```diff diff --git a/Documentation/filesystems/9p.rst b/Documentation/filesystems/9p.rst index be3504ca034a..65809a1dad21 100644 --- a/Documentation/filesystems/9p.rst +++ b/Documentation/filesystems/9p.rst @@ -23,13 +23,10 @@ the 9p client is available in the form of a USENIX paper: Other applications are described i...
87a451161f36a34307ca09aaa66f233d68642b5f
Analyze and fix the following issue in the Linux kernel code: x86/cpu: Fix a F00F bug warning and clean up surrounding code
Problem Details: On x86 SMP systems with the F00F bug present, do_clear_cpu_cap() rightfully warns that the code clears the X86_BUG_F00F flag after alternatives have been patched. X86_BUG_F00F is first cleared in intel_workarounds() and then set for the affected models. This sequence works fine on the BSP but on AP br...
```diff diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 3ddc1d33399b..90680f978d43 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h @@ -125,7 +125,6 @@ t_no: #define cpu_has_bug(c, bit) cpu_has(c, (bit)) #define set_cpu_bug(c, bit) set...
0c766f0f08ea681396814fd82eddd299da188625
Analyze and fix the following issue in the Linux kernel code: spmi: clean up kernel-doc in spmi.h
Problem Details: Fix all kernel-doc warnings in spmi.h: Warning: include/linux/spmi.h:114 function parameter 'ctrl' not described in 'spmi_controller_put' Warning: include/linux/spmi.h:144 struct member 'shutdown' not described in 'spmi_driver' Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Step...
```diff diff --git a/include/linux/spmi.h b/include/linux/spmi.h index 28e8c8bd3944..671ce1b3ee8e 100644 --- a/include/linux/spmi.h +++ b/include/linux/spmi.h @@ -109,7 +109,7 @@ struct spmi_controller *spmi_controller_alloc(struct device *parent, /** * spmi_controller_put() - decrement controller refcount - * @ct...
422b5233b607476ac7176bfa2a101b9a103d7653
Analyze and fix the following issue in the Linux kernel code: net: pcs: pcs-mtk-lynxi: fix bpi-r3 serdes configuration
Problem Details: Commit 8871389da151 introduces common pcs dts properties which writes rx=normal,tx=normal polarity to register SGMSYS_QPHY_WRAP_CTRL of switch. This is initialized with tx-bit set and so change inverts polarity compared to before. It looks like mt7531 has tx polarity inverted in hardware and set tx-bi...
```diff diff --git a/drivers/net/pcs/pcs-mtk-lynxi.c b/drivers/net/pcs/pcs-mtk-lynxi.c index c12f8087af9b..a753bd88cbc2 100644 --- a/drivers/net/pcs/pcs-mtk-lynxi.c +++ b/drivers/net/pcs/pcs-mtk-lynxi.c @@ -129,6 +129,9 @@ static int mtk_pcs_config_polarity(struct mtk_pcs_lynxi *mpcs, unsigned int val = 0; int ret;...
3065170bfc7f256f9d1339062dae331f731c6763
Analyze and fix the following issue in the Linux kernel code: crypto: api - Remove per-tfm refcount
Problem Details: This reverts commit ae131f4970f0 ("crypto: api - Add crypto_tfm_get"). The refcount in struct crypto_tfm was added solely to support crypto_clone_tfm(). Before then it was a simple non-refcounted object. Since crypto_clone_tfm() has been removed, remove the refcount as well. Note that this eliminat...
```diff diff --git a/crypto/api.c b/crypto/api.c index d019d1979857..be9ee104ffc2 100644 --- a/crypto/api.c +++ b/crypto/api.c @@ -418,7 +418,6 @@ struct crypto_tfm *__crypto_alloc_tfmgfp(struct crypto_alg *alg, u32 type, goto out_err; tfm->__crt_alg = alg; - refcount_set(&tfm->refcnt, 1); if (!tfm->exit && ...
d8143c9e988be01c9471f1cf0551208992d49918
Analyze and fix the following issue in the Linux kernel code: gpu: nova-core: unregister sysmem flush page from Drop
Problem Details: Now that SysmemFlush can borrow the Bar via HRT lifetime, store a &'bound Bar0 reference and implement Drop to automatically unregister the sysmem flush page. This removes the need for manual unregister() calls and the Gpu::unbind() method. Reported-by: Eliot Courtney <ecourtney@nvidia.com> Closes: ht...
```diff diff --git a/drivers/gpu/nova-core/driver.rs b/drivers/gpu/nova-core/driver.rs index d4cf4379ee87..cff5034c2dcd 100644 --- a/drivers/gpu/nova-core/driver.rs +++ b/drivers/gpu/nova-core/driver.rs @@ -113,8 +113,4 @@ impl pci::Driver for NovaCoreDriver { })) }) } - - fn unbind<'bound...
f14fe6395a8b3d961a61e138ad7b36ba3626dd4e
Analyze and fix the following issue in the Linux kernel code: sctp: fix race between sctp_wait_for_connect and peeloff
Problem Details: sctp_wait_for_connect() drops and re-acquires the socket lock while waiting for the association to reach ESTABLISHED state. During this window, another thread can peeloff the association to a new socket via getsockopt(SCTP_SOCKOPT_PEELOFF), changing asoc->base.sk. After re-acquiring the old socket lock...
```diff diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 1d2568bb6bc2..66e12fb0c646 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -9403,6 +9403,8 @@ static int sctp_wait_for_connect(struct sctp_association *asoc, long *timeo_p) release_sock(sk); current_timeo = schedule_timeout(current_timeo);...
5b05aa36ee24297d7296ca58dfd8c448d0e4cda3
Analyze and fix the following issue in the Linux kernel code: net: mana: Skip redundant detach on already-detached port
Problem Details: When mana_per_port_queue_reset_work_handler() runs after a previous detach succeeded but attach failed, the port is left in a detached state with apc->tx_qp and apc->rxqs already freed. Calling mana_detach() again unconditionally leads to NULL pointer dereferences during queue teardown. Add an early e...
```diff diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c index 9e7e4bf526bf..c9b1df1ed109 100644 --- a/drivers/net/ethernet/microsoft/mana/mana_en.c +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c @@ -3350,6 +3350,12 @@ int mana_detach(struct net_device *nde...
17bfe0a8c014ee1d542ad352cd6a0a505361664a
Analyze and fix the following issue in the Linux kernel code: net: mana: Add NULL guards in teardown path to prevent panic on attach failure
Problem Details: When queue allocation fails partway through, the error cleanup frees and NULLs apc->tx_qp and apc->rxqs. Multiple teardown paths such as mana_remove(), mana_change_mtu() recovery, and internal error handling in mana_alloc_queues() can subsequently call into functions that dereference these pointers wit...
```diff diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c index 9afc786b297a..9e7e4bf526bf 100644 --- a/drivers/net/ethernet/microsoft/mana/mana_en.c +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c @@ -1727,6 +1727,9 @@ static void mana_fence_rqs(struct mana_...
016267b521b18529c977c9eca9597a1669c3d73c
Analyze and fix the following issue in the Linux kernel code: rust: devres: add 'static bound to Devres<T>
Problem Details: Devres::new() registers a callback with the C devres subsystem via devres_node_add(). If the Devres is leaked (e.g. via core::mem::forget(), which is safe), its Drop impl never runs, and the devres release callback will revoke the inner Revocable on device unbind, which drops T in place. If T contains ...
```diff diff --git a/rust/kernel/devres.rs b/rust/kernel/devres.rs index 82cbd8b969fb..11ce500e9b76 100644 --- a/rust/kernel/devres.rs +++ b/rust/kernel/devres.rs @@ -122,7 +122,7 @@ struct Inner<T> { /// # Ok(()) /// # } /// ``` -pub struct Devres<T: Send> { +pub struct Devres<T: Send + 'static> { dev: ARef<De...
f0fbedccae9e16624977cca02216ab2399f5a3ab
Analyze and fix the following issue in the Linux kernel code: arm64: tegra: Add #{address,size}-cells to Chromium-based /firmware
Problem Details: Chromium/Depthcharge bootloaders may dynamically add a few device nodes to a system's DTB under a /firmware node. A typical DT looks something like the following: / { firmware { ranges; coreboot { compatible = "coreboot"; ...
```diff diff --git a/arch/arm64/boot/dts/nvidia/tegra132-norrin.dts b/arch/arm64/boot/dts/nvidia/tegra132-norrin.dts index 683ac124523b..1f5222d43e62 100644 --- a/arch/arm64/boot/dts/nvidia/tegra132-norrin.dts +++ b/arch/arm64/boot/dts/nvidia/tegra132-norrin.dts @@ -18,6 +18,11 @@ stdout-path = "serial0:115200n8"; ...