Commit c105abb3 authored by Jerzy Szczepkowski's avatar Jerzy Szczepkowski Committed by Linus Torvalds

[PATCH] Fix memory leak in epoll

There was a memory leak in epoll.

The reference count (d_count) of the struct dentry of a new epoll-fd was
set to TWO.  (new_inode() assigned ONE, than ep_getfd() incremented it by
dget()).  There was only ONE reference to this dentry, so struct dentry and
struct inode were never freed.
Signed-off-by: default avatarDavide Libenzi <davidel@xmailserver.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6173a113
...@@ -716,7 +716,7 @@ static int ep_getfd(int *efd, struct inode **einode, struct file **efile) ...@@ -716,7 +716,7 @@ static int ep_getfd(int *efd, struct inode **einode, struct file **efile)
dentry->d_op = &eventpollfs_dentry_operations; dentry->d_op = &eventpollfs_dentry_operations;
d_add(dentry, inode); d_add(dentry, inode);
file->f_vfsmnt = mntget(eventpoll_mnt); file->f_vfsmnt = mntget(eventpoll_mnt);
file->f_dentry = dget(dentry); file->f_dentry = dentry;
file->f_mapping = inode->i_mapping; file->f_mapping = inode->i_mapping;
file->f_pos = 0; file->f_pos = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment