From: Erez_Zadok Date: Tue, 31 Jul 2007 07:33:24 +0000 (-0400) Subject: Unionfs: fixes to cache-coherency checking code X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=0bb5de8009ab40d041671728fcf5ebf7059e3a5f;p=unionfs-3.17.y.git Unionfs: fixes to cache-coherency checking code Under memory pressure, in_newer_lower could be called on uninitialized dentries or inodes. So return 0 safely in that case (rather than oops). This is OK because is_newer_lower will be called again on the same object(s) and cache-coherency will be validated and maintained then. Signed-off-by: Erez Zadok --- diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c index 11d898d342ef..f3c1258f7551 100644 --- a/fs/unionfs/dentry.c +++ b/fs/unionfs/dentry.c @@ -189,10 +189,15 @@ out: int is_newer_lower(const struct dentry *dentry) { int bindex; - struct inode *inode = dentry->d_inode; + struct inode *inode; struct inode *lower_inode; - if (!inode) + /* ignore if we're called on semi-initialized dentries/inodes */ + if (!dentry || !UNIONFS_D(dentry)) + return 0; + inode = dentry->d_inode; + if (!inode || !UNIONFS_I(inode) || + ibstart(inode) < 0 || ibend(inode) < 0) return 0; for (bindex = ibstart(inode); bindex <= ibend(inode); bindex++) {