summaryrefslogtreecommitdiff
path: root/ext2fs/ext2fs.h
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2016-10-08 18:41:02 +0200
committerJustus Winter <justus@gnupg.org>2016-10-09 21:59:13 +0200
commit93ba74df1d6523ac49d5b227e30e1cfca930f7a9 (patch)
treea9465d4f937731cf42720598fa08aa86c1d038ff /ext2fs/ext2fs.h
parent83cb5faab30be175c757b31ea4acca7f640228ae (diff)
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.
Diffstat (limited to 'ext2fs/ext2fs.h')
-rw-r--r--ext2fs/ext2fs.h8
1 files changed, 6 insertions, 2 deletions
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 */