id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
46725a0056c884cf58a6897f222892807327d82d
Analyze and fix the following issue in the Linux kernel code: fuse-uring: fix data races on ring->ready
Problem Details: On weakly-ordered architectures, the store to fiq->ops can be reordered past the store to ring->ready, allowing a CPU that sees ring->ready == true via fuse_uring_ready() to dispatch requests through a stale fiq->ops pointer. Upgrade the store to smp_store_release() and the load in fuse_uring_ready() t...
```diff diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index c79652a0e337..33b9fcee4fc3 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -988,12 +988,12 @@ static void fuse_uring_do_register(struct fuse_ring_ent *ent, fuse_uring_ent_avail(ent, queue); spin_unlock(&queue->lock); - if (!ring->r...
3a0a8bc51a13951c5141262bf770eeea3e0b6228
Analyze and fix the following issue in the Linux kernel code: fuse-uring: fix EFAULT clobber in fuse_uring_commit
Problem Details: copy_from_user() returns the number of bytes not copied as an unsigned residual on failure (1..sizeof(struct fuse_out_header)). fuse_uring_commit stores that residual in ssize_t err, sets req->out.h.error to -EFAULT, then jumps to out: with err still holding the positive residual. err = copy_from_...
```diff diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 7b9822e8837b..c79652a0e337 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -813,14 +813,11 @@ static void fuse_uring_commit(struct fuse_ring_ent *ent, struct fuse_req *req, { struct fuse_ring *ring = ent->queue->ring; struct fuse_co...
4dd6f6d3085a84e74b0a1efec3a05ed0b5125dce
Analyze and fix the following issue in the Linux kernel code: fuse: back uncached readdir buffers with pages
Problem Details: Commit dabb90391028 ("fuse: increase readdir buffer size") changed fuse_readdir_uncached() to size its temporary buffer from ctx->count. This is useful for overlayfs and other in-kernel callers that use INT_MAX to indicate an unlimited directory read. The larger buffer is currently supplied as a kvec ...
```diff diff --git a/fs/fuse/readdir.c b/fs/fuse/readdir.c index db5ae8ec1030..c38139225a2e 100644 --- a/fs/fuse/readdir.c +++ b/fs/fuse/readdir.c @@ -12,6 +12,7 @@ #include <linux/posix_acl.h> #include <linux/pagemap.h> #include <linux/highmem.h> +#include <linux/vmalloc.h> static bool fuse_use_readdirplus(struc...
06b41351779e9289e8785694ade9042ae85e41ea
Analyze and fix the following issue in the Linux kernel code: virtiofs: fix UAF on submount umount
Problem Details: iput() called from fuse_release_end() can Oops if the super block has already been destroyed. Normally this is prevented by waiting for num_waiting to go down to zero before commencing with super block shutdown. This only works, however, for the last submount instance, as the wait counter is per conn...
```diff diff --git a/fs/fuse/file.c b/fs/fuse/file.c index c59452d60b8d..9a0f5a8661da 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -380,8 +380,14 @@ void fuse_file_release(struct inode *inode, struct fuse_file *ff, * aio and closes the fd before the aio completes. Since aio takes its * own ref to the file...
75a4888b7029a1f98613aef91f517b2ee1f03d43
Analyze and fix the following issue in the Linux kernel code: perf maps: Add maps__mutate_mapping
Problem Details: During kernel ELF symbol parsing (dso__process_kernel_symbol), proc kallsyms image loading (dso__load_kernel_sym, dso__load_guest_kernel_sym), and dynamic kernel memory map alignment updates (machine__update_kernel_mmap), the loader directly modifies live virtual address boundary keys fields on map obj...
```diff diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index da1ad58758af..1ea06fde14e0 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -1539,22 +1539,30 @@ static void machine__set_kernel_mmap(struct machine *machine, map__set_end(machine->vmlinux_map, ~0ULL); } -sta...
574d3961d37ed25cac4fe3c5d497827d0384a0fd
Analyze and fix the following issue in the Linux kernel code: mm/slab: add alloc_flags to slab_alloc_context
Problem Details: Add alloc_flags as a new field to the slab_alloc_context helper struct, so we can pass it to more functions in the slab implementation without adding another function parameter. Start checking them via alloc_flags_allow_spinning() in alloc_single_from_new_slab() (where we can drop the allow_spin param...
```diff diff --git a/mm/slub.c b/mm/slub.c index 6f6c15d796e1..3a34907b881b 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -217,6 +217,7 @@ static DEFINE_STATIC_KEY_FALSE(strict_numa); struct slab_alloc_context { unsigned long caller_addr; size_t orig_size; + unsigned int alloc_flags; }; /* Structure holding parame...
3a1230e7b043c62737b05a3e9275ca83a43ad20a
Analyze and fix the following issue in the Linux kernel code: exfat: bound uniname advance in exfat_find_dir_entry()
Problem Details: In exfat_find_dir_entry(), each TYPE_EXTEND (file name) entry advances the output pointer by a fixed amount while the loop guard only tracks the accumulated name length: if (++order == 2) uniname = p_uniname->name; else uniname += EXFAT_FILE_NAME_LEN; len = exfat_extract_uni_name(ep, entry_unin...
```diff diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index 5a85a8ec0cc0..4fd4ec52b8c0 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -1069,6 +1069,7 @@ rewind: if (entry_type == TYPE_EXTEND) { unsigned short entry_uniname[16], unichar; + unsigned int offset; if (step != DIRENT_STEP_NAME || ...
03a43677ca91e3997355a13b1da6e47329b025e1
Analyze and fix the following issue in the Linux kernel code: exfat: add swap_activate support
Problem Details: Commit 07d67f3e9083 ("exfat: add iomap buffered I/O support") converted exfat buffered I/O to iomap, but did not add a .swap_activate handler to the address_space_operations. swapon(2) on an exfat swapfile then fails with EINVAL, which causes LTP swap tests to fail. Add exfat_iomap_swap_activate() an...
```diff diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c index 8e8d94319c3c..89826aea5e1e 100644 --- a/fs/exfat/inode.c +++ b/fs/exfat/inode.c @@ -309,6 +309,7 @@ static const struct address_space_operations exfat_aops = { .error_remove_folio = generic_error_remove_folio, .release_folio = iomap_release_folio, .i...
942296784b2a9439651750c42f540bf2579b330f
Analyze and fix the following issue in the Linux kernel code: exfat: preserve benign secondary entries during rename and move
Problem Details: Commit 8258ef28001a ("exfat: handle unreconized benign secondary entries") added cluster freeing for benign secondary entries inside exfat_remove_entries(). However, exfat_remove_entries() is also called from the rename and move paths (exfat_rename_file and exfat_move_file), where the old entry set is...
```diff diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index 8b8f6bc0c233..5a85a8ec0cc0 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -470,32 +470,70 @@ static void exfat_free_benign_secondary_clusters(struct inode *inode, exfat_free_cluster(inode, &dir); } +/* + * exfat_init_ext_entry - initialize extension e...
f0d1b2e1e02c11e29c953f22a485449e3da2a575
Analyze and fix the following issue in the Linux kernel code: exfat: fix implicit declaration of brelse()
Problem Details: exfat_cluster_walk() calls brelse(bh) without including the header that declares the function, causing the following build error: fs/exfat/exfat_fs.h:542:9: error: implicit declaration of function ‘brelse’ [-Werror=implicit-function-declaration] Fix this by adding the missing buffer_head.h in exf...
```diff diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h index e60b955da0d0..86ae468c965b 100644 --- a/fs/exfat/exfat_fs.h +++ b/fs/exfat/exfat_fs.h @@ -12,6 +12,7 @@ #include <linux/blkdev.h> #include <linux/backing-dev.h> #include <uapi/linux/exfat.h> +#include <linux/buffer_head.h> #define EXFAT_ROOT_INO...
f07db38084dc45162d5fe2871ed72674ddc0f9ae
Analyze and fix the following issue in the Linux kernel code: exfat: replace unsafe macros with static inline functions
Problem Details: The current exFAT driver relies on various macros for unit conversions between clusters, blocks, sectors, and directory entries. These macros are structurally unsafe as they lack type enforcement and are prone to potential integer overflows during bit-shift operations, especially on 64-bit architecture...
```diff diff --git a/fs/exfat/balloc.c b/fs/exfat/balloc.c index 625f2f14d4fe..e66ebf899778 100644 --- a/fs/exfat/balloc.c +++ b/fs/exfat/balloc.c @@ -112,7 +112,7 @@ static int exfat_allocate_bitmap(struct super_block *sb, } if (exfat_test_bitmap_range(sb, sbi->map_clu, - EXFAT_B_TO_CLU_ROUND_UP(map_size, sbi))...
5c86f1c1f972761a04bf22f4c0618d1aa714185b
Analyze and fix the following issue in the Linux kernel code: powerpc/kexec: fix double get_cpu() imbalance in kexec_prepare_cpus
Problem Details: kexec_prepare_cpus_wait() calls get_cpu() internally to obtain the current CPU id. kexec_prepare_cpus() calls kexec_prepare_cpus_wait() twice -- once for KEXEC_STATE_IRQS_OFF and once for KEXEC_STATE_REAL_MODE -- but only issues a single put_cpu() at the end, leaving preempt_count elevated by one extra...
```diff diff --git a/arch/powerpc/kexec/core_64.c b/arch/powerpc/kexec/core_64.c index 825ab8a88f18..58c13a59b93b 100644 --- a/arch/powerpc/kexec/core_64.c +++ b/arch/powerpc/kexec/core_64.c @@ -169,7 +169,7 @@ static void kexec_prepare_cpus_wait(int wait_state) int my_cpu, i, notified=-1; hw_breakpoint_disable()...
3f5f8ee9917cc2b9076ac533492d8a200edcabb8
Analyze and fix the following issue in the Linux kernel code: exfat: fix potential use-after-free in exfat_find_dir_entry()
Problem Details: In exfat_find_dir_entry(), the buffer_head obtained from exfat_get_dentry() is released with brelse(bh) before the fall-through TYPE_EXTEND branch reads the directory entry through ep (which points into bh->b_data): brelse(bh); if (entry_type == TYPE_EXTEND) { ... len = exfat_extract_uni_name(ep...
```diff diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index ac008ccaa97d..561fd2349218 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -1027,12 +1027,12 @@ rewind: continue; } - brelse(bh); if (entry_type == TYPE_EXTEND) { unsigned short entry_uniname[16], unichar; if (step != DIRENT_STE...
0ecd26e93e698c8327521910fc6296f5b84a4b92
Analyze and fix the following issue in the Linux kernel code: powerpc/powernv: fix preempt count leak in pnv_kexec_wait_secondaries_down
Problem Details: pnv_kexec_wait_secondaries_down() calls get_cpu() to obtain the current CPU id but never calls the matching put_cpu(), leaking one preempt_disable() nesting level on every invocation. In practice the imbalance does not trigger a visible splat because the kexec teardown path is a one-way trip: IRQs are...
```diff diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c index 4dbb47ddbdcc..06ed5e2aa265 100644 --- a/arch/powerpc/platforms/powernv/setup.c +++ b/arch/powerpc/platforms/powernv/setup.c @@ -396,7 +396,8 @@ static void pnv_kexec_wait_secondaries_down(void) { int my_cpu, i,...
81e3a86030462824a67d697739cf3f387f4ba350
Analyze and fix the following issue in the Linux kernel code: powerpc/perf: fix preempt count underflow in fsl_emb_pmu_del
Problem Details: fsl_emb_pmu_del() unconditionally calls put_cpu_var(cpu_hw_events) at the 'out:' label, but only calls the matching get_cpu_var() after the 'i < 0' early-return check. When event->hw.idx is negative the function jumps to 'out:' without having taken get_cpu_var(), and the trailing put_cpu_var() then iss...
```diff diff --git a/arch/powerpc/perf/core-fsl-emb.c b/arch/powerpc/perf/core-fsl-emb.c index 7120ab20cbfe..02b5dd74c187 100644 --- a/arch/powerpc/perf/core-fsl-emb.c +++ b/arch/powerpc/perf/core-fsl-emb.c @@ -366,9 +366,10 @@ static void fsl_emb_pmu_del(struct perf_event *event, int flags) cpuhw->n_events--; + ...
20dd3185d13865214ff25b0bf7b931e8d73be1ac
Analyze and fix the following issue in the Linux kernel code: exfat: fix handling of damaged volume in exfat_create_upcase_table()
Problem Details: When the size of the upcase table is set to zero in the dentry for any reason(e.g. corrupted media or misbehaving device), an integer overflow causes the module to loop indefinitely. If the size of the upcase table is read zero, do not attempt to load the table. Instead, fallback to loading the defaul...
```diff diff --git a/fs/exfat/nls.c b/fs/exfat/nls.c index 57db08a5271c..055447edcf9a 100644 --- a/fs/exfat/nls.c +++ b/fs/exfat/nls.c @@ -769,13 +769,18 @@ int exfat_create_upcase_table(struct super_block *sb) tbl_clu = le32_to_cpu(ep->dentry.upcase.start_clu); tbl_size = le64_to_cpu(ep->dentry.upcase.size)...
90c0486a82e27393f9eaf3bb350f51a0bd38cb6b
Analyze and fix the following issue in the Linux kernel code: drm/displayid: fix Tiled Display Topology ID size
Problem Details: The Tiled Display Topology ID of a DisplayID Tiled Display Topology Data Block consists of three fields: - Tiled Display Manufacturer/Vendor ID Field (3 bytes) - Tiled Display Product ID Code Field (2 bytes) - Tiled Display Serial Number Field (4 bytes) i.e. a total of 9 bytes, not 8. The DisplayID ...
```diff diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 47dc53c4a738..29634757c06d 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -3576,7 +3576,7 @@ EXPORT_SYMBOL(drm_mode_put_tile_group); /** * drm_mode_get_tile_group - get a reference to a...
05a5ff86a7f12c861e3516d3dc4d092ce620742d
Analyze and fix the following issue in the Linux kernel code: ntfs: fix incorrect size of symbolic link
Problem Details: This patch fixes the issue where a symbolic link size is displayed as 0. Cc: stable@vger.kernel.org # v7.1 Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
```diff diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c index 2f2634baa285..efb34a5e94d9 100644 --- a/fs/ntfs/inode.c +++ b/fs/ntfs/inode.c @@ -1199,6 +1199,9 @@ no_data_attr_special_case: else vi->i_blocks = ni->allocated_size >> 9; + if (S_ISLNK(vi->i_mode) && ni->target) + vi->i_size = strlen(ni->target); + ...
315b21cf81780acf961a5bc9eaf979003c1bf8c4
Analyze and fix the following issue in the Linux kernel code: MIPS: VDSO: Avoid including .got in dynamic segment
Problem Details: After commit 2db1ec80dfd5 ("MIPS: VDSO: Fold MIPS_DISABLE_VDSO into MIPS_GENERIC_GETTIMEOFDAY"), building ARCH=mips allnoconfig with LLVM=1 shows some warnings from llvm-readelf while checking the VDSO for dynamic relocations: llvm-readelf: warning: 'arch/mips/vdso/vdso.so.dbg.raw': invalid PT_DYNAM...
```diff diff --git a/arch/mips/vdso/vdso.lds.S b/arch/mips/vdso/vdso.lds.S index 5d08be3a6b85..187361c7a867 100644 --- a/arch/mips/vdso/vdso.lds.S +++ b/arch/mips/vdso/vdso.lds.S @@ -56,6 +56,7 @@ SECTIONS .dynamic : { *(.dynamic) } :text :dynamic .rodata : { *(.rodata*) } :text + .got : { *(.got) } _end ...
9f3f3bdc6d9dac1a5a8262ee7ad0f2ff1527a7e7
Analyze and fix the following issue in the Linux kernel code: MIPS: smp: report dying CPU to RCU in stop_this_cpu()
Problem Details: smp_send_stop() parks all secondary CPUs in stop_this_cpu(). The function marks the CPU offline for the scheduler via set_cpu_online(false) but never informs RCU, so RCU keeps expecting a quiescent state from CPUs that are now spinning forever with interrupts disabled. As long as nothing waits for an ...
```diff diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 4868e79f3b30..0f28b4a62e72 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c @@ -20,6 +20,7 @@ #include <linux/sched/mm.h> #include <linux/cpumask.h> #include <linux/cpu.h> +#include <linux/rcupdate.h> #include <linux/err.h> ...
98e37db4a34d3af3fb2f4648295c25b5e40b20e3
Analyze and fix the following issue in the Linux kernel code: mips: sched: Fix CPUMASK_OFFSTACK memory corruption
Problem Details: This patch addresses a critical memory management flaw. When CONFIG_CPUMASK_OFFSTACK is enabled, cpumask_var_t is a pointer. Consequently, sizeof(new_mask) evaluates to the pointer size, causing copy_from_user() to clobber the mask pointer. Furthermore, the old logic performed copy_from_user() before a...
```diff diff --git a/arch/mips/kernel/mips-mt-fpaff.c b/arch/mips/kernel/mips-mt-fpaff.c index 10172fc4f627..4fead87d2f43 100644 --- a/arch/mips/kernel/mips-mt-fpaff.c +++ b/arch/mips/kernel/mips-mt-fpaff.c @@ -71,11 +71,16 @@ asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len, struct task_struc...
1b001b16bc88f3f7817e228acfd91ee01bdcfcce
Analyze and fix the following issue in the Linux kernel code: MIPS: mm: Fix out-of-bounds write in maar_res_walk()
Problem Details: maar_res_walk() uses wi->num_cfg as the index into the fixed-size wi->cfg array, but checks whether the array is full only after it has filled the selected entry. If walk_system_ram_range() reports more than 16 memory ranges, the overflow call writes one struct maar_config past the end of the array bef...
```diff diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index 55b25e85122a..1c07ca84ee21 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c @@ -272,9 +272,15 @@ static int maar_res_walk(unsigned long start_pfn, unsigned long nr_pages, void *data) { struct maar_walk_info *wi = data; - struct maar_...
5ae158d31d02ff0419e9e127659f71a85f36a70e
Analyze and fix the following issue in the Linux kernel code: mips: dts: ar9132: fix wdt node name
Problem Details: Fixes the following warning: $nodename:0: 'wdt@18060008' does not match '^(timer|watchdog)(@.*|-([0-9]|[1-9][0-9]+))?$' from schema $id: http://devicetree.org/schemas/watchdog/qca,ar7130-wdt.yaml# Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken...
```diff diff --git a/arch/mips/boot/dts/qca/ar9132.dtsi b/arch/mips/boot/dts/qca/ar9132.dtsi index c1ca03a27b6c..b4a95b0b9b39 100644 --- a/arch/mips/boot/dts/qca/ar9132.dtsi +++ b/arch/mips/boot/dts/qca/ar9132.dtsi @@ -98,7 +98,7 @@ clock-output-names = "cpu", "ddr", "ahb"; }; - wdt: wdt@18060008 { + wdt...
7eb475e8a738ee6fd1260aa59ddccb610fdd4300
Analyze and fix the following issue in the Linux kernel code: sparc: led: avoid trimming a newline from empty writes
Problem Details: led_proc_write() duplicates up to LED_MAX_LENGTH bytes with memdup_user_nul() and then unconditionally inspects buf[count - 1] to strip a trailing newline. A zero-length write therefore reads one byte before the duplicated buffer. The previous version rejected empty writes, but empty input already fal...
```diff diff --git a/arch/sparc/kernel/led.c b/arch/sparc/kernel/led.c index f4fb82b019bb..9b53ac1fe533 100644 --- a/arch/sparc/kernel/led.c +++ b/arch/sparc/kernel/led.c @@ -78,7 +78,7 @@ static ssize_t led_proc_write(struct file *file, const char __user *buffer, return PTR_ERR(buf); /* work around \n when echo...
2d36d3b451a94899db9c965adde15492ffe6027a
Analyze and fix the following issue in the Linux kernel code: x86/ioperm: Prevent NULL dereference on theoretical missing IO bitmap
Problem Details: Outside the IOPL emulation path, the IO bitmap is always expected to be allocated when TIF_IO_BITMAP is set. The paranoid WARN_ON_ONCE() handles the case where the flag and the pointer got out of sync. In this theoretical scenario, which presumes some other bug in the code that triggers the WARN_ON_ONC...
```diff diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 4c718f8adc59..d5cd2177f18a 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -486,6 +486,7 @@ void native_tss_update_io_bitmap(void) if (WARN_ON_ONCE(!iobm)) { clear_thread_flag(TIF_IO_BITMAP); native_tss...
e4287bf34f97a88c7d9322f5bde828724c073a6b
Analyze and fix the following issue in the Linux kernel code: selftests/bpf: Work around llvm stack overflow in crypto progs
Problem Details: clang 23 fails to build crypto_bench.c and crypto_sanity.c with "BPF stack limit exceeded". The progs fill a 408-byte bpf_crypto_params on the stack and pass it to bpf_crypto_ctx_create(). clang 23 copies the byte-aligned cipher/key globals into it one byte at a time through the stack, and keeps more t...
```diff diff --git a/tools/testing/selftests/bpf/progs/crypto_bench.c b/tools/testing/selftests/bpf/progs/crypto_bench.c index 4ac956b26240..4c0a09aa1e6c 100644 --- a/tools/testing/selftests/bpf/progs/crypto_bench.c +++ b/tools/testing/selftests/bpf/progs/crypto_bench.c @@ -11,10 +11,19 @@ #include "crypto_common.h" ...
e7ab91e2bf01b024691d6ce488546533943e7a6b
Analyze and fix the following issue in the Linux kernel code: accel/ivpu: fix HWS command queue leak on registration failure
Problem Details: A command queue is considered valid and usable by the driver only when it has a doorbell ID assigned (db_id != 0), meaning both the FW cmdq creation and doorbell registration completed successfully. However, when either ivpu_register_db() or set_context_sched_properties() fails after ivpu_hws_cmdq_ini...
```diff diff --git a/drivers/accel/ivpu/ivpu_job.c b/drivers/accel/ivpu/ivpu_job.c index 521931d1f7fc..b24f31a8b567 100644 --- a/drivers/accel/ivpu/ivpu_job.c +++ b/drivers/accel/ivpu/ivpu_job.c @@ -208,9 +208,9 @@ static int ivpu_hws_cmdq_init(struct ivpu_file_priv *file_priv, struct ivpu_cmdq ret = ivpu_jsm_hws_set...
70b139d0483cd42808326c36c4b63d5be4a3cccb
Analyze and fix the following issue in the Linux kernel code: selftests/bpf: add test for bpf_msg_pop_data() overflow
Problem Details: Add a test in sockmap_basic.c that calls bpf_msg_pop_data() with a length close to U32_MAX, which overflows the start + len bounds check. The sk_msg program records the return value over a sendmsg and the test checks that the call is rejected with -EINVAL. Reviewed-by: Jiayuan Chen <jiayuan.chen@linux...
```diff diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c index d2846579285f..cb3229711f93 100644 --- a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c +++ b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c @@ -14,6 +14,7 @@ #inclu...
a48802fb2cd2d1e23651989f8ff4d15e9d5dad54
Analyze and fix the following issue in the Linux kernel code: bpf, sockmap: fix integer overflow in bpf_msg_pop_data() bounds check
Problem Details: start and len are u32, so u64 last = start + len; evaluates start + len in 32-bit and wraps before storing it in last. The bounds check if (start >= offset + l || last > msg->sg.size) return -EINVAL; can then be passed with an out-of-range start/len, after which the pop loop runs off the end of...
```diff diff --git a/net/core/filter.c b/net/core/filter.c index 3ecac0eb7da1..126aba56f1c0 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -3048,8 +3048,8 @@ BPF_CALL_4(bpf_msg_pop_data, struct sk_msg *, msg, u32, start, u32, len, u64, flags) { u32 i = 0, l = 0, space, offset = 0; - u64 last = start ...
c010995b29c8939c6aa69e3cb26f8dbee163d156
Analyze and fix the following issue in the Linux kernel code: sockmap: Fix use-after-free in udp_bpf_recvmsg()
Problem Details: syzbot reported use-after-free of struct sk_msg in sk_msg_recvmsg(). [0] sk_msg_recvmsg() peeks sk_msg from psock->ingress_msg under a lock, but its processing is lockless. Thus, sk_msg_recvmsg() must be serialised by callers, otherwise multiple threads could touch the same sk_msg. For example, TCP ...
```diff diff --git a/net/ipv4/udp_bpf.c b/net/ipv4/udp_bpf.c index 9f33b07b1481..ad57c4c9eaab 100644 --- a/net/ipv4/udp_bpf.c +++ b/net/ipv4/udp_bpf.c @@ -50,7 +50,9 @@ static int udp_msg_wait_data(struct sock *sk, struct sk_psock *psock, sk_set_bit(SOCKWQ_ASYNC_WAITDATA, sk); ret = udp_msg_has_data(sk, psock); i...
2ccbc9a3874620c9623419034f572e4507c33e4f
Analyze and fix the following issue in the Linux kernel code: bpf, sockmap: keep sk_msg copy state in sync
Problem Details: SK_MSG uses msg->sg.copy as per-scatterlist-entry provenance. Entries with this bit set are copied before data/data_end are exposed to SK_MSG BPF programs for direct packet access. bpf_msg_pull_data(), bpf_msg_push_data(), and bpf_msg_pop_data() rewrite the sk_msg scatterlist ring by collapsing, split...
```diff diff --git a/net/core/filter.c b/net/core/filter.c index 978e740792be..3ecac0eb7da1 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -2654,6 +2654,38 @@ static void sk_msg_reset_curr(struct sk_msg *msg) } } +static bool sk_msg_elem_is_copy(const struct sk_msg *msg, u32 i) +{ + return test_bit(i, m...
f3f34ca45b96c21722204e30576fd29db8f1aff7
Analyze and fix the following issue in the Linux kernel code: bpf, sockmap: Fix wrong rsge offset in bpf_msg_push_data()
Problem Details: When bpf_msg_push_data() splits a scatterlist element into head and tail, the tail's page offset is advanced by `start` (absolute message byte offset) instead of `start - offset` (byte position within the element). This makes rsge.offset overshoot by `offset` bytes, pointing to the wrong location withi...
```diff diff --git a/net/core/filter.c b/net/core/filter.c index 4b159045881d..978e740792be 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -2872,7 +2872,7 @@ BPF_CALL_4(bpf_msg_push_data, struct sk_msg *, msg, u32, start, psge->length = start - offset; rsge.length -= psge->length; - rsge.offset += s...
0c0a8ed85349dae298712d79cb276acfeb794d82
Analyze and fix the following issue in the Linux kernel code: bpf, sockmap: reject overflowing copy + len in bpf_msg_push_data()
Problem Details: When the scatterlist ring is full or nearly full, bpf_msg_push_data() enters a copy fallback path and computes copy + len for the page allocation size. Since len comes from BPF with arg3_type = ARG_ANYTHING and both are u32, a crafted len can wrap the sum to a small value, causing an undersized allocat...
```diff diff --git a/net/core/filter.c b/net/core/filter.c index 57b00c6cc8cc..4b159045881d 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -2829,6 +2829,9 @@ BPF_CALL_4(bpf_msg_push_data, struct sk_msg *, msg, u32, start, if (!space || (space == 1 && start != offset)) copy = msg->sg.data[i].length; + ...
1f32c0d619d996b395f36a920f58159949be922a
Analyze and fix the following issue in the Linux kernel code: selftsets/bpf: Retry map update on helper_fill_hashmap()
Problem Details: helper_fill_hashmap() is used also on parallel and stress map tests. Those are consistently failing with ENOMEM on kernels built with PREEMPT_RT if preallocation is disabled. The failure is transient and only called by the memory cache refill running in a preemptible irq_work, which can easily stall in...
```diff diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c index ccc5acd55ff9..c32da7bd8be2 100644 --- a/tools/testing/selftests/bpf/test_maps.c +++ b/tools/testing/selftests/bpf/test_maps.c @@ -260,6 +260,16 @@ static void test_hashmap_percpu(unsigned int task, void *data) ...
462bdd08fbdf41db223c6117d907c8fd68d666ea
Analyze and fix the following issue in the Linux kernel code: udf: fix nls leak on udf_fill_super() failure
Problem Details: On all failure exits that go to error_out there we have already moved the nls reference from uopt->nls_map to sbi->s_nls_map, leaving NULL behind. Fixes: c4e89cc674ac ("udf: convert to new mount API") Acked-by: Jan Kara <jack@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
```diff diff --git a/fs/udf/super.c b/fs/udf/super.c index b2f168b0a0d1..97a51c64ad48 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -2320,7 +2320,7 @@ static int udf_fill_super(struct super_block *sb, struct fs_context *fc) error_out: iput(sbi->s_vat_inode); - unload_nls(uopt->nls_map); + unload_nls(sbi->s_n...
1ed40bd525c00d22af666016af9aef7167f8085f
Analyze and fix the following issue in the Linux kernel code: apparmor: fix label can not be immediately before a declaration
Problem Details: Fix error reported by kernel test robot security/apparmor/policy.c:1381:2: error: a label can only be part of a statement and a declaration is not a statement All errors (new ones prefixed by >>): security/apparmor/policy.c: In function 'aa_replace_profiles': >> security/apparmor/policy.c:1381:2:...
```diff diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c index b59e827747da..94b4a7e727cc 100644 --- a/security/apparmor/policy.c +++ b/security/apparmor/policy.c @@ -1397,9 +1397,10 @@ ssize_t aa_replace_profiles(struct aa_ns *policy_ns, struct aa_label *label, mutex_unlock(&ns->lock); out: + ...
5cf2c21ab0900b41c0e29c925b9a640a92340d40
Analyze and fix the following issue in the Linux kernel code: selftests/bpf: Add test to verify the fix for bpf_setsockopt() helper
Problem Details: Verify the fix by: 1. Attach cgroup sockops prog. 2. Build a tcp connection using ipv4 addr in ipv6 socket. 3. Verify the return value of bpf_setsockopt() helper. Assisted-by: Codex:gpt-5.5-xhigh Signed-off-by: Leon Hwang <leon.hwang@linux.dev> Link: https://lore.kernel.org/r/20260613162443.60515-3-l...
```diff diff --git a/tools/testing/selftests/bpf/prog_tests/setget_sockopt.c b/tools/testing/selftests/bpf/prog_tests/setget_sockopt.c index 77fe1bfb7504..4e91d9b615ce 100644 --- a/tools/testing/selftests/bpf/prog_tests/setget_sockopt.c +++ b/tools/testing/selftests/bpf/prog_tests/setget_sockopt.c @@ -199,6 +199,83 @@ ...
ca0f587c029afa66227f7b932450b1c417403394
Analyze and fix the following issue in the Linux kernel code: bpf: Fix bpf_get/setsockopt to tos for ipv4-mapped ipv6 socket
Problem Details: When TCP over IPv4 via INET6 API, bpf_get/setsockopt with ipv4 will fail, because sk->sk_family is AF_INET6. With ipv6 will success, not take effect, because inet_csk(sk)->icsk_af_ops is ipv6_mapped and use ip_queue_xmit, inet_sk(sk)->tos. To relax this restriction, allow getting/setting tos for those...
```diff diff --git a/net/core/filter.c b/net/core/filter.c index 9590877b0714..57b00c6cc8cc 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -5544,11 +5544,24 @@ static int sol_tcp_sockopt(struct sock *sk, int optname, KERNEL_SOCKPTR(optval), *optlen); } +static bool sk_allows_sol_ip_sockopt(struct so...
55ffbe8a15b1254f44d56952fb425a10e3f15c31
Analyze and fix the following issue in the Linux kernel code: selftests/bpf: Initialize operation name before use
Problem Details: ASAN reports stack-buffer-overflow due to the uninitialized op_name. Initialize it to fix the issue. Fixes: 054b6c7866c7 ("selftests/bpf: Add verifier log tests for BPF_BTF_LOAD command") Signed-off-by: Leo Yan <leo.yan@arm.com> Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev> Link: https://lore.ker...
```diff diff --git a/tools/testing/selftests/bpf/prog_tests/verifier_log.c b/tools/testing/selftests/bpf/prog_tests/verifier_log.c index c01c0114af1b..4542bb586d72 100644 --- a/tools/testing/selftests/bpf/prog_tests/verifier_log.c +++ b/tools/testing/selftests/bpf/prog_tests/verifier_log.c @@ -317,6 +317,7 @@ static vo...
df29003c55115737a8fb4f8a60c6c2bba4c4a484
Analyze and fix the following issue in the Linux kernel code: selftests/bpf: Fix typo in verify_umulti_link_info
Problem Details: We verify info.uprobe_multi.flags against wrong kprobe-multi flag (BPF_F_KPROBE_MULTI_RETURN). It's the same value as the correct flag (BPF_F_UPROBE_MULTI_RETURN), so there's not functional change. Fixes: 147c69307bcf ("selftests/bpf: Add link_info test for uprobe_multi link") Signed-off-by: Jiri Olsa...
```diff diff --git a/tools/testing/selftests/bpf/prog_tests/fill_link_info.c b/tools/testing/selftests/bpf/prog_tests/fill_link_info.c index e40114620751..f589eefbf9fb 100644 --- a/tools/testing/selftests/bpf/prog_tests/fill_link_info.c +++ b/tools/testing/selftests/bpf/prog_tests/fill_link_info.c @@ -469,7 +469,7 @@ v...
4d87a251d45b4a95eb4c0abcfab809c9f231258a
Analyze and fix the following issue in the Linux kernel code: bpf: Guard __get_user acesss with access_ok for uprobe_multi data
Problem Details: As reported by sashiko [1] we need to use access_ok to check the user space data bounds before we use __get-user to get it. [1] https://lore.kernel.org/bpf/20260610145235.CB1441F00893@smtp.kernel.org/ Fixes: 0b779b61f651 ("bpf: Add cookies support for uprobe_multi link") Fixes: 89ae89f53d20 ("bpf: Add...
```diff diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 90432f0fc2a8..b5a12af2d3f8 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -3224,6 +3224,7 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr unsigned long __user *uoffsets; u64 __...
90fd47d0d8109ef1301a60a44a7f85581a1e6efe
Analyze and fix the following issue in the Linux kernel code: platform/x86/intel/pmc/ssram: Rename probe and PCI ID table for consistency
Problem Details: Rename intel_pmc_ssram_telemetry_probe() to pmc_ssram_telemetry_probe() and intel_pmc_ssram_telemetry_pci_ids[] to pmc_ssram_telemetry_pci_ids[], updating the MODULE_DEVICE_TABLE() and pci_driver wiring accordingly. This aligns the symbol names with the driver filename and module name, reduces redunda...
```diff diff --git a/drivers/platform/x86/intel/pmc/ssram_telemetry.c b/drivers/platform/x86/intel/pmc/ssram_telemetry.c index 6f6e83e70fc5..1deb4d71da3f 100644 --- a/drivers/platform/x86/intel/pmc/ssram_telemetry.c +++ b/drivers/platform/x86/intel/pmc/ssram_telemetry.c @@ -149,7 +149,7 @@ int pmc_ssram_telemetry_get_p...
311c9ff097fd5c06d4d7dc28b61eecffb1051e81
Analyze and fix the following issue in the Linux kernel code: wifi: ath6kl: fix invalid workqueue flags in ath6kl_usb_create()
Problem Details: ath6kl_usb_create() currently creates ath6kl_wq with flags set to 0: alloc_workqueue("ath6kl_wq", 0, 0) This triggers a runtime warning in __alloc_workqueue() because the queue is created with neither WQ_PERCPU nor WQ_UNBOUND set: workqueue: ath6kl_wq is using neither WQ_PERCPU or WQ_UNBOUND. ...
```diff diff --git a/drivers/net/wireless/ath/ath6kl/usb.c b/drivers/net/wireless/ath/ath6kl/usb.c index 79c18f5ee02b..945984c3dbe6 100644 --- a/drivers/net/wireless/ath/ath6kl/usb.c +++ b/drivers/net/wireless/ath/ath6kl/usb.c @@ -636,7 +636,7 @@ static struct ath6kl_usb *ath6kl_usb_create(struct usb_interface *interfa...
c7703f05d85f71153f5e241184397bc34da305e3
Analyze and fix the following issue in the Linux kernel code: btrfs: Drop WQ_PERCPU from ordered_flags in btrfs_init_workqueues()
Problem Details: After commit 21c05ca88a54 ("workqueue: Add warnings and ensure one among WQ_PERCPU or WQ_UNBOUND is present"), there is a warning from the btrfs-qgroup-rescan workqueue at run time: workqueue: btrfs-qgroup-rescan uses both WQ_PERCPU and WQ_UNBOUND. Dropped WQ_PERCPU, keeping WQ_UNBOUND. WQ_PERCPU i...
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8a11be02eeb9..f2a3b0705486 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1928,7 +1928,7 @@ static int btrfs_init_workqueues(struct btrfs_fs_info *fs_info) { u32 max_active = fs_info->thread_pool_size; unsigned int flags = WQ_MEM_RECL...
478cdd736f2ce3114f90e775d7358136d3977b94
Analyze and fix the following issue in the Linux kernel code: Input: touchwin - reset the packet index on every complete packet
Problem Details: tw_interrupt() accumulates each non-zero serial byte into a fixed three-byte buffer with a running index that is only reset once a full packet has been received *and* the device's two Y bytes agree: tw->data[tw->idx++] = data; if (tw->idx == TW_LENGTH && tw->data[1] == tw->data[2]) { ... tw->idx...
```diff diff --git a/drivers/input/touchscreen/touchwin.c b/drivers/input/touchscreen/touchwin.c index 099fd88e65d8..3ed33378dfcd 100644 --- a/drivers/input/touchscreen/touchwin.c +++ b/drivers/input/touchscreen/touchwin.c @@ -63,12 +63,15 @@ static irqreturn_t tw_interrupt(struct serio *serio, if (data) { /* touch ...
61f28012e5650c619223decdb7970e0d3162e949
Analyze and fix the following issue in the Linux kernel code: smb/client: Fix error code in smb2_aead_req_alloc()
Problem Details: The "*num_sgs" variable is a u32 so "ERR_PTR(*num_sgs)" doesn't work. We would have to do something similar to the previous line where it's cast to int and then long. However, it's simpler to store the return in an int ret variable. This bug would eventually result in a crash when dereference the inv...
```diff diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c index a3257815e661..a8f8feeeccb5 100644 --- a/fs/smb/client/smb2ops.c +++ b/fs/smb/client/smb2ops.c @@ -4359,11 +4359,13 @@ static void *smb2_aead_req_alloc(struct crypto_aead *tfm, const struct smb_rqst unsigned int req_size = sizeof(**req) + cry...
3ecad5de621ef538cbd63ae7075fddcc426dcd74
Analyze and fix the following issue in the Linux kernel code: smb/client: allow FS_IOC_SETFLAGS to clear compression
Problem Details: The CIFS FS_IOC_SETFLAGS path can set FS_COMPR_FL now, but it cannot clear it again. This can be reproduced on a share backed by a filesystem that supports compression, for example btrfs exported by Samba: [compress_share] vfs objects = btrfs $ touch test.bin $ chattr +c test.bin $ lsattr test....
```diff diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h index 943b7cd2c096..a462c1590a9e 100644 --- a/fs/smb/client/cifsglob.h +++ b/fs/smb/client/cifsglob.h @@ -425,7 +425,7 @@ struct smb_version_operations { int (*set_file_info)(struct inode *, const char *, FILE_BASIC_INFO *, const unsign...
7acbaa16b99edaf8ef432229d4b7a6f3b666767d
Analyze and fix the following issue in the Linux kernel code: smb/client: always return a value for FS_IOC_GETFLAGS
Problem Details: Currently, repeated lsattr calls on a regular CIFS file without the compressed attribute may show random flags: $ touch test.bin $ lsattr test.bin s-S-ia-A-EjI---------m test.bin $ lsattr test.bin ------d-cEjI---------m test.bin The lsattr reproducer depends on the previous contents of its users...
```diff diff --git a/fs/smb/client/ioctl.c b/fs/smb/client/ioctl.c index 17408bb8ab65..746d70091f3d 100644 --- a/fs/smb/client/ioctl.c +++ b/fs/smb/client/ioctl.c @@ -392,13 +392,11 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) } #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */ #en...
e8a5cf2ff5a13fefb228f2069e29dd7d8e37185d
Analyze and fix the following issue in the Linux kernel code: smb: client: fix races in cifsd thread creation
Problem Details: The cifsd demultiplex thread can run and access tcp_ses before the parent thread has finished populating tcp_ses, which the worker thread accesses locklessly. Also, the kthread_run macro may start the thread before returning the thread pointer. Because the pointer is part of the structure that the thr...
```diff diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index cbeb5637eeb9..104658e318b6 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -1871,14 +1871,6 @@ smbd_connected: * this will succeed. No need for try_module_get(). */ __module_get(THIS_MODULE); - tcp_ses->tsk = kthr...
29f1005b8b4d3d3d8ac116d85f864a0b83bcf394
Analyze and fix the following issue in the Linux kernel code: cifs: validate full SID length in security descriptors
Problem Details: parse_sid() only verified that the fixed SID header fit in the returned security descriptor, but did not verify that the full SID body described by num_subauth was present. A malicious server can return a truncated owner or group SID whose header lies within the descriptor buffer while sub_auth[] exte...
```diff diff --git a/fs/smb/client/cifsacl.c b/fs/smb/client/cifsacl.c index 786dbbc43c5b..42a3115359da 100644 --- a/fs/smb/client/cifsacl.c +++ b/fs/smb/client/cifsacl.c @@ -275,6 +275,73 @@ cifs_copy_sid(struct smb_sid *dst, const struct smb_sid *src) return size; } +static int parse_sid(const struct smb_sid *ps...
ec457f9afe5ae9538bdcd58fd4cb442b9787e183
Analyze and fix the following issue in the Linux kernel code: smb: client: resolve SWN tcon from live registrations
Problem Details: cifs_swn_notify() looks up a witness registration by id under cifs_swnreg_idr_mutex, drops the mutex, and then uses the registration's cached tcon pointer. That pointer is not a lifetime reference, and it is not a stable representative once cifs_get_swn_reg() lets multiple tcons for the same net/share...
```diff diff --git a/fs/smb/client/cifs_swn.c b/fs/smb/client/cifs_swn.c index 9753a432d099..9951817d0d7f 100644 --- a/fs/smb/client/cifs_swn.c +++ b/fs/smb/client/cifs_swn.c @@ -28,10 +28,54 @@ struct cifs_swn_reg { bool net_name_notify; bool share_name_notify; bool ip_notify; +}; - struct cifs_tcon *tcon; +st...
6d9a4aaaa8b2612b5ef9d581e2f286a458b71ee1
Analyze and fix the following issue in the Linux kernel code: cifs: remove all cifs files before kill super
Problem Details: Cifs files may be put into fileinfo_put_wq during umounting cifs. After umount done, cifsFileInfo_put_final is called, which cause following BUG: BUG: kernel NULL pointer dereference, address: 0000000000000000 ... [ 134.222152] list_lru_add+0x64/0x1a0 [ 134.222399] ? cifs_put_tcon+0x171/0x340 [cif...
```diff diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index dcde25da468d..cbeb5637eeb9 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -3996,6 +3996,9 @@ cifs_umount(struct cifs_sb_info *cifs_sb) } spin_unlock(&cifs_sb->tlink_tree_lock); + flush_workqueue(serverclose_wq); + ...
10ce03879f935f756bc8a386b3fa3a1c7264d950
Analyze and fix the following issue in the Linux kernel code: smb: client: fix conflicting option validation for new mount API
Problem Details: Apply conflicting option validation consistently across all the new mount API paths, for both mount and remount. Some checks were only applied during initial mount validation, while others were handled during option parsing, causing mount and remount/reconfigure to behave differently. Move the confli...
```diff diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c index 2f86158f85d7..fd4b13cd654d 100644 --- a/fs/smb/client/fs_context.c +++ b/fs/smb/client/fs_context.c @@ -693,6 +693,41 @@ static int smb3_handle_conflicting_options(struct fs_context *fc) { struct smb3_fs_context *ctx = smb3_fc2context...
689d0bd8f4ada0834bd198d8af8e519683ae81d1
Analyze and fix the following issue in the Linux kernel code: i3c: master: Make i3c_master_add_i3c_dev_locked() return void
Problem Details: The return value of i3c_master_add_i3c_dev_locked() is not used by any caller, and callers are not in a position to recover from failures in this path. Change the function to return void. Amend the kernel-doc accordingly, fix some grammar and remove a stale paragraph. Signed-off-by: Adrian Hunter <a...
```diff diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index b45065ecbd48..efd940a30732 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -2324,19 +2324,12 @@ i3c_master_search_i3c_dev_duplicate(struct i3c_dev_desc *refdev) * @master: master used to send frames on the bus * @addr: I3C slave ...
b3ba8383da4d0cff15810e32ea785eceb0a80813
Analyze and fix the following issue in the Linux kernel code: i3c: master: Prevent reuse of dynamic address on device add failure
Problem Details: i3c_master_add_i3c_dev_locked() is called after a device has already been assigned a dynamic address. If the function fails, the address remains marked as free and may be reallocated to another device, leading to address conflicts on the bus. Ensure the address is not marked as free on failure, by up...
```diff diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 9f8d99636f69..b45065ecbd48 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -2345,12 +2345,11 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master, bool enable_ibi = false; int ret; - if (!master) - return ...
650716f23eac488c6696babdc7805f6a6b7427ad
Analyze and fix the following issue in the Linux kernel code: i3c: mipi-i3c-hci: Fix race in i3c_hci_addr_to_dev()
Problem Details: i3c_hci_addr_to_dev() walks bus->devs.i3c, which is protected by bus.lock (rwsem). However, it is invoked from the MIPI I3C HCI IRQ handler, which cannot take bus.lock. This allows concurrent device addition/removal in the I3C core to modify the list while it is being traversed, potentially leading t...
```diff diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c index 53797841b63f..1e1f05aff092 100644 --- a/drivers/i3c/master/mipi-i3c-hci/core.c +++ b/drivers/i3c/master/mipi-i3c-hci/core.c @@ -22,6 +22,7 @@ #include "ext_caps.h" #include "cmd.h" #include "dat.h" +#include "i...
3f79dac3ea1c30516fcc791770af034387c7f917
Analyze and fix the following issue in the Linux kernel code: i3c: master: Defer new-device registration out of DAA caller context
Problem Details: Master drivers may invoke i3c_master_do_daa_ext() during resume to re-run Dynamic Address Assignment. As well as assigning addresses to any newly arrived devices, this restores the dynamic address of devices that lost it across system suspend, so it has to run as part of the controller's resume path. ...
```diff diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index c89a1921fcf3..ed749f9ee413 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -839,6 +839,7 @@ static void i3c_master_shutdown(struct i3c_master_controller *master) i3c_bus_maintenance_unlock(&master->bus); cancel_work_sync(&maste...
8323e783dc3904839e64cb08cfcc7571ef9212c4
Analyze and fix the following issue in the Linux kernel code: i3c: master: Ensure Hot-Join operations are stopped on shutdown
Problem Details: System shutdown invokes each device's bus shutdown callback to quiesce hardware, but the I3C bus type does not currently implement one. As a result, on shutdown the controller's Hot-Join work and any in-flight i3c_master_do_daa() can keep running (or be newly triggered) while the rest of the system is...
```diff diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index deb5cf851940..c89a1921fcf3 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -368,14 +368,6 @@ static void i3c_device_remove(struct device *dev) driver->remove(i3cdev); } -const struct bus_type i3c_bus_type = { - .name = "i3c", -...
5b130aadc36b6a935b90937dcd67b8ed4ba57831
Analyze and fix the following issue in the Linux kernel code: i3c: master: Serialize i3c_set_hotjoin() with the maintenance lock
Problem Details: i3c_set_hotjoin() dispatches the controller's enable_hotjoin() or disable_hotjoin() op and updates master->hotjoin under i3c_bus_normaluse_lock(). That lock is a read-side acquisition of bus->lock (down_read()), so it does not exclude concurrent callers. The hotjoin sysfs attribute can be opened multi...
```diff diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 5b64e40dae67..a3a790a14286 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -649,7 +649,7 @@ static int i3c_set_hotjoin(struct i3c_master_controller *master, bool enable) return ret; } - i3c_bus_normaluse_lock(&master->bus); +...
527756cb9ebb277dca12fff00af9fbb3b9ec8cc8
Analyze and fix the following issue in the Linux kernel code: i3c: master: Make hot-join workqueue freezable to block hot-join during suspend
Problem Details: The I3C master workqueue (master->wq) is used to defer work that needs thread context and the bus maintenance lock, most notably Hot Join processing (which calls i3c_master_do_daa() to assign dynamic addresses to newly joined devices). Currently the workqueue keeps running across system suspend, which...
```diff diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 6b8df8089a35..5b64e40dae67 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -3079,7 +3079,7 @@ int i3c_master_register(struct i3c_master_controller *master, if (ret) goto err_put_dev; - master->wq = alloc_workqueue("%s", WQ_PER...
149367545331dbadb4940540f2a43e726aab046d
Analyze and fix the following issue in the Linux kernel code: selftests/landlock: Add tests for quiet flag with scope
Problem Details: Enhance scoped_audit.connect_to_child and audit_flags.signal to test interaction with various quiet flag settings. Signed-off-by: Tingmao Wang <m@maowtm.org> Link: https://patch.msgid.link/032849ca97bd45b2e14f96192b61537ed9405a0d.1781228815.git.m@maowtm.org [mic: Fix comment formatting] Signed-off-by:...
```diff diff --git a/tools/testing/selftests/landlock/audit_test.c b/tools/testing/selftests/landlock/audit_test.c index 161ab5feb2b9..72b5612375dd 100644 --- a/tools/testing/selftests/landlock/audit_test.c +++ b/tools/testing/selftests/landlock/audit_test.c @@ -607,30 +607,42 @@ FIXTURE(audit_flags) FIXTURE_VARIANT(a...
8faab14922b75c3c0bbc0769eedef85d4609a85a
Analyze and fix the following issue in the Linux kernel code: samples/landlock: Add quiet flag support to sandboxer
Problem Details: Adds ability to set which access bits to quiet via LL_*_QUIET_ACCESS (FS, NET or SCOPED), and attach quiet flags to individual objects via LL_*_QUIET for FS and NET. Assisted-by: GitHub-Copilot:claude-opus-4.8 copilot-reviepickw Signed-off-by: Tingmao Wang <m@maowtm.org> Link: https://patch.msgid.link...
```diff diff --git a/samples/landlock/sandboxer.c b/samples/landlock/sandboxer.c index f44db2857bbf..ac71019e6212 100644 --- a/samples/landlock/sandboxer.c +++ b/samples/landlock/sandboxer.c @@ -58,9 +58,12 @@ static inline int landlock_restrict_self(const int ruleset_fd, #define ENV_FS_RO_NAME "LL_FS_RO" #define E...
5f12f8effb5acb38a8b554ea39bd30d43d54f9f0
Analyze and fix the following issue in the Linux kernel code: landlock: Suppress logging when quiet flag is present
Problem Details: The quietness behaviour is as documented in the previous patch. For optional accesses, since the existing deny_masks can only store 2x4bit of layer index, with no way to represent "no layer", we need to either expand it or have another field to correctly handle quieting of those. This commit uses the...
```diff diff --git a/security/landlock/access.h b/security/landlock/access.h index ce374a65f865..d926078bf0a5 100644 --- a/security/landlock/access.h +++ b/security/landlock/access.h @@ -143,4 +143,9 @@ static inline bool access_mask_subset(access_mask_t subset, return (subset | superset) == superset; } +/* A bitm...
29752205db5ff1793437b352c9e343b8e41fb184
Analyze and fix the following issue in the Linux kernel code: landlock: Add API support and docs for the quiet flags
Problem Details: Adds the UAPI for the quiet flags feature (but not the implementation yet). Even though currently LANDLOCK_ADD_RULE_QUIET only affects audit logging, in the future this can also be used as part of a supervisor mechanism, where it will also suppress denial notifications on a per-object basis. Thus the...
```diff diff --git a/Documentation/admin-guide/LSM/landlock.rst b/Documentation/admin-guide/LSM/landlock.rst index 2dacb381c1a9..314052bbeb0a 100644 --- a/Documentation/admin-guide/LSM/landlock.rst +++ b/Documentation/admin-guide/LSM/landlock.rst @@ -19,8 +19,10 @@ Audit Denied access requests are logged by default fo...
a260c0055665fc38804400b3dbdca165d5e0aa15
Analyze and fix the following issue in the Linux kernel code: landlock: Add a place for flags to layer rules
Problem Details: To avoid unnecessarily increasing the size of struct landlock_layer, we make the layer level a u8 and use the space to store the flags struct. struct layer_access_masks is renamed to struct layer_masks, and a new field is added to track whether a quiet flag rule is seen for each layer. Through use of...
```diff diff --git a/security/landlock/access.h b/security/landlock/access.h index c19d5bc13944..ce374a65f865 100644 --- a/security/landlock/access.h +++ b/security/landlock/access.h @@ -62,18 +62,41 @@ static_assert(sizeof(typeof_member(union access_masks_all, masks)) == sizeof(typeof_member(union access_masks...
299eccf996681273da0290f47db710de8d61c163
Analyze and fix the following issue in the Linux kernel code: landlock: Add documentation for UDP support
Problem Details: Add example of UDP usage, without detailing the two access right. Slightly change the example used in code blocks: build a ruleset for a DNS client, so that it uses both TCP and UDP. Test coverage for security/landlock is 91.3% of 2245 lines according to LLVM 22. Signed-off-by: Matthieu Buffet <matth...
```diff diff --git a/Documentation/admin-guide/LSM/landlock.rst b/Documentation/admin-guide/LSM/landlock.rst index 9923874e2156..2dacb381c1a9 100644 --- a/Documentation/admin-guide/LSM/landlock.rst +++ b/Documentation/admin-guide/LSM/landlock.rst @@ -6,7 +6,7 @@ Landlock: system-wide management =======================...
100407f548ca54a8c235fafba9d7c60c953c0d7e
Analyze and fix the following issue in the Linux kernel code: ALSA: timer: Fix racy timeri->timer changes with rwlock
Problem Details: Although we've covered the races around the timer object assignment and release for timer instances, there are still races at starting or stopping the timer instance. They refer to timeri->timer without lock, hence they can still trigger UAFs. For addressing it, this patch changes the existing slave_...
```diff diff --git a/sound/core/timer.c b/sound/core/timer.c index a3ae5416485e..51c6ac4df9f4 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -132,8 +132,8 @@ static LIST_HEAD(snd_timer_slave_list); /* list of open master instances that can accept slave links */ static LIST_HEAD(snd_timer_master_list); ...
b113a891252c3fa4fab11ec8c2894a22ecaf278c
Analyze and fix the following issue in the Linux kernel code: ALSA: core: Fix unintuitive behavior of snd_power_ref_and_wait()
Problem Details: snd_power_ref_and_wait() takes the power refcount and doesn't leave it no matter whether it returns an error or not. However, the majority of callers don't expect but just returns without unreferencing in the caller side upon errors. For addressing the potential refcount unbalance, rather correct the...
```diff diff --git a/sound/core/init.c b/sound/core/init.c index ed5af4e0ec10..56dde5bd73c4 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -1139,7 +1139,7 @@ EXPORT_SYMBOL(snd_card_file_remove); * typically around calling control ops. * * The caller needs to pull down the refcount via snd_power_unref()...
9b34c4e4c849b3d1c6114ed344979fe85c27e8c4
Analyze and fix the following issue in the Linux kernel code: i3c: mipi-i3c-hci: Base timeouts on actual transfer start time
Problem Details: Transfer timeouts are currently measured from the point where a transfer list is queued to the controller. This can cause transfers to time out before they have actually started, if earlier queued transfers consume the timeout interval. Fix this by recording when a transfer reaches the head of the qu...
```diff diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c index 69dcf5dad3a5..c6edbbedfdd7 100644 --- a/drivers/i3c/master/mipi-i3c-hci/core.c +++ b/drivers/i3c/master/mipi-i3c-hci/core.c @@ -275,13 +275,30 @@ int i3c_hci_process_xfer(struct i3c_hci *hci, struct hci_xfer *xfer...
093eb8e73c90aa0c8cfb0421aa85bd70c23488be
Analyze and fix the following issue in the Linux kernel code: i3c: mipi-i3c-hci: Preserve RUN bit when aborting DMA ring
Problem Details: The MIPI I3C HCI specification does not require the DMA ring RUN bit (RUN_STOP) to be cleared when issuing an ABORT. That allows the DMA ring to continue to receive IBIs, although an IBI is anyway not lost because it can be received once the ring restarts if the I3C device has not given up. Note, curr...
```diff diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mipi-i3c-hci/dma.c index e4daaa612055..bdffdd8b8923 100644 --- a/drivers/i3c/master/mipi-i3c-hci/dma.c +++ b/drivers/i3c/master/mipi-i3c-hci/dma.c @@ -554,7 +554,7 @@ static bool hci_dma_dequeue_xfer(struct i3c_hci *hci, if (ring_status &...
57e181af13de36571380ef3cc74000559826fa9b
Analyze and fix the following issue in the Linux kernel code: i3c: mipi-i3c-hci: Fix suspend behavior when bus disable falls back to software reset
Problem Details: Software reset was introduced as a fallback if bus disable failed. The change was made in 2 places: the cleanup path and the suspend path. For the cleanup path (i3c_hci_bus_cleanup()), after software reset the function continues to do cleanup for the current I/O mode. For the suspend path (i3c_hci_r...
```diff diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c index b781dbed2165..afb0764b5e1f 100644 --- a/drivers/i3c/master/mipi-i3c-hci/core.c +++ b/drivers/i3c/master/mipi-i3c-hci/core.c @@ -762,15 +762,10 @@ static int i3c_hci_reset_and_init(struct i3c_hci *hci) int i3c_hci...
2319688890d97c63da423a3c57c23b4ab5952dfc
Analyze and fix the following issue in the Linux kernel code: geneve: Fix off-by-one comparing with GRO_LEGACY_MAX_SIZE
Problem Details: GRO_LEGACY_MAX_SIZE = 65536; total_len being 65536 is too big to fit into a u16. As can be seen in skb_gro_receive, packets bigger or equal to gro_max_size (or GRO_LEGACY_MAX_SIZE) are dropped with -E2BIG. Apply the same boundary to geneve_post_decap_hint to avoid writing 65536 to a 16-bit iph->tot_len...
```diff diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index 23b42466a7c9..9afff7bcaa0b 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -604,7 +604,7 @@ static int geneve_post_decap_hint(const struct sock *sk, struct sk_buff *skb, ipv6h = (void *)skb->data + gro_hint->nested_nh_offset; iph...
2354e975932dabb06fad239f07a3b68fd1809737
Analyze and fix the following issue in the Linux kernel code: netfilter: nf_dup_netdev: add nf_dev_xmit_recursion*() helpers and use them
Problem Details: Update nft_dup and nft_fwd to use the nf_dev_xmit_recursion() helpers. This patch also disables BH when transmitting the skb to address a possible migration to different CPU leading to imbalanced decrementation of the recursion counters. This is modeled after Florian Westphal's dev_xmit_recursion*() A...
```diff diff --git a/include/net/netfilter/nf_dup_netdev.h b/include/net/netfilter/nf_dup_netdev.h index 609bcf422a9b..f6b05bd80c3f 100644 --- a/include/net/netfilter/nf_dup_netdev.h +++ b/include/net/netfilter/nf_dup_netdev.h @@ -11,15 +11,39 @@ void nf_fwd_netdev_egress(const struct nft_pktinfo *pkt, int oif); #de...
0e2a5d02f1d17c9d31003a46a1f638021c14b3f4
Analyze and fix the following issue in the Linux kernel code: ipvs: fix doc syntax for conn_max sysctl
Problem Details: Fix the docutils error reported by kernel test robot for the new conn_max sysctl: Documentation/networking/ipvs-sysctl.rst:76: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] Documentation/networking/ipvs-sysctl.rst:76: ERROR: Unexpected section title or transition. Re...
```diff diff --git a/Documentation/networking/ipvs-sysctl.rst b/Documentation/networking/ipvs-sysctl.rst index b6bac2612420..fe36f4fcd3a0 100644 --- a/Documentation/networking/ipvs-sysctl.rst +++ b/Documentation/networking/ipvs-sysctl.rst @@ -72,20 +72,29 @@ conn_max - INTEGER Netfilter connection tracking) the conne...
4eb7c3db5b854e7f5937ab245f3ec4dfb6192da5
Analyze and fix the following issue in the Linux kernel code: netfilter: nf_conncount: gc and rcu fixes
Problem Details: Another drive-by AI review: 1) tree_gc_worker fails to wrap around after it can't find more pending work. Update data->gc_tree unconditionally. If its 0, start from the first pending tree (which can be 0). 2) tree_gc_worker() iterates the rbtree without lock. This is never safe. Move iter...
```diff diff --git a/net/netfilter/nf_conncount.c b/net/netfilter/nf_conncount.c index 1247cbe77740..dd67004a5cc0 100644 --- a/net/netfilter/nf_conncount.c +++ b/net/netfilter/nf_conncount.c @@ -595,47 +595,54 @@ static void tree_gc_worker(struct work_struct *work) { struct nf_conncount_data *data = container_of(wor...
64d7d5abe2160bba369b4a8f06bdf5630573bab0
Analyze and fix the following issue in the Linux kernel code: netfilter: nf_conncount: callers must hold rcu read lock
Problem Details: rcu_derefence_raw() should not have been used here, it concealed this bug. Its used because struct rb_node lacks __rcu annotated pointers, so plain rcu_derefence causes sparse warnings. The major tradeoff is that rcu_derefence_raw() doesn't warn when the caller isn't in a rcu read section. Extend the...
```diff diff --git a/net/netfilter/nf_conncount.c b/net/netfilter/nf_conncount.c index ab28b47395bd..81e4a4e20df5 100644 --- a/net/netfilter/nf_conncount.c +++ b/net/netfilter/nf_conncount.c @@ -499,7 +499,7 @@ count_tree(struct net *net, hash = jhash2(key, data->keylen, data->initval) % CONNCOUNT_SLOTS; root = &da...
edb557b2ba38fea2c5eb710cf366c797e187218c
Analyze and fix the following issue in the Linux kernel code: batman-adv: tvlv: avoid race of cifsnotfound handler state
Problem Details: TVLV handlers can have the flag BATADV_TVLV_HANDLER_OGM_CIFNOTFND set to signal that the OGM handler should be called (with NULL for data) when the specific TVLV container was not found in the OGM. This is used by: * DAT * GW * Multicast (OGM + Tracker) The state whether the handler was executed was ...
```diff diff --git a/net/batman-adv/tvlv.c b/net/batman-adv/tvlv.c index a957555d8958..1c9fb21985f6 100644 --- a/net/batman-adv/tvlv.c +++ b/net/batman-adv/tvlv.c @@ -411,7 +411,6 @@ static int batadv_tvlv_call_handler(struct batadv_priv *bat_priv, tvlv_handler->ogm_handler(bat_priv, orig_node, BATADV_NO_FLA...
e546128291f8d688dcb931827e2efd2aa6c0734d
Analyze and fix the following issue in the Linux kernel code: ALSA: seq: avoid stale FIFO cells during resize
Problem Details: snd_seq_fifo_resize() still needs to publish the replacement pool before it waits for FIFO users. A blocking snd_seq_read() holds f->use_lock while it sleeps, so concurrent senders must be able to queue to the new pool and wake that reader instead of failing against a closing old pool. However, snd_se...
```diff diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c index ebe1394c18a9..cffa8d430374 100644 --- a/sound/core/seq/seq_fifo.c +++ b/sound/core/seq/seq_fifo.c @@ -101,13 +101,17 @@ int snd_seq_fifo_event_in(struct snd_seq_fifo *f, struct snd_seq_event *event) { struct snd_seq_event_cell *ce...
32a6799255525d6ea4da0f7e9e0e521ad9560a46
Analyze and fix the following issue in the Linux kernel code: batman-adv: tvlv: enforce 2-byte alignment
Problem Details: The fields of an aggregated OGM(v2) are accessed assuming (at least) 2-byte alignment, so a following OGM must start at an even offset. As the header length is even, an odd tvlv_len would misalign it and trigger unaligned accesses on strict-alignment architectures. Such a misaligned TVLV/OGM/OGMv2 is ...
```diff diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 7588e64e7ba6..bb2f012b454e 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -316,14 +316,23 @@ batadv_iv_ogm_aggr_packet(int buff_pos, int packet_len, const struct batadv_ogm_packet *ogm_packet) { ...
49ce92d207820f588b0406add82f053decfbe5d9
Analyze and fix the following issue in the Linux kernel code: ALSA: seq: oss: Serialize readq reset state with q->lock
Problem Details: snd_seq_oss_readq_clear() resets qlen, head, and tail without q->lock even though the normal reader and producer paths serialize the same ring state under that spinlock. A reset can therefore race snd_seq_oss_readq_free() or snd_seq_oss_readq_put_event() and leave stale records in the queue, drop fresh...
```diff diff --git a/sound/core/seq/oss/seq_oss_readq.c b/sound/core/seq/oss/seq_oss_readq.c index 6b474615ced8..d5dc76501ada 100644 --- a/sound/core/seq/oss/seq_oss_readq.c +++ b/sound/core/seq/oss/seq_oss_readq.c @@ -64,13 +64,17 @@ snd_seq_oss_readq_delete(struct seq_oss_readq *q) void snd_seq_oss_readq_clear(stru...
47186409c092cd7dd70350999186c700233e854d
Analyze and fix the following issue in the Linux kernel code: kcm: use WRITE_ONCE() when changing lower socket callbacks
Problem Details: kcm_attach() replaces a live lower TCP socket's sk_data_ready and sk_write_space callbacks with KCM handlers, and kcm_unattach() restores them later. Those callback-pointer updates are still plain stores even though the same fields can be read and invoked concurrently on other CPUs. If another CPU obs...
```diff diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c index 3912e75079f5..a998336840c3 100644 --- a/net/kcm/kcmsock.c +++ b/net/kcm/kcmsock.c @@ -1304,8 +1304,8 @@ static int kcm_attach(struct socket *sock, struct socket *csock, psock->save_write_space = csk->sk_write_space; psock->save_state_change = csk->sk_...
20d7658b74169f86d4ac01b9185b3eadddf71f28
Analyze and fix the following issue in the Linux kernel code: batman-adv: dat: prevent false sharing between VLANs
Problem Details: The local hash of DAT entries is supposed to be VLAN (VID) aware. But the adding to the hash and the search in the hash were not checking the VID information of the hash entries. The entries would therefore only be correctly separated when batadv_hash_dat() didn't select the same buckets for different ...
```diff diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index aaea155b9403..ae39ceaa2e29 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c @@ -215,10 +215,13 @@ static void batadv_dat_purge(struct work_struct *work) */ static...
12407d5f61c2653a64f2ff4b22f3c267f8420ef1
Analyze and fix the following issue in the Linux kernel code: batman-adv: tt: track roam count per VID
Problem Details: batadv_tt_check_roam_count() is supposed to track roaming of a TT entry. But TT entries are for a MAC + VID. The VID was completely missed and thus leads to incorrect detection of ROAM counts when a client MAC exists in multiple VLANs. Cc: stable@kernel.org Fixes: c018ad3de61a ("batman-adv: add the VL...
```diff diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 016ad100153b..4bfad36a4b70 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c @@ -3450,6 +3450,7 @@ static void batadv_tt_roam_purge(struct batadv_priv *bat_priv) * batadv_tt_check_...
f08e06c2d5c3e2434e7c773f2213f4a7dce6bc1e
Analyze and fix the following issue in the Linux kernel code: batman-adv: tt: don't merge change entries with different VIDs
Problem Details: batadv_tt_local_event() merges/cancels events for the same client which would conflict or be duplicates. The matching of the queued events only compares the MAC address - the VLAN ID stored in each event is ignored. If a MAC would now appear on multiple VID, the two ADD change events (for VID 1 and VI...
```diff diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 8b6c49c32c89..016ad100153b 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c @@ -447,6 +447,9 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv, if (!batadv_compar...
52738352a6f29279e15285fcb7b50241ef867e27
Analyze and fix the following issue in the Linux kernel code: riscv: kvm: Use endian-specific __lelong for NACL shared memory
Problem Details: When compiling with sparse enabled (C=2), bitwise type warnings are triggered in the RISC-V KVM implementation. This occurs because the user-space data unboxing macro '__get_user_asm' performs implicit casting on restricted types without forcing the compiler's compliance. Additionally, raw 'unsigned l...
```diff diff --git a/arch/riscv/include/asm/kvm_nacl.h b/arch/riscv/include/asm/kvm_nacl.h index 4124d5e06a0f..f45407bcaa26 100644 --- a/arch/riscv/include/asm/kvm_nacl.h +++ b/arch/riscv/include/asm/kvm_nacl.h @@ -60,9 +60,11 @@ int kvm_riscv_nacl_init(void); #ifdef CONFIG_32BIT #define lelong_to_cpu(__x) le32_to_cp...
d0691bd5dcaec2350039ecb04fa70faa91ac142d
Analyze and fix the following issue in the Linux kernel code: apparmor: fix kernel-doc warnings
Problem Details: Fix two kernel-doc warnings: - non-kernel-doc comment marked with '/**' in af_unix.c - documented symbol name mismatch for aa_get_i_loaddata() in policy_unpack.h No functional changes. Signed-off-by: Rodrigo Zaiden <rodrigoffzz@gmail.com> Signed-off-by: John Johansen <john.johansen@canonical.com>
```diff diff --git a/security/apparmor/af_unix.c b/security/apparmor/af_unix.c index 834a3b1c2f0a..b9b22edae202 100644 --- a/security/apparmor/af_unix.c +++ b/security/apparmor/af_unix.c @@ -615,7 +615,7 @@ static int unix_peer_perm(const struct cred *subj_cred, peer_label, &ad)); } -/** +/* * * Requires...
3e4ca50ee4d88642afa38815775e1ffa90e8dd0b
Analyze and fix the following issue in the Linux kernel code: security: apparmor: fix two spelling mistakes
Problem Details: Fix two spelling errors in comment: - interated → interacted - dont → don't Signed-off-by: Qingshuang Fu <fuqingshuang@kylinos.cn> Signed-off-by: John Johansen <john.johansen@canonical.com>
```diff diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c index 4172dedaba22..d6958eb00e30 100644 --- a/security/apparmor/domain.c +++ b/security/apparmor/domain.c @@ -136,7 +136,7 @@ static int label_compound_match(struct aa_profile *profile, struct label_it i; struct path_cond cond = { }; - /...
6f060496d03e4dc560a40f73770bd08335cb7a27
Analyze and fix the following issue in the Linux kernel code: apparmor: fix use-after-free in rawdata dedup loop
Problem Details: aa_replace_profiles() walks ns->rawdata_list to dedup the incoming policy blob against entries already attached to existing profiles. Per the kernel-doc on struct aa_loaddata, list membership does not hold a reference: profiles hold pcount, and when the last pcount drops, do_ploaddata_rmfs() is queued ...
```diff diff --git a/security/apparmor/include/policy_unpack.h b/security/apparmor/include/policy_unpack.h index e5a95dc4da1f..b9de0fdf9ee5 100644 --- a/security/apparmor/include/policy_unpack.h +++ b/security/apparmor/include/policy_unpack.h @@ -163,6 +163,25 @@ aa_get_profile_loaddata(struct aa_loaddata *data) retu...
5112ed5258b8d5e0769ae7d2bf9c9dea14c59703
Analyze and fix the following issue in the Linux kernel code: apparmor: Fix inverted comparison in cache_hold_inc()
Problem Details: cache_hold_inc() prevents the per-CPU cache hold counter from rising above MAX_HOLD_COUNT, but the comparison is inverted (> MAX_HOLD_COUNT instead of <), so the counter never rises above 0. This breaks the cache mechanism because since the hold counter is always 0, the global pool is always attempted...
```diff diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c index 3491e9f60194..b7c19805a216 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c @@ -2129,7 +2129,7 @@ static int param_set_mode(const char *val, const struct kernel_param *kp) */ static void cache_hold_inc(unsigned int *hold) ...
bcd1b34c21748531a3febaf7440632b89d8deab7
Analyze and fix the following issue in the Linux kernel code: apparmor: fix uninitialised pointer passed to audit_log_untrustedstring()
Problem Details: Commit 4a134723f9f1 ("apparmor: move check for aa_null file to cover all cases") intrdouced a small bug, where path_name() may pass a potentially uninitialized *name to aa_audit_file() if the path->dentry had been replaced with aa_null.dentry earlier on. This can lead to page fault like one observed on...
```diff diff --git a/security/apparmor/file.c b/security/apparmor/file.c index fc5abd5473c8..c9d55fe1086f 100644 --- a/security/apparmor/file.c +++ b/security/apparmor/file.c @@ -158,9 +158,9 @@ static int path_name(const char *op, const struct cred *subj_cred, /* don't reaudit files closed during inheritance */ if...
add2b70038bea194bcdef8a680f9153ee7f93ac0
Analyze and fix the following issue in the Linux kernel code: apparmor: don't audit files pointing to aa_null.dentry
Problem Details: In commit 4a134723f9f1 ("apparmor: move check for aa_null file to cover all cases") there was a change to not audit files pointing to aa_null.dentry because they provide no value, but setting the error variable instead of returning -EACCES was still causing them to be audited. Fixes: 4a134723f9f1 ("...
```diff diff --git a/security/apparmor/file.c b/security/apparmor/file.c index 694e157149e8..fc5abd5473c8 100644 --- a/security/apparmor/file.c +++ b/security/apparmor/file.c @@ -157,7 +157,7 @@ static int path_name(const char *op, const struct cred *subj_cred, /* don't reaudit files closed during inheritance */ ...
340372688bb87da45ff8d4e2f82ccfd1b64c65ff
Analyze and fix the following issue in the Linux kernel code: apparmor: put secmark label after secid lookup
Problem Details: apparmor_secmark_init() parses a configured secmark label to obtain its secid. aa_label_strn_parse() returns a refcounted label, but the success path kept that reference after copying the secid. Fixes: ab9f2115081a ("apparmor: Allow filtering based on secmark policy") Signed-off-by: Zygmunt Krynicki ...
```diff diff --git a/security/apparmor/net.c b/security/apparmor/net.c index 44c04102062f..df9cb7c00cac 100644 --- a/security/apparmor/net.c +++ b/security/apparmor/net.c @@ -354,6 +354,7 @@ static int apparmor_secmark_init(struct aa_secmark *secmark) return PTR_ERR(label); secmark->secid = label->secid; + aa_pu...
fea23bf73f0cae8ccb1d0684e4a3003874771f41
Analyze and fix the following issue in the Linux kernel code: apparmor: aa_getprocattr free procattr leak on format failure
Problem Details: aa_getprocattr() allocates the output string before rendering the label into it. If the second aa_label_snxprint() call fails, the function returned without freeing that allocation. Free and clear the output pointer on the uncommon formatting failure path before dropping the namespace reference. Fixe...
```diff diff --git a/security/apparmor/procattr.c b/security/apparmor/procattr.c index ce40f15d4952..c07b6e8fd9c9 100644 --- a/security/apparmor/procattr.c +++ b/security/apparmor/procattr.c @@ -54,6 +54,8 @@ int aa_getprocattr(struct aa_label *label, char **string, bool newline) FLAG_SHOW_MODE | FLAG_VIEW_SUBNS |...
e27bfb2ae9ad8522aea82d435fd6d73cccee7e17
Analyze and fix the following issue in the Linux kernel code: apparmor: remove unnecessary goto and associated label
Problem Details: There is no need for a goto a label immediately following the conditional block when the jump is the last statement in the block. Fixes: 7306c41672487 ("apparmor: release exe file resources on path failure") Signed-off-by: John Johansen <john.johansen@canonical.com>
```diff diff --git a/security/apparmor/task.c b/security/apparmor/task.c index 6445cb5f8526..b9fb3738124e 100644 --- a/security/apparmor/task.c +++ b/security/apparmor/task.c @@ -313,12 +313,9 @@ static const char *get_current_exe_path(char *buffer, int buffer_size) p = exe_file->f_path; path_get(&p); - if (aa_pa...
7306c41672487a6c28430714be063bc6942c28f2
Analyze and fix the following issue in the Linux kernel code: apparmor: release exe file resources on path failure
Problem Details: get_current_exe_path() takes both an exe_file reference and a path reference before resolving the path name. If aa_path_name() failed, it returned immediately and leaked both references. Route the failure through the common cleanup path so fput() and path_put() always run after the references are acqu...
```diff diff --git a/security/apparmor/task.c b/security/apparmor/task.c index 0db0e81b4600..6445cb5f8526 100644 --- a/security/apparmor/task.c +++ b/security/apparmor/task.c @@ -313,9 +313,12 @@ static const char *get_current_exe_path(char *buffer, int buffer_size) p = exe_file->f_path; path_get(&p); - if (aa_pa...
45cf568241048e560a81aa2053f06a62069f5640
Analyze and fix the following issue in the Linux kernel code: apparmor: fail policy unpack on accept2 allocation failure
Problem Details: unpack_pdb() may need to allocate a missing ACCEPT2 table for older policy data. If that allocation failed, it set an error message but jumped to the success path, returning a policydb with the required table missing. Return -ENOMEM through the normal failure path when the ACCEPT2 allocation fails. Re...
```diff diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c index 3643c058d6f8..d9dcff167c48 100644 --- a/security/apparmor/policy_unpack.c +++ b/security/apparmor/policy_unpack.c @@ -1054,7 +1054,8 @@ static int unpack_pdb(struct aa_ext *e, struct aa_policydb **policy, pdb->dfa->table...
b7a2b49bba4e5994a476c49d662b796818079e5e
Analyze and fix the following issue in the Linux kernel code: apparmor: Fix return in ns_mkdir_op
Problem Details: Return NULL instead of passing to ERR_PTR while error is zero. Fixes smatch warning: - security/apparmor/apparmorfs.c:1846 ns_mkdir_op() warn: passing zero to 'ERR_PTR' Fixes: 88d5baf69082 ("Change inode_operations.mkdir to return struct dentry *") Reviewed-by: Ryan Lee <ryan.lee@canonical...
```diff diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index a59c4b83620f..94b8c7979231 100644 --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c @@ -1975,7 +1975,7 @@ out: mutex_unlock(&parent->lock); aa_put_ns(parent); - return ERR_PTR(error); + return error ...
59fe6fbc4cd45582bc8893de0a382a36562317b3
Analyze and fix the following issue in the Linux kernel code: apparmor: remove or add symlinks to rawdata according to export_binary
Problem Details: When the export_binary parameter is set, then rawdata is available and there should be a symbolic link for the rawdata in the profile directory in apparmorfs. If the parameter is unset, then the symlinks should not exist. The issue arises when changing the value of export_binary on runtime and replaci...
```diff diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index 03fc18cf5fa7..a59c4b83620f 100644 --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c @@ -1757,6 +1757,80 @@ static const struct inode_operations rawdata_link_abi_iops = { static const struct inode_operatio...
7681ca43d2b1c776e62fe77e3167835fb1ab8319
Analyze and fix the following issue in the Linux kernel code: apparmor: fix NULL pointer dereference in unpack_pdb
Problem Details: pdb->dfa could be NULL if unpack_dfa fails, causing a NULL pointer dereference. Fixes: 2e12c5f06017 ("apparmor: add additional flags to extended permission.") Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com> Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com> Signed-off-by: John J...
```diff diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c index 9f45d5513d2c..3643c058d6f8 100644 --- a/security/apparmor/policy_unpack.c +++ b/security/apparmor/policy_unpack.c @@ -1045,7 +1045,7 @@ static int unpack_pdb(struct aa_ext *e, struct aa_policydb **policy, } /* accept2...
716d384ac7c905b719f3ce11cdb3a3d172c210fb
Analyze and fix the following issue in the Linux kernel code: apparmor: make fn_label_build() capable of handling not supported
Problem Details: Currently fn_label_build() callback fns must provide a transition or failure. Change this so that a callback can indicate it should be skipped/not be involved in the label being built. This will be useful when building object labels based on mediation flags, as to whether the label should be set. Exi...
```diff diff --git a/security/apparmor/include/lib.h b/security/apparmor/include/lib.h index a093304fc998..e3c8cb044a90 100644 --- a/security/apparmor/include/lib.h +++ b/security/apparmor/include/lib.h @@ -281,14 +281,15 @@ void aa_policy_destroy(struct aa_policy *policy); * @FN: fn to call for each profile transiti...