From: "Chris Snook" <csnook@redhat.com>
To: "Chris Snook" <csnook@redhat.com>, linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, dhowells@redhat.com, jeffpc@josefsipek.net,
csnook@redhat.com
Subject: [PATCH 2/2] use use SEEK_MAX to validate user lseek arguments
Date: Tue, 20 Feb 2007 17:05:33 -0500 [thread overview]
Message-ID: <20070220.399.99798900@egw.corp.redhat.com> (raw)
In-Reply-To: <20070220.waF.48959600@egw.corp.redhat.com>
From: Chris Snook <csnook@redhat.com>
Add SEEK_MAX and use it to validate lseek arguments from userspace.
Signed-off-by: Chris Snook <csnook@redhat.com>
--
diff -urp b/fs/read_write.c c/fs/read_write.c
--- b/fs/read_write.c 2007-02-20 16:48:39.000000000 -0500
+++ c/fs/read_write.c 2007-02-20 16:55:46.000000000 -0500
@@ -139,7 +139,7 @@ asmlinkage off_t sys_lseek(unsigned int
goto bad;
retval = -EINVAL;
- if (origin <= 2) {
+ if (origin <= SEEK_MAX) {
loff_t res = vfs_llseek(file, offset, origin);
retval = res;
if (res != (loff_t)retval)
@@ -166,7 +166,7 @@ asmlinkage long sys_llseek(unsigned int
goto bad;
retval = -EINVAL;
- if (origin > 2)
+ if (origin > SEEK_MAX)
goto out_putf;
offset = vfs_llseek(file, ((loff_t) offset_high << 32) | offset_low,
diff -urp b/include/linux/fs.h c/include/linux/fs.h
--- b/include/linux/fs.h 2007-02-20 14:49:46.000000000 -0500
+++ c/include/linux/fs.h 2007-02-20 16:54:30.000000000 -0500
@@ -30,6 +30,7 @@
#define SEEK_SET 0 /* seek relative to beginning of file */
#define SEEK_CUR 1 /* seek relative to current file position */
#define SEEK_END 2 /* seek relative to end of file */
+#define SEEK_MAX SEEK_END
/* And dynamically-tunable limits and defaults: */
struct files_stat_struct {
next prev parent reply other threads:[~2007-02-20 22:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-20 21:57 [PATCH 0/2] use symbolic constants in generic lseek code Chris Snook
2007-02-20 22:01 ` [PATCH 1/2] " Chris Snook
2007-02-20 22:05 ` Chris Snook [this message]
2007-02-21 11:38 ` [PATCH 0/2] " David Howells
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=20070220.399.99798900@egw.corp.redhat.com \
--to=csnook@redhat.com \
--cc=akpm@osdl.org \
--cc=dhowells@redhat.com \
--cc=jeffpc@josefsipek.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.