mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-kernel@vger.kernel.org, torvalds@transmeta.com
Subject: [PATCH] 2.5.63 tsk->usage count.
Date: Thu, 27 Feb 2003 11:34:28 +0100	[thread overview]
Message-ID: <200302271134.28229.schwidefsky@de.ibm.com> (raw)

Hi Linus,
while debugging a memory leak with task structures on s390
I found something related to it. If copy_process fails for some
reason the task structure created with dup_task_struct has set
p->usage to 2 but only one put_task_struct is done in the error
cleanup code. The attached patch should take care of it.

blue skies,
  Martin.

diff -urN linux-2.5/kernel/fork.c linux-2.5-fork/kernel/fork.c
--- linux-2.5/kernel/fork.c	Thu Feb 27 11:25:56 2003
+++ linux-2.5-fork/kernel/fork.c	Thu Feb 27 10:11:42 2003
@@ -1034,6 +1034,8 @@
 	atomic_dec(&p->user->processes);
 	free_uid(p->user);
 bad_fork_free:
+	/* dup_task_struct sets p->usage to 2 */
+	atomic_dec(&p->usage);
 	put_task_struct(p);
 	goto fork_out;
 }


             reply	other threads:[~2003-02-27 10:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-27 10:34 Martin Schwidefsky [this message]
2003-02-28  6:58 ` Linus Torvalds
2003-02-28  9:24 Martin Schwidefsky

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=200302271134.28229.schwidefsky@de.ibm.com \
    --to=schwidefsky@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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

all inboxes | Powered by JetHome®