aboutsummaryrefslogtreecommitdiffstats
path: root/fs/file_table.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 16:26:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 16:26:17 -0400
commit2e270d84223262a38d4755c61d55f5c73ea89e56 (patch)
tree4abe961ad2719e442adbe8cb01a25c014f7f274e /fs/file_table.c
parent0bbf211975addc2963b63a41a2eac99928365996 (diff)
parent60ed8cf78f886753e454b671841c0a3a0e55e915 (diff)
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()
Diffstat (limited to 'fs/file_table.c')
-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)
247 file->f_op->release(inode, file); 247 file->f_op->release(inode, file);
248 security_file_free(file); 248 security_file_free(file);
249 ima_file_free(file); 249 ima_file_free(file);
250 if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL)) 250 if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL &&
251 !(file->f_mode & FMODE_PATH))) {
251 cdev_put(inode->i_cdev); 252 cdev_put(inode->i_cdev);
253 }
252 fops_put(file->f_op); 254 fops_put(file->f_op);
253 put_pid(file->f_owner.pid); 255 put_pid(file->f_owner.pid);
254 file_sb_list_del(file); 256 file_sb_list_del(file);