From: Herbert Poetzl <herbert@13thfloor.at>
To: Andrew Morton <akpm@osdl.org>
Cc: Linux Kernel ML <linux-kernel@vger.kernel.org>
Subject: do_sendfile ppos check ...
Date: Thu, 3 Nov 2005 18:56:42 +0100 [thread overview]
Message-ID: <20051103175642.GB18015@MAIL.13thfloor.at> (raw)
Hi Andrew!
friend of mine stumbled over the following issue:
do_sendfile() does an overflow check near the end, like this:
if (*ppos > max)
retval = -EOVERFLOW;
now both sys_sendfile and sys_sendfile64 do call do_sendfile()
similar to this:
if (offset) {
...
ret = do_sendfile(out_fd, in_fd, &pos, count, MAX_NON_LFS);
return ret;
}
return do_sendfile(out_fd, in_fd, NULL, count, 0);
which passes ppos as NULL, which in turn leads to an oops ...
here is a patch (suggestion) to handle this properly, which
also adjusts the max for sys_sendfile()
(let me know what you think!)
--- linux-2.6.14/fs/read_write.c 2005-10-28 20:49:45 +0200
+++ linux-2.6.14-sendfile/fs/read_write.c 2005-11-03 18:48:37 +0100
@@ -731,7 +731,8 @@ asmlinkage ssize_t sys_sendfile(int out_
return ret;
}
- return do_sendfile(out_fd, in_fd, NULL, count, 0);
+ pos = 0;
+ return do_sendfile(out_fd, in_fd, &pos, count, MAX_NON_LFS);
}
asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, loff_t __user *offset, size_t count)
@@ -748,5 +749,6 @@ asmlinkage ssize_t sys_sendfile64(int ou
return ret;
}
- return do_sendfile(out_fd, in_fd, NULL, count, 0);
+ pos = 0;
+ return do_sendfile(out_fd, in_fd, &pos, count, 0);
}
next reply other threads:[~2005-11-03 17:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-03 17:56 Herbert Poetzl [this message]
2005-11-04 2:36 ` Herbert Xu
2005-11-04 3:10 ` Herbert Poetzl
2005-11-04 3:16 ` Herbert Xu
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=20051103175642.GB18015@MAIL.13thfloor.at \
--to=herbert@13thfloor.at \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®