Relax the rw_verify_area() error checking.
In particular, allow over-large read- or write-requests to be downgraded to a more reasonable range, rather than considering them outright errors. We want to protect lower layers from (the sadly all too common) overflow conditions, but prefer to do so by chopping the requests up, rather than just refusing them outright. Cc: Peter Anvin <hpa@zytor.com> Cc: Ulrich Drepper <drepper@redhat.com> Cc: Andi Kleen <ak@suse.de> Cc: Al Viro <viro@ftp.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
@@ -420,7 +420,7 @@ asmlinkage ssize_t sys32_pread(unsigned int fd, char * buf,
|
||||
goto out;
|
||||
pos = merge_64(a4, a5);
|
||||
ret = rw_verify_area(READ, file, &pos, count);
|
||||
if (ret)
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
ret = -EINVAL;
|
||||
if (!file->f_op || !(read = file->f_op->read))
|
||||
@@ -455,7 +455,7 @@ asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char * buf,
|
||||
goto out;
|
||||
pos = merge_64(a4, a5);
|
||||
ret = rw_verify_area(WRITE, file, &pos, count);
|
||||
if (ret)
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
ret = -EINVAL;
|
||||
if (!file->f_op || !(write = file->f_op->write))
|
||||
|
Reference in New Issue
Block a user