From 7b7372349a6123bad35dee6ad5dc2023124aa0f3 Mon Sep 17 00:00:00 2001 From: Christian Borntraeger Date: Tue, 2 Dec 2008 11:16:03 +0100 Subject: [PATCH] --- yaml --- r: 125293 b: refs/heads/master c: e3a2a0d4e5ace731e60e2eff4fb7056ecb34adc1 h: refs/heads/master i: 125291: ccbfa486483e8a9fb5dd6261350a80dc98857b87 v: v3 --- [refs] | 2 +- trunk/fs/anon_inodes.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 862176b0296d..89c2c645dbab 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e93353c93a3ba4215633ce930784f40a4e94e3f9 +refs/heads/master: e3a2a0d4e5ace731e60e2eff4fb7056ecb34adc1 diff --git a/trunk/fs/anon_inodes.c b/trunk/fs/anon_inodes.c index c16d9be1b017..3bbdb9d02376 100644 --- a/trunk/fs/anon_inodes.c +++ b/trunk/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 @@ int anon_inode_getfd(const char *name, const struct file_operations *fops, dput(dentry); err_put_unused_fd: put_unused_fd(fd); +err_module: + module_put(fops->owner); return error; } EXPORT_SYMBOL_GPL(anon_inode_getfd);