udf: Sanitize nanoseconds for time stamps
"Linux Kernel Mailing List" <[email protected]>
| Newsgroups | gmane.linux.kernel.commits.head |
|---|---|
| Message-ID | <[email protected]> |
Web: https://git.kernel.org/torvalds/c/d5bd821350e69f5f464c175455135727f986f793 Commit: d5bd821350e69f5f464c175455135727f986f793 Parent: 1291a0d5049dbc06baaaf66a9ff3f53db493b19b Refname: refs/heads/master Author: Jan Kara <[email protected]> AuthorDate: Tue Dec 19 08:11:01 2017 +0100 Committer: Jan Kara <[email protected]> CommitDate: Tue Dec 19 08:11:01 2017 +0100 udf: Sanitize nanoseconds for time stamps Reportedly some UDF filesystems are recorded with bogus subsecond values resulting in nanoseconds being over 10^9. Sanitize nanoseconds in time stamps when loading them from disk. Reported-by: Ian Turner <[email protected]> Signed-off-by: Jan Kara <[email protected]> --- fs/udf/udftime.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/udf/udftime.c b/fs/udf/udftime.c index 14626b34d13e..0927a4b2ecaf 100644 --- a/fs/udf/udftime.c +++ b/fs/udf/udftime.c @@ -62,6 +62,11 @@ udf_disk_stamp_to_time(struct timespec *dest, struct timestamp src) dest->tv_sec -= offset * 60; dest->tv_nsec = 1000 * (src.centiseconds * 10000 + src.hundredsOfMicroseconds * 100 + src.microseconds); + /* + * Sanitize nanosecond field since reportedly some filesystems are + * recorded with bogus sub-second values. + */ + dest->tv_nsec %= NSEC_PER_SEC; return dest; } -- To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html