diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2011-03-16 18:17:54 +0100 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-03-16 21:18:39 +0100 |
commit | 60ed8cf78f886753e454b671841c0a3a0e55e915 (patch) | |
tree | e37357fd9ca36362e38525c51944a0d4172b5308 /fs/file_table.c | |
parent | prune back iprune_sem (diff) | |
download | linux-60ed8cf78f886753e454b671841c0a3a0e55e915.tar.xz linux-60ed8cf78f886753e454b671841c0a3a0e55e915.zip |
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/file_table.c')
-rw-r--r-- | fs/file_table.c | 4 |
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) 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); |