All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc-Christian Petersen <m.c.p@wolk-project.de>
To: lkml <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>
Subject: [PATCH 2.6.5-rc2] Add missing -EFAULT for sysctl
Date: Sat, 20 Mar 2004 16:17:04 +0100	[thread overview]
Message-ID: <200403201617.04712@WOLK> (raw)

[-- Attachment #1: Type: text/plain, Size: 337 bytes --]

Hi Linus, Andrew,

Kernel 2.6 lacks two -EFAULT returns in get_user() in kernel/sysctl.c.

It's already fixed in 2.4 9 months ago, but I forgot to send it for 2.6.

It's basically this one:

http://linux.bkbits.net:8080/linux-2.4/diffs/kernel/sysctl.c@1.23?nav=index.html|
src/|src/kernel|hist/kernel/sysctl.c

Please apply.

ciao, Marc

[-- Attachment #2: missing-EFAULT-sysctl.patch --]
[-- Type: text/x-diff, Size: 1643 bytes --]

--- old/kernel/sysctl.c	2004-03-20 15:53:22.000000000 +0100
+++ wolk-for-2.6/kernel/sysctl.c	2004-03-20 16:05:32.000000000 +0100
@@ -1107,7 +1107,8 @@ int do_sysctl_strategy (ctl_table *table
 	 * zero, proceed with automatic r/w */
 	if (table->data && table->maxlen) {
 		if (oldval && oldlenp) {
-			get_user(len, oldlenp);
+			if (get_user(len, oldlenp))
+				return -EFAULT;
 			if (len) {
 				if (len > table->maxlen)
 					len = table->maxlen;
@@ -1406,7 +1407,7 @@ int proc_dostring(ctl_table *table, int 
 		len = 0;
 		p = buffer;
 		while (len < *lenp) {
-			if(get_user(c, p++))
+			if (get_user(c, p++))
 				return -EFAULT;
 			if (c == 0 || c == '\n')
 				break;
@@ -1573,7 +1574,7 @@ static int do_proc_dointvec(ctl_table *t
 		p = (char *) buffer;
 		while (left) {
 			char c;
-			if(get_user(c, p++))
+			if (get_user(c, p++))
 				return -EFAULT;
 			if (!isspace(c))
 				break;
@@ -1808,7 +1809,7 @@ static int do_proc_doulongvec_minmax(ctl
 		p = (char *) buffer;
 		while (left) {
 			char c;
-			if(get_user(c, p++))
+			if (get_user(c, p++))
 				return -EFAULT;
 			if (!isspace(c))
 				break;
@@ -2033,7 +2034,7 @@ int sysctl_string(ctl_table *table, int 
 		return -ENOTDIR;
 	
 	if (oldval && oldlenp) {
-		if(get_user(len, oldlenp))
+		if (get_user(len, oldlenp))
 			return -EFAULT;
 		if (len) {
 			l = strlen(table->data);
@@ -2090,7 +2091,8 @@ int sysctl_intvec(ctl_table *table, int 
 
 		for (i = 0; i < length; i++) {
 			int value;
-			get_user(value, vec + i);
+			if (get_user(value, vec + i))
+				return -EFAULT;
 			if (min && value < min[i])
 				return -EINVAL;
 			if (max && value > max[i])

                 reply	other threads:[~2004-03-20 15:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200403201617.04712@WOLK \
    --to=m.c.p@wolk-project.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.