mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, Paul Jackson <pj@sgi.com>
Subject: [PATCH] proc: Reference couting fix.
Date: Wed, 01 Mar 2006 00:20:34 -0700	[thread overview]
Message-ID: <m1y7zuocl9.fsf_-_@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <20060228212501.25464659.pj@sgi.com> (Paul Jackson's message of "Tue, 28 Feb 2006 21:25:01 -0800")


Fix reference counts in seccomp_write, and mem_read.

While looking for the bug I found two other places I goofed.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>


---

 fs/proc/base.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

0774b9b05aa41a25d72f31498fc2967bfe8e60b7
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 8d73c6a..6a26847 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -671,6 +671,9 @@ static ssize_t mem_read(struct file * fi
 	int ret = -ESRCH;
 	struct mm_struct *mm;
 
+	if (!task)
+		goto out_no_task;
+
 	if (!MAY_PTRACE(task) || !ptrace_may_attach(task))
 		goto out;
 
@@ -720,6 +723,8 @@ out_put:
 out_free:
 	free_page((unsigned long) page);
 out:
+	put_task_struct(task);
+out_no_task:
 	return ret;
 }
 
@@ -965,10 +970,12 @@ static ssize_t seccomp_write(struct file
 	if (unlikely(tsk->seccomp.mode))
 		goto out;
 
+	result = -EFAULT;
 	memset(__buf, 0, sizeof(__buf));
 	count = min(count, sizeof(__buf) - 1);
 	if (copy_from_user(__buf, buf, count))
-		return -EFAULT;
+		goto out;
+
 	seccomp_mode = simple_strtoul(__buf, &end, 0);
 	if (*end == '\n')
 		end++;
-- 
1.2.2.g709a-dirty


  parent reply	other threads:[~2006-03-01  7:21 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200603010120.k211KqVP009559@shell0.pdx.osdl.net>
2006-03-01  2:18 ` + proc-dont-lock-task_structs-indefinitely-cpuset-fix-2.patch added to -mm tree Paul Jackson
2006-03-01  2:36   ` Andrew Morton
2006-03-01  3:45     ` Paul Jackson
2006-03-01  4:10       ` Paul Jackson
2006-03-01  5:05         ` Eric W. Biederman
2006-03-01  5:25           ` Paul Jackson
2006-03-01  6:11             ` Eric W. Biederman
2006-03-01  6:15               ` Eric W. Biederman
2006-03-01  7:20             ` Eric W. Biederman [this message]
2006-03-01  7:26             ` [PATCH] proc: task_mmu bug fix Eric W. Biederman
2006-03-01  7:46               ` Andrew Morton
2006-03-01 12:49                 ` Eric W. Biederman
2006-03-01 13:14                   ` Hugh Dickins
2006-03-01 13:15                   ` Rafael J. Wysocki
2006-03-01 18:33                 ` Paul Jackson
2006-03-01  7:48             ` + proc-dont-lock-task_structs-indefinitely-cpuset-fix-2.patch added to -mm tree Paul Jackson
2006-03-01  8:26               ` Andrew Morton
2006-03-01  8:39                 ` Paul Jackson
2006-03-01  9:53                 ` Paul Jackson
2006-03-01 10:02                   ` Andrew Morton
2006-03-01 10:14                     ` Paul Jackson
2006-03-01 10:11                   ` Paul Jackson
2006-03-01 10:31                     ` Paul Jackson
2006-03-01 19:21                   ` Greg KH
2006-03-01 20:58                     ` Paul Jackson
2006-03-01 21:30                       ` Greg KH
2006-03-01 22:26                         ` Andrew Morton
2006-03-01 22:50                           ` Greg KH
2006-03-01 23:20                             ` Paul Jackson
2006-03-01 23:40                               ` Andrew Morton
2006-03-02  0:10                                 ` Paul Jackson
2006-03-02  0:35                                   ` Paul Jackson
2006-03-01 23:10                           ` Paul Jackson
2006-03-01 23:40                             ` Paul Jackson
2006-03-02  4:20                               ` Andrew Morton
2006-03-02  6:14                                 ` Paul Jackson
2006-03-02  7:42                                   ` Andrew Morton
2006-03-02 19:12                                     ` Paul Jackson
2006-03-02 21:52                                       ` Andrew Morton
2006-03-03  6:33                                         ` Paul Jackson
2006-03-03  6:44                                           ` Andrew Morton
2006-03-01  4:31       ` Eric W. Biederman
2006-03-01  4:58         ` Paul Jackson

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=m1y7zuocl9.fsf_-_@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pj@sgi.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®