[PATCH 19/21] Unionfs: Actually catch bad use of unionfs_mnt{get,put}
From: Josef 'Jeff' Sipek
Date: Wed May 23 2007 - 20:39:32 EST
Signed-off-by: Josef 'Jeff' Sipek <jsipek@xxxxxxxxxxxxx>
---
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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/