提交 b3b38d84 编写于 作者: P Pavel Emelyanov 提交者: Eric Paris

inotify: don't leak user struct on inotify release

inotify_new_group() receives a get_uid-ed user_struct and saves the
reference on group->inotify_data.user.  The problem is that free_uid() is
never called on it.

Issue seem to be introduced by 63c882a0 (inotify: reimplement inotify
using fsnotify) after 2.6.30.
Signed-off-by: NPavel Emelyanov <xemul@openvz.org>
Eric Paris <eparis@parisplace.org>
Cc: <stable@kernel.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NEric Paris <eparis@redhat.com>
上级 e0873344
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/path.h> /* struct path */ #include <linux/path.h> /* struct path */
#include <linux/slab.h> /* kmem_* */ #include <linux/slab.h> /* kmem_* */
#include <linux/types.h> #include <linux/types.h>
#include <linux/sched.h>
#include "inotify.h" #include "inotify.h"
...@@ -146,6 +147,7 @@ static void inotify_free_group_priv(struct fsnotify_group *group) ...@@ -146,6 +147,7 @@ static void inotify_free_group_priv(struct fsnotify_group *group)
idr_for_each(&group->inotify_data.idr, idr_callback, group); idr_for_each(&group->inotify_data.idr, idr_callback, group);
idr_remove_all(&group->inotify_data.idr); idr_remove_all(&group->inotify_data.idr);
idr_destroy(&group->inotify_data.idr); idr_destroy(&group->inotify_data.idr);
free_uid(group->inotify_data.user);
} }
void inotify_free_event_priv(struct fsnotify_event_private_data *fsn_event_priv) void inotify_free_event_priv(struct fsnotify_event_private_data *fsn_event_priv)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册