On 01/30, Oleg Nesterov wrote:
>
> On 01/30, Andrew Morton wrote:
> >
> > + if (len + pos < maxlen) {
> ^^^^^^^^^^^^^^^^^^^^^^^
> Shouldn't this be
> if (len < *lenp)
>
> ?
On the other hand. If we may assume that original code was correct,
we can make a simpler patch?
Signed-off-by: Oleg Nesterov <[email protected]>
--- 6.19/kernel/sysctl.c~ 2006-11-17 19:42:31.000000000 +0300
+++ 6.19/kernel/sysctl.c 2007-01-30 16:46:00.000000000 +0300
@@ -1683,13 +1683,12 @@ static int _proc_do_string(void* data, i
size_t len;
char __user *p;
char c;
-
- if (!data || !maxlen || !*lenp ||
- (*ppos && !write)) {
+
+ if (!data || !maxlen || !*lenp) {
*lenp = 0;
return 0;
}
-
+
if (write) {
len = 0;
p = buffer;
@@ -1710,6 +1709,15 @@ static int _proc_do_string(void* data, i
len = strlen(data);
if (len > maxlen)
len = maxlen;
+
+ if (*ppos > len) {
+ *lenp = 0;
+ return 0;
+ }
+
+ data += *ppos;
+ len -= *ppos;
+
if (len > *lenp)
len = *lenp;
if (len)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]