On Fri, 2012-09-21 at 13:25 -0700, Francesco Ruggeri wrote:
> Hi Greg,
> I am not sure this patch should be backported to 3.0. The logic there
> seems to be different. My patch is on top of some code reorg that
> happened in 3.4 (076c3eed2c31).
> If you checked that the patch is also ok in 3.0 go ahead, but I am not
> sure one way or the other.
> The patch is good for 3.4 and later.

When I looked at this for 3.2, it certainly seemed to me that the leak
was possible there.  The function proc_sys_lookup() was unchanged
between 3.0 and 3.2.  So I think this is a valid fix for 3.0 and 3.2.

Ben.

> Thanks,
> Francesco
> 
> On Fri, Sep 21, 2012 at 10:57 AM, <[email protected]> wrote:
> >
> >
> > This is a note to let you know that I've just added the patch titled
> >
> >     fs/proc: fix potential unregister_sysctl_table hang
> >
> > to the 3.0-stable tree which can be found at:
> >
> > http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> >
> > The filename of the patch is:
> >      fs-proc-fix-potential-unregister_sysctl_table-hang.patch
> > and it can be found in the queue-3.0 subdirectory.
> >
> > If you, or anyone else, feels it should not be added to the stable tree,
> > please let <[email protected]> know about it.
> >
> >
> > From 6bf6104573482570f7103d3e5ddf9574db43a363 Mon Sep 17 00:00:00 2001
> > From: Francesco Ruggeri <[email protected]>
> > Date: Thu, 13 Sep 2012 15:03:37 -0700
> > Subject: fs/proc: fix potential unregister_sysctl_table hang
> >
> > From: Francesco Ruggeri <[email protected]>
> >
> > commit 6bf6104573482570f7103d3e5ddf9574db43a363 upstream.
> >
> > The unregister_sysctl_table() function hangs if all references to its
> > ctl_table_header structure are not dropped.
> >
> > This can happen sometimes because of a leak in proc_sys_lookup():
> > proc_sys_lookup() gets a reference to the table via lookup_entry(), but
> > it does not release it when a subsequent call to sysctl_follow_link()
> > fails.
> >
> > This patch fixes this leak by making sure the reference is always
> > dropped on return.
> >
> > See also commit 076c3eed2c31 ("sysctl: Rewrite proc_sys_lookup
> > introducing find_entry and lookup_entry") which reorganized this code in
> > 3.4.
> >
> > Tested in Linux 3.4.4.
> >
> > Signed-off-by: Francesco Ruggeri <[email protected]>
> > Signed-off-by: Linus Torvalds <[email protected]>
> > Signed-off-by: Greg Kroah-Hartman <[email protected]>
> >
> > ---
> >  fs/proc/proc_sysctl.c |    5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > --- a/fs/proc/proc_sysctl.c
> > +++ b/fs/proc/proc_sysctl.c
> > @@ -113,9 +113,6 @@ static struct dentry *proc_sys_lookup(st
> >
> >         err = ERR_PTR(-ENOMEM);
> >         inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p);
> > -       if (h)
> > -               sysctl_head_finish(h);
> > -
> >         if (!inode)
> >                 goto out;
> >
> > @@ -124,6 +121,8 @@ static struct dentry *proc_sys_lookup(st
> >         d_add(dentry, inode);
> >
> >  out:
> > +       if (h)
> > +               sysctl_head_finish(h);
> >         sysctl_head_finish(head);
> >         return err;
> >  }
> >
> >
> > Patches currently in stable-queue which might be from
> > [email protected] are
> >
> > queue-3.0/fs-proc-fix-potential-unregister_sysctl_table-hang.patch
> >
> > queue-3.0/net-ipv4-ipmr_expire_timer-causes-crash-when-removing-net-namespace.patch
> --
> To unsubscribe from this list: send the line "unsubscribe stable" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 
Ben Hutchings
Usenet is essentially a HUGE group of people passing notes in class.
                      - Rachel Kadel, `A Quick Guide to Newsgroup Etiquette'

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to