From 93ba74df1d6523ac49d5b227e30e1cfca930f7a9 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Sat, 8 Oct 2016 18:41:02 +0200 Subject: ext2fs: Poison pointers into dereferenced cache pages. * ext2fs/ext2fs.h (disk_cache_block_deref): Replace with a macro that NULLs the given pointer. (dino_deref): Likewise. * ext2fs/pager.c (disk_cache_block_deref): Rename. * ext2fs/pokel.c (pokel_add): Adapt. (pokel_exec): Likewise. --- ext2fs/ext2fs.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ext2fs/ext2fs.h') diff --git a/ext2fs/ext2fs.h b/ext2fs/ext2fs.h index c233ce06..afcd25c8 100644 --- a/ext2fs/ext2fs.h +++ b/ext2fs/ext2fs.h @@ -271,7 +271,9 @@ extern pthread_cond_t disk_cache_reassociation; void *disk_cache_block_ref (block_t block); void disk_cache_block_ref_ptr (void *ptr); -void disk_cache_block_deref (void *ptr); +void _disk_cache_block_deref (void *ptr); +#define disk_cache_block_deref(PTR) \ + do { _disk_cache_block_deref (PTR); PTR = NULL; } while (0) int disk_cache_block_is_ref (block_t block); /* Our in-core copy of the super-block (pointer into the disk_cache). */ @@ -412,12 +414,14 @@ dino_ref (ino_t inum) } EXT2FS_EI void -dino_deref (struct ext2_inode *inode) +_dino_deref (struct ext2_inode *inode) { ext2_debug ("(%p)", inode); disk_cache_block_deref (inode); } #endif /* Use extern inlines. */ +#define dino_deref(INODE) \ + do { _dino_deref (INODE); INODE = NULL; } while (0) /* ---------------------------------------------------------------- */ /* inode.c */ -- cgit v1.2.3