RE: [PATCH net-next] nfnetlink_queue: enable PID info retrieval

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Eric Dumazet
> Sent: 09 June 2016 22:17
> On Thu, 2016-06-09 at 23:50 +0300, Saeed Mahameed wrote:
> > From: Matthew Finlay <matt@xxxxxxxxxxxx>
> 
> 
> > diff --git a/net/socket.c b/net/socket.c
> > index a1bd161..67de200 100644
> > --- a/net/socket.c
> > +++ b/net/socket.c
> > @@ -382,6 +382,7 @@ struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname)
> >  	}
> >
> >  	sock->file = file;
> > +	file->f_owner.sock_pid  = find_get_pid(task_pid_nr(current));
> >  	file->f_flags = O_RDWR | (flags & O_NONBLOCK);
> >  	file->private_data = sock;
> >  	return file;
> 
> Wow, that is a serious memory leak weapon (of struct pid)
> 
> Why don't you store the pid value, instead of a pointer ?

Since the numeric 'pid' values can be reused (with no grace time) you'd
need to hold a reference to the pid structure (added in about 2.6.27) instead.
Which is just a smaller memory leak!
(and annoyingly a non-gpl driver can't drop a reference to it).

	David

��.n��������+%������w��{.n����z��׫���n�r������&��z�ޗ�zf���h���~����������_��+v���)ߣ�

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux