]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
Fix FAT/ext2 heap corruption: skip kfree on static root nodes
authorTulio A M Mendes <[email protected]>
Sun, 19 Apr 2026 00:17:24 +0000 (21:17 -0300)
committerTulio A M Mendes <[email protected]>
Sun, 19 Apr 2026 00:17:24 +0000 (21:17 -0300)
commitb121d0e88b63f8189e00f8a57a5fc822c64c2a84
treef14a66e58c18003f4ec021ddda5c6fda94738da9
parent14c06366895af067d50c336eca5ff2d1cf6bb8e3
Fix FAT/ext2 heap corruption: skip kfree on static root nodes

fat_close_impl and ext2_close_impl unconditionally called kfree() on
the node passed to vfs_close(). When a directory fd pointed to a
filesystem mount root (a static variable like g_fat_root or
g_ext2_root), this kfree corrupted the heap (bad magic 0x0).

diskfs_close_impl already had the guard pattern (dn == &g_root).
Apply the same guard to fat and ext2 close handlers.
src/kernel/ext2.c
src/kernel/fat.c