lkml.org 
[lkml]   [1997]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 2.1.60 ext2: pls explain "pos = *ppos; if (pos != *ppos) ..."
> +               pos = *ppos;
> + if (pos != *ppos)
> + return -EINVAL;
>
> I don't see anything like this in any of the other filesystems in this
> patch. Is this a mistake? If not, what's so magical about *ppos that
> it's worth testing against its value a cycle ago?

The thing is that *ppos is loff_t, i.e. long long, whereas pos is long.
In turn, the assignment might lead to truncation. This means that the
user attempted to access a file beyond 2GB. Without the test, the file
system might access the wrong place of the file unnoticed.

This relates to the proposals for the 'large file system' spec. As
far as I can tell, the only thing that is wrong with that code is
the error code: it should not be EINVAL.

In turn, any other file system that does not support large files
should have similar code.

Regards,
Martin

\
 
 \ /
  Last update: 2005-03-22 13:40    [W:1.973 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site