large offset llseek breaks for device special files on ac series

Martin Frey (frey@scs.ch)
Tue, 19 Jun 2001 16:31:31 -0400


Hi,

the ac series include a check in default_llseek() to not set the
file position beyond the file systems maximum file size.

This check should be done only for regular files, e.g. for
a device special file the test does not make sense.
Either we change the check or we have to write a llseek
method for each device driver.

The patch below by-passes the check for non-file inodes.
The patch is against 2.4.5.ac16. The problem was introduced
earlier (at least on 2.4.3.ac14 the same check is there).

--- linux-2.4.5.ac16/fs/read_write.c Tue Jun 19 15:11:58 2001
+++ linux-2.4.5.ac16.patched/fs/read_write.c Tue Jun 19 15:28:37 2001
@@ -36,7 +36,7 @@
offset += file->f_pos;
}
retval = -EINVAL;
- if (offset>=0 && offset<=file->f_dentry->d_inode->i_sb->s_maxbytes) {
+ if (offset>=0 && (!S_ISREG(file->f_dentry->d_inode->i_mode) || offset<=file->f_dentry->d_inode->i_sb->s_maxbytes)) {
if (offset != file->f_pos) {
file->f_pos = offset;
file->f_reada = 0;

Regards, Martin

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/