summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2008-12-17 13:58:46 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2008-12-17 13:58:46 +1100
commit087fdbcedb650ff047e037978993ba76b4a71abf (patch)
tree02bcfd1b33a6e9aa3813965ba0f100a029b80772 /fs
parentb7310b3327f00c0560f1c265c971d636b6ba1752 (diff)
parent037b6e2531d844994cf79bd4190853427c6af2ac (diff)
Merge commit 'kvm/master'
Conflicts: arch/x86/kernel/reboot.c
Diffstat (limited to 'fs')
-rw-r--r--fs/anon_inodes.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
index 3662dd44896b..96bbafbddc35 100644
--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@ -79,9 +79,12 @@ int anon_inode_getfd(const char *name, const struct file_operations *fops,
if (IS_ERR(anon_inode_inode))
return -ENODEV;
+ if (fops->owner && !try_module_get(fops->owner))
+ return -ENOENT;
+
error = get_unused_fd_flags(flags);
if (error < 0)
- return error;
+ goto err_module;
fd = error;
/*
@@ -128,6 +131,8 @@ err_dput:
dput(dentry);
err_put_unused_fd:
put_unused_fd(fd);
+err_module:
+ module_put(fops->owner);
return error;
}
EXPORT_SYMBOL_GPL(anon_inode_getfd);