Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1166381

Re: [BUG] fs: inotify_handle_event() reading un-init memory

From Jesper Dangaard Brouer <brouer@redhat.com>
Newsgroups linux.kernel
Subject Re: [BUG] fs: inotify_handle_event() reading un-init memory
Date 2015-06-16 22:30 +0200
Message-ID <pC5EC-4Oe-23@gated-at.bofh.it> (permalink)
References <pBXnI-152-7@gated-at.bofh.it> <pBZzc-4ci-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 16 Jun 2015 15:52:09 +0200 Jan Kara <jack@suse.cz> wrote:

> On Tue 16-06-15 13:33:18, Jesper Dangaard Brouer wrote:
> > Caught by kmemcheck.
> > 
> > Don't know the fix... just pointed at the bug.
> > 
> > Introduced in commit 7053aee26a3 ("fsnotify: do not share
> > events between notification groups").
> > ---
> >  fs/notify/inotify/inotify_fsnotify.c |    3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
> > index 2cd900c2c737..370d66dc4ddb 100644
> > --- a/fs/notify/inotify/inotify_fsnotify.c
> > +++ b/fs/notify/inotify/inotify_fsnotify.c
> > @@ -96,11 +96,12 @@ int inotify_handle_event(struct fsnotify_group *group,
> >  	i_mark = container_of(inode_mark, struct inotify_inode_mark,
> >  			      fsn_mark);
> >  
> > +	// new object alloc here
> >  	event = kmalloc(alloc_len, GFP_KERNEL);
> >  	if (unlikely(!event))
> >  		return -ENOMEM;
> >  
> > -	fsn_event = &event->fse;
> > +	fsn_event = &event->fse; // This looks wrong!?! read from un-init mem?
> 
> Where is here any read? This is just a pointer arithmetics where we add
> offset of 'fse' entry to 'event' address.

I was kmemcheck that complained, perhaps it is a false-positive?

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Sr. Network Kernel Developer at Red Hat
  Author of http://www.iptv-analyzer.org
  LinkedIn: http://www.linkedin.com/in/brouer
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [BUG] fs: inotify_handle_event() reading un-init memory Jesper Dangaard Brouer <brouer@redhat.com> - 2015-06-16 22:30 +0200

csiph-web