lkml.org 
[lkml]   [2014]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] net: Implement SO_PEERCGROUP
On Wed, Mar 12, 2014 at 01:58:57PM -0700, Cong Wang wrote:
> On Wed, Mar 12, 2014 at 1:46 PM, Vivek Goyal <vgoyal@redhat.com> wrote:
> > @@ -1098,6 +1135,16 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,
> > if (newsk == NULL)
> > goto out;
> >
> > + err = init_peercgroup(newsk);
> > + if (err)
> > + goto out;
> > +
> > + err = alloc_cgroup_path(sk);
> > + if (err)
> > + goto out;
> > +
> > + err = -ENOMEM;
> > +
>
> Don't we need to free the cgroup_path on error path
> in this function?

Previous allocated cgroup_path is now in newsk->cgroup_path and I was
relying on __sk_free() freeing that memory if error happens.

unix_release_sock(sk)
sock_put()
sk_free()
__sk_free()
kfree(sk->cgroup_path)

Do you see a problem with that?

Thanks
Vivek


\
 
 \ /
  Last update: 2014-03-13 15:21    [W:0.086 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site