From: Christoph Hellwig <hch@infradead.org>
To: Andrew Morton <akpm@osdl.org>,
neilb@cse.unsw.edu.au, linux-kernel@vger.kernel.org
Subject: Re: 2.6.7-mm6
Date: Mon, 5 Jul 2004 11:44:05 +0100 [thread overview]
Message-ID: <20040705104405.GA15293@infradead.org> (raw)
In-Reply-To: <20040705101804.GA14866@infradead.org>
On Mon, Jul 05, 2004 at 11:18:04AM +0100, Christoph Hellwig wrote:
> > +use-llseek-instead-of-f_pos=-for-directory-seeking.patch
> >
> > Fix an nfsd problem when the client sends an insane directory offset.
>
> Please either use llseek() directly or renamed the thing to vfs_llseek()
> everywhere. Two names for exactly the same thing are a bad idea.
>
> (The latter sounds like the better idea to me)
Updated patch implementing my suggestion below:
--- 1.84/fs/nfsd/vfs.c 2004-06-01 11:27:57 +02:00
+++ edited/fs/nfsd/vfs.c 2004-07-05 14:37:24 +02:00
@@ -1477,10 +1477,12 @@
err = nfsd_open(rqstp, fhp, S_IFDIR, MAY_READ, &file);
if (err)
goto out;
- if (offset > ~(u32) 0)
- goto out_close;
- file.f_pos = offset;
+ offset = vfs_llseek(&file, offset, 0);
+ if (offset < 0) {
+ err = nfserrno((int)offset);
+ goto out_close;
+ }
/*
* Read the directory entries. This silly loop is necessary because
@@ -1496,7 +1498,7 @@
err = nfserrno(err);
else
err = cdp->err;
- *offsetp = file.f_pos;
+ *offsetp = vfs_llseek(&file, 0LL, 1);
if (err == nfserr_eof || err == nfserr_toosmall)
err = nfs_ok; /* can still be found in ->err */
--- 1.39/fs/read_write.c 2004-05-22 10:23:18 +02:00
+++ edited/fs/read_write.c 2004-07-05 14:38:14 +02:00
@@ -112,7 +112,7 @@
EXPORT_SYMBOL(default_llseek);
-static inline loff_t llseek(struct file *file, loff_t offset, int origin)
+inline loff_t vfs_llseek(struct file *file, loff_t offset, int origin)
{
loff_t (*fn)(struct file *, loff_t, int);
@@ -122,6 +122,8 @@
return fn(file, offset, origin);
}
+EXPORT_SYMBOL(vfs_llseek);
+
asmlinkage off_t sys_lseek(unsigned int fd, off_t offset, unsigned int origin)
{
off_t retval;
@@ -135,7 +137,7 @@
retval = -EINVAL;
if (origin <= 2) {
- loff_t res = llseek(file, offset, origin);
+ loff_t res = vfs_llseek(file, offset, origin);
retval = res;
if (res != (loff_t)retval)
retval = -EOVERFLOW; /* LFS: should only happen on 32 bit platforms */
@@ -165,7 +167,7 @@
if (origin > 2)
goto out_putf;
- offset = llseek(file, ((loff_t) offset_high << 32) | offset_low,
+ offset = vfs_llseek(file, ((loff_t) offset_high << 32) | offset_low,
origin);
retval = (int)offset;
--- 1.332/include/linux/fs.h 2004-07-02 07:23:47 +02:00
+++ edited/include/linux/fs.h 2004-07-05 14:41:03 +02:00
@@ -923,6 +923,7 @@
unsigned long, loff_t *);
extern ssize_t vfs_writev(struct file *, const struct iovec __user *,
unsigned long, loff_t *);
+extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin);
/*
* NOTE: write_inode, delete_inode, clear_inode, put_inode can be called
next prev parent reply other threads:[~2004-07-05 10:44 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-05 9:31 2.6.7-mm6 Andrew Morton
2004-07-05 10:18 ` 2.6.7-mm6 Christoph Hellwig
2004-07-05 10:44 ` Christoph Hellwig [this message]
2004-07-05 10:32 ` 2.6.7-mm6 Redeeman
2004-07-05 13:54 ` 2.6.7-mm6 Frieder Buerzele
2004-07-05 14:41 ` 2.6.7-mm6 Redeeman
2004-07-05 10:39 ` 2.6.7-mm6 Martin Zwickel
2004-07-05 19:04 ` 2.6.7-mm6 Jurgen Kramer
2004-07-05 20:38 ` 2.6.7-mm6 - ppc32 inconsistent kallsyms data Joseph Fannin
2004-07-05 20:54 ` Andrew Morton
2004-07-06 2:06 ` Keith Owens
2004-07-06 7:31 ` Keith Owens
2004-07-06 7:43 ` Keith Owens
2004-07-06 20:54 ` Joseph Fannin
2004-07-06 9:09 ` Rusty Russell
2004-07-06 12:28 ` Keith Owens
2004-07-05 22:52 ` 2.6.7-mm6: ALSA: vortex_asXtalkGainsAllChan multiple definitions Adrian Bunk
2004-07-05 22:56 ` [patch] 2.6.7-mm6: let CDROM_PKTCDVD depend on experimental Adrian Bunk
2004-07-06 6:49 ` USB Lockups with 2.6.7-mm6, was Re: 2.6.7-mm6 Ralf Hildebrandt
2004-07-06 12:54 ` 2.6.7-mm6 William Lee Irwin III
2004-07-06 17:51 ` 2.6.7-mm6 Dmitry Torokhov
2004-07-06 18:55 ` 2.6.7-mm6 Jan-Benedict Glaw
2004-07-06 23:12 ` 2.6.7-mm6 William Lee Irwin III
2004-07-06 23:55 ` 2.6.7-mm6 William Lee Irwin III
2004-07-07 5:15 ` 2.6.7-mm6 Dmitry Torokhov
2004-07-07 6:37 ` 2.6.7-mm6 William Lee Irwin III
2004-07-07 12:47 ` 2.6.7-mm6 Dmitry Torokhov
2004-07-07 12:55 ` 2.6.7-mm6 William Lee Irwin III
2004-07-07 16:31 ` 2.6.7-mm6 Vojtech Pavlik
2004-07-07 17:15 ` 2.6.7-mm6 Dmitry Torokhov
2004-07-07 19:05 ` 2.6.7-mm6 Vojtech Pavlik
2004-07-06 22:34 ` 2.6.7-mm6 Andrew Morton
2004-07-06 22:45 ` 2.6.7-mm6 David S. Miller
2004-07-06 22:52 ` 2.6.7-mm6 William Lee Irwin III
2004-07-06 23:07 ` 2.6.7-mm6 Russell King
2004-07-06 23:36 ` 2.6.7-mm6 William Lee Irwin III
2004-07-07 0:02 ` 2.6.7-mm6 David S. Miller
2004-07-07 2:29 ` 2.6.7-mm6 Nick Piggin
2004-07-07 7:35 ` 2.6.7-mm6 Ingo Molnar
2004-07-07 21:02 ` 2.6.7-mm6 David S. Miller
2004-07-09 2:45 ` 2.6.7-mm6 Nick Piggin
2004-07-09 2:51 ` 2.6.7-mm6 William Lee Irwin III
2004-07-09 5:09 ` 2.6.7-mm6 Nick Piggin
2004-07-09 6:29 ` 2.6.7-mm6 Ingo Molnar
2004-07-09 6:58 ` 2.6.7-mm6 William Lee Irwin III
2004-07-09 7:07 ` 2.6.7-mm6 Nick Piggin
2004-07-09 7:16 ` 2.6.7-mm6 William Lee Irwin III
2004-07-06 14:49 ` 2.6.7-mm6 - USB problems Jesse Stockall
2004-07-07 16:44 ` 2.6.7-mm6 Jesse Barnes
-- strict thread matches above, loose matches on Subject: below --
2004-07-05 14:41 2.6.7-mm6 Martin Knoblauch
2004-07-06 13:42 2.6.7-mm6 Dmitry Torokhov
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=20040705104405.GA15293@infradead.org \
--to=hch@infradead.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@cse.unsw.edu.au \
/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