nuttx/fs
Xiang Xiao b7d6c8ff41 fs/aio: fix aioc use-after-free and aio_cancel() issues
aioc_decant() frees the AIO container and detaches the aiocbp.  The
I/O workers (aio_read_worker, aio_write_worker, aio_fsync_worker)
called it before signaling completion, so aio_signal() and any code
touching the container afterwards ran on freed memory.  Additionally,
if the caller closed the file early the detached container could be
reused with a stale file reference.  Move aioc_decant() to after
aio_signal() and use aioc->aioc_aiocbp directly in the workers.

aio_cancel() also had two problems: with no aiocbp it looped over
g_aio_pending with a do/while that skipped the list re-entry check, so
a failed work_cancel() on an already running I/O caused an endless
loop; and an invalid fildes only checked 'fildes < 0' instead of
validating the descriptor, so a closed fd was not reported as EBADF.
Use a for-loop that always advances and validate the descriptor with
file_get()/file_put().

Co-developed-by: wushenhui <wushenhui@xiaomi.com>
Signed-off-by: wushenhui <wushenhui@xiaomi.com>
Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
2026-09-14 17:12:49 -03:00
..
aio fs/aio: fix aioc use-after-free and aio_cancel() issues 2026-09-14 17:12:49 -03:00
binfs sched,fs,docs: support setuid sudo helper 2026-08-18 15:57:52 +08:00
cromfs fs/cromfs: Fix stale cache read in read() fast path. 2026-08-12 12:12:46 -03:00
driver libs/libc: Fix divide-by-zero in stat() with large filesystem block sizes 2026-07-16 23:37:22 +08:00
event nuttx/atomic: replace atomic_fetch_xxx with atomic_xxx just like zephyr 2026-08-24 13:20:45 +08:00
fat fs/fat: fix nxstyle violations flagged by CI 2026-09-11 10:55:25 -03:00
hostfs fs: remove redundant ".." handling after VFS canonicalization 2026-08-28 23:07:24 +08:00
inode fs/inode: propagate inode search errors 2026-09-04 13:50:54 -03:00
littlefs cmake: Use NUTTX(_DIR/_BIN_DIR) instead CMAKE(_SRC_DIR/_BIN_DIR) 2026-08-09 11:13:08 -03:00
mmap !include/fcntl.h: align open flags with Linux values 2026-06-30 13:43:44 +08:00
mnemofs fs/mnemofs: Add mnemofs version 1 support. 2026-05-19 10:29:11 +08:00
mount fs/procfs: fix buffer overflow in mount_sprintf 2026-09-06 12:16:02 -03:00
mqueue nuttx/atomic: replace atomic_fetch_xxx with atomic_xxx just like zephyr 2026-08-24 13:20:45 +08:00
nfs !include/fcntl.h: align open flags with Linux values 2026-06-30 13:43:44 +08:00
nxffs fs/vfs: Add ioctldir for volume ioctls via the mountpoint directory. 2026-07-25 07:28:22 -03:00
partition fs/partition: bound TXTABLE partition names 2026-07-06 07:51:46 +02:00
procfs fs/procfs: fix incorrect environ read for another task under CONFIG_ARCH_ADDRENV 2026-07-11 12:43:10 -03:00
romfs fs/romfs: reject negative resulting position in romfs_seek() 2026-08-21 02:20:33 +08:00
rpmsgfs fs: remove redundant ".." handling after VFS canonicalization 2026-08-28 23:07:24 +08:00
semaphore nuttx/atomic: replace atomic_fetch_xxx with atomic_xxx just like zephyr 2026-08-24 13:20:45 +08:00
shm nuttx/atomic: replace atomic_fetch_xxx with atomic_xxx just like zephyr 2026-08-24 13:20:45 +08:00
smartfs fs: fix pre-existing nxstyle issues in touched files 2026-08-28 23:07:24 +08:00
socket include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
spiffs !include/fcntl.h: align open flags with Linux values 2026-06-30 13:43:44 +08:00
tmpfs fs: enforce path search and unify inode permission helpers 2026-08-02 18:48:40 -03:00
unionfs include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
userfs include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
v9fs include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
vfs fs/vfs: fix link() returning EXDEV instead of ENAMETOOLONG 2026-08-28 23:07:24 +08:00
xipfs libs/libc/elf: Place an FDPIC object's segments independently. 2026-09-08 16:31:16 -03:00
zipfs
CMakeLists.txt
fs_heap.c mm/mm_heap: use struct mm_heap_config_s to init the memory heap 2026-01-19 14:18:27 +08:00
fs_heap.h fs_heap:add fs_heap_mallinfo_task 2025-01-15 17:12:50 +08:00
fs_initialize.c fs: Move inotify.c from fs/notify/ to fs/vfs/ 2025-06-23 18:17:10 -03:00
Kconfig libs/libc/elf: Place an FDPIC object's segments independently. 2026-09-08 16:31:16 -03:00
Makefile fs/xipfs: Add a contiguous execute-in-place file system. 2026-07-29 07:49:03 -03:00