public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@sw.ru>
To: Ingo Molnar <mingo@elte.hu>
Cc: akpm@osdl.org, Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org, devel@openvz.org,
	stable@kernel.org
Subject: [PATCH] Fix leak on /proc/lockdep_stats
Date: Tue, 17 Jul 2007 16:57:36 +0400	[thread overview]
Message-ID: <20070717125736.GE25083@localhost.sw.ru> (raw)
In-Reply-To: <20070717123511.GB17657@elte.hu>

On Tue, Jul 17, 2007 at 02:36:10PM +0200, Ingo Molnar wrote:
> * Alexey Dobriyan <adobriyan@sw.ru> wrote:
> 
> > On every open/close one struct seq_operations leaks.
> > Kudos to /proc/slab_allocators.
> > 
> > Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
> 
> ouch ...
> 
> Acked-by: Ingo Molnar <mingo@elte.hu>
> 
> -stable material too, as far as timer_info/stats goes.
>
> > -       .release        = seq_release,
> > +       .release        = single_release,
>
> i think seq_release() definitely needs to grow a WARN_ON() if it's being
> used on an inode that was opened via single_open(). This bug is so
> easily committed, and nothing but a small leak reminds us on it.

Yeah, I'll try to come up with something clean.

Meanwhile full single_open() audit revealed one more such leak.
The rest seems OK.

[PATCH] Fix leak on /proc/lockdep_stats

Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
---

 kernel/lockdep_proc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/lockdep_proc.c
+++ b/kernel/lockdep_proc.c
@@ -339,7 +339,7 @@ static const struct file_operations proc_lockdep_stats_operations = {
 	.open		= lockdep_stats_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
-	.release	= seq_release,
+	.release	= single_release,
 };
 
 static int __init lockdep_proc_init(void)


  reply	other threads:[~2007-07-17 12:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-17 12:25 [PATCH] Fix leaks on /proc/{*/sched,sched_debug,timer_list,timer_stats} Alexey Dobriyan
2007-07-17 12:36 ` Ingo Molnar
2007-07-17 12:57   ` Alexey Dobriyan [this message]
2007-07-18  0:53   ` Andrew Morton
2007-07-18  1:28     ` Chris Wright

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070717125736.GE25083@localhost.sw.ru \
    --to=adobriyan@sw.ru \
    --cc=akpm@osdl.org \
    --cc=devel@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=stable@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox