提交 1f08ad02 编写于 作者: D Dave Hansen 提交者: Linus Torvalds

[PATCH] undo do_readv_writev() behavior change

Bugme bug 4326: http://bugme.osdl.org/show_bug.cgi?id=4326 reports:

executing the systemcall readv with Bad argument
->len == -1) it gives out error EFAULT instead of EINVAL 
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 22a685d0
...@@ -467,10 +467,10 @@ static ssize_t do_readv_writev(int type, struct file *file, ...@@ -467,10 +467,10 @@ static ssize_t do_readv_writev(int type, struct file *file,
void __user *buf = iov[seg].iov_base; void __user *buf = iov[seg].iov_base;
ssize_t len = (ssize_t)iov[seg].iov_len; ssize_t len = (ssize_t)iov[seg].iov_len;
if (unlikely(!access_ok(vrfy_dir(type), buf, len)))
goto Efault;
if (len < 0) /* size_t not fitting an ssize_t .. */ if (len < 0) /* size_t not fitting an ssize_t .. */
goto out; goto out;
if (unlikely(!access_ok(vrfy_dir(type), buf, len)))
goto Efault;
tot_len += len; tot_len += len;
if ((ssize_t)tot_len < 0) /* maths overflow on the ssize_t */ if ((ssize_t)tot_len < 0) /* maths overflow on the ssize_t */
goto out; goto out;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册