[PATCH 19/21] Unionfs: Actually catch bad use of unionfs_mnt{get,put}

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Josef 'Jeff' Sipek <[email protected]>
---
 fs/unionfs/union.h |   34 +++++++---------------------------
 1 files changed, 7 insertions(+), 27 deletions(-)

diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index 5376b76..335d579 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -459,38 +459,18 @@ static inline void unlock_dir(struct dentry *dir)
 static inline struct vfsmount *unionfs_mntget(struct dentry *dentry,
 					      int bindex)
 {
-	struct vfsmount *mnt;
+	BUG_ON(!dentry || bindex < 0);
 
-	if (!dentry) {
-		if (bindex < 0)
-			return NULL;
-		BUG_ON(bindex < 0);
-	}
-	mnt = unionfs_lower_mnt_idx(dentry, bindex);
-	if (!mnt) {
-		if (bindex < 0)
-			return NULL;
-		BUG_ON(mnt && bindex < 0);
-	}
-	mnt = mntget(mnt);
-	return mnt;
+	return mntget(unionfs_lower_mnt_idx(dentry, bindex));
 }
 
 static inline void unionfs_mntput(struct dentry *dentry, int bindex)
 {
-	struct vfsmount *mnt;
+	if (!dentry)
+		return;
 
-	if (!dentry) {
-		if (bindex < 0)
-			return;
-		BUG_ON(dentry && bindex < 0);
-	}
-	mnt = unionfs_lower_mnt_idx(dentry, bindex);
-	if (!mnt) {
-		if (bindex < 0)
-			return;
-		BUG_ON(mnt && bindex < 0);
-	}
-	mntput(mnt);
+	BUG_ON(bindex < 0);
+
+	mntput(unionfs_lower_mnt_idx(dentry, bindex));
 }
 #endif	/* not _UNION_H_ */
-- 
1.5.2.rc1.165.gaf9b

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux