diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-16 21:26:17 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-16 21:26:17 +0100 |
commit | 2e270d84223262a38d4755c61d55f5c73ea89e56 (patch) | |
tree | 4abe961ad2719e442adbe8cb01a25c014f7f274e /fs/file_table.c | |
parent | Merge branch 'for-linus' of git://android.git.kernel.org/kernel/tegra (diff) | |
parent | fix cdev leak on O_PATH final fput() (diff) | |
download | linux-2e270d84223262a38d4755c61d55f5c73ea89e56.tar.xz linux-2e270d84223262a38d4755c61d55f5c73ea89e56.zip |
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.c | 4 |
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); |