Skip to content

Commit

Permalink
fs: Use BUG_ON(!mnt) at dentry_open().
Browse files Browse the repository at this point in the history
dentry_open() requires callers to pass a valid vfsmount.

Signed-off-by: Tetsuo Handa <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Tetsuo Handa authored and Al Viro committed Mar 21, 2011
1 parent aa597bc commit c212f9a
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions fs/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -835,17 +835,8 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags,

validate_creds(cred);

/*
* We must always pass in a valid mount pointer. Historically
* callers got away with not passing it, but we must enforce this at
* the earliest possible point now to avoid strange problems deep in the
* filesystem stack.
*/
if (!mnt) {
printk(KERN_WARNING "%s called with NULL vfsmount\n", __func__);
dump_stack();
return ERR_PTR(-EINVAL);
}
/* We must always pass in a valid mount pointer. */
BUG_ON(!mnt);

error = -ENFILE;
f = get_empty_filp();
Expand Down

0 comments on commit c212f9a

Please sign in to comment.