Details
-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
3
-
9223372036854775807
Description
If the .next function used to implement a seq_file ever doesn't change the value of *pos, the result of reading the file can be incorrect.
This specifically includes when the end-of-file is found and NULL is returned.
The error occurs if a 'read()' request is performed while the file pointer is in the middle of the last record, as you could happen if you seek there, or read a block that is not a whole number of records. In this case the remainder of the last record will be returned followed by a complete copy of that last record. To avoid the complete copy, *pos must be be changed so that a subsequent call to ->start reports an immediate end of file.
Because this is a common bug, seq_file core code will report a warning if *pos is not changed.
There are several ->next functions in lustre which don't always change *pos.