aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2011-03-16 13:17:54 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-03-16 16:18:39 -0400
commit60ed8cf78f886753e454b671841c0a3a0e55e915 (patch)
treee37357fd9ca36362e38525c51944a0d4172b5308 /fs
parentbab1d9444d9a147f1dc3478dd06c16f490227f3e (diff)
fix cdev leak on O_PATH final fput()
__fput doesn't need a cdev_put() for O_PATH handles. Signed-off-by: mszeredi@suse.cz Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-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 74a9544ac770..db30d3497f1a 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -246,8 +246,10 @@ static void __fput(struct file *file)
246 file->f_op->release(inode, file); 246 file->f_op->release(inode, file);
247 security_file_free(file); 247 security_file_free(file);
248 ima_file_free(file); 248 ima_file_free(file);
249 if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL)) 249 if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL &&
250 !(file->f_mode & FMODE_PATH))) {
250 cdev_put(inode->i_cdev); 251 cdev_put(inode->i_cdev);
252 }
251 fops_put(file->f_op); 253 fops_put(file->f_op);
252 put_pid(file->f_owner.pid); 254 put_pid(file->f_owner.pid);
253 file_sb_list_del(file); 255 file_sb_list_del(file);