Skip to contentSkip to conversation

large offset llseek breaks for device special files on ac series

PATCH Martin Frey 2 participants 2 messages Jun 19, 2001 VFS

lore
Share & tools
lore
#0 lore raw

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).

fs/read_write.c Tue Jun 19 15:28:37 2001 renamed from fs/read_write.c Tue Jun 19 15:11:58 2001 +1 -1
@@ -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

#1 lore raw
Quoted 4 lines

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.

Or we introduce a method for regular files on a file system with size limits. Now that way around is probablyt much saner, and the check is removed from the default code

Car to whip up a patch ?