Commit 62ec0e90 authored by Dave Jones's avatar Dave Jones Committed by Linus Torvalds

[PATCH] bad userspace dereferencing

parent e4abbf1b
...@@ -329,7 +329,10 @@ static ssize_t zf_write(struct file *file, const char *buf, size_t count, ...@@ -329,7 +329,10 @@ static ssize_t zf_write(struct file *file, const char *buf, size_t count,
/* now scan */ /* now scan */
for(ofs = 0; ofs != count; ofs++){ for(ofs = 0; ofs != count; ofs++){
if(buf[ofs] == 'V'){ char c;
if (get_user(c, buf + ofs))
return -EFAULT;
if (c == 'V'){
zf_expect_close = 1; zf_expect_close = 1;
dprintk("zf_expect_close 1\n"); dprintk("zf_expect_close 1\n");
} }
......
...@@ -192,8 +192,13 @@ static ssize_t fop_write(struct file * file, const char * buf, size_t count, lof ...@@ -192,8 +192,13 @@ static ssize_t fop_write(struct file * file, const char * buf, size_t count, lof
/* now scan */ /* now scan */
for(ofs = 0; ofs != count; ofs++) for(ofs = 0; ofs != count; ofs++)
if(buf[ofs] == 'V') {
char c;
if (get_user(c, buf + ofs))
return -EFAULT;
if (c == 'V')
wdt_expect_close = 1; wdt_expect_close = 1;
}
/* someone wrote to us, we should restart timer */ /* someone wrote to us, we should restart timer */
next_heartbeat = jiffies + WDT_HEARTBEAT; next_heartbeat = jiffies + WDT_HEARTBEAT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment