summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 13:26:17 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 13:26:17 -0700
commit2e270d84223262a38d4755c61d55f5c73ea89e56 (patch)
tree4abe961ad2719e442adbe8cb01a25c014f7f274e
parent0bbf211975addc2963b63a41a2eac99928365996 (diff)
parent60ed8cf78f886753e454b671841c0a3a0e55e915 (diff)
downloadlinux-2e270d84223262a38d4755c61d55f5c73ea89e56.tar.bz2
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: fix cdev leak on O_PATH final fput()
-rw-r--r--fs/file_table.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/file_table.c b/fs/file_table.c
index bfab973c6c5b..01e4c1e8e6b6 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -247,8 +247,10 @@ static void __fput(struct file *file)
file->f_op->release(inode, file);
security_file_free(file);
ima_file_free(file);
- if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL))
+ if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL &&
+ !(file->f_mode & FMODE_PATH))) {
cdev_put(inode->i_cdev);
+ }
fops_put(file->f_op);
put_pid(file->f_owner.pid);
file_sb_list_del(file);