Messages in this thread | | | Date | Wed, 29 Oct 1997 08:27:49 +0100 | From | Martin von Loewis <> | Subject | Re: 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
| |