1
0
Fork 0
alistair23-linux/fs/notify/inotify
Sasha Levin 105d1b4253 fsnotify: don't put user context if it was never assigned
On some failure paths we may attempt to free user context even if it
wasn't assigned yet.  This will cause a NULL ptr deref and a kernel BUG.

The path I was looking at is in inotify_new_group():

        oevent = kmalloc(sizeof(struct inotify_event_info), GFP_KERNEL);
        if (unlikely(!oevent)) {
                fsnotify_destroy_group(group);
                return ERR_PTR(-ENOMEM);
        }

fsnotify_destroy_group() would get called here, but
group->inotify_data.user is only getting assigned later:

	group->inotify_data.user = get_current_user();

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: John McCutchan <john@johnmccutchan.com>
Cc: Robert Love <rlove@rlove.org>
Cc: Eric Paris <eparis@parisplace.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-10-09 22:25:45 -04:00
..
Kconfig inotify: remove inotify in kernel interface 2010-07-28 09:58:31 -04:00
Makefile inotify: remove inotify in kernel interface 2010-07-28 09:58:31 -04:00
inotify.h inotify: Fix reporting of cookies for inotify events 2014-02-18 11:17:17 +01:00
inotify_fsnotify.c fsnotify: don't put user context if it was never assigned 2014-10-09 22:25:45 -04:00
inotify_user.c fsnotify: rename event handling functions 2014-08-06 18:01:12 -07:00