diff options
| author | Jonas 'Sortie' Termansen <sortie@maxsi.org> | 2025-04-11 16:50:21 +0200 |
|---|---|---|
| committer | Jan Kara <jack@suse.cz> | 2025-04-15 11:56:57 +0200 |
| commit | 5ea45f54c8d6ca2a95b7bd450ee9eb253310bfd3 (patch) | |
| tree | 4d092640ed065456dedb1ba6642ed3c3fcefd545 /fs/isofs/inode.c | |
| parent | 0405d4b63d082861f4eaff9d39c78ee9dc34f845 (diff) | |
| download | linux-next-5ea45f54c8d6ca2a95b7bd450ee9eb253310bfd3.tar.gz linux-next-5ea45f54c8d6ca2a95b7bd450ee9eb253310bfd3.zip | |
isofs: fix Y2038 and Y2156 issues in Rock Ridge TF entry
This change implements the Rock Ridge TF entry LONG_FORM bit, which uses
the ISO 9660 17-byte date format (up to year 9999, with 10ms precision)
instead of the 7-byte date format (up to year 2155, with 1s precision).
Previously the LONG_FORM bit was ignored; and isofs would entirely
misinterpret the date as the wrong format, resulting in garbage
timestamps on the filesystem.
The Y2038 issue in iso_date() is fixed by returning a struct timespec64
instead of an int.
parse_rock_ridge_inode_internal() is fixed so it does proper bounds
checks of the TF entry timestamps.
Signed-off-by: Jonas 'Sortie' Termansen <sortie@maxsi.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20250411145022.2292255-1-sortie@maxsi.org
Diffstat (limited to 'fs/isofs/inode.c')
| -rw-r--r-- | fs/isofs/inode.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 47038e660812..d5da9817df9b 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c @@ -1275,6 +1275,7 @@ static int isofs_read_inode(struct inode *inode, int relocated) unsigned long offset; struct iso_inode_info *ei = ISOFS_I(inode); int ret = -EIO; + struct timespec64 ts; block = ei->i_iget5_block; bh = sb_bread(inode->i_sb, block); @@ -1387,8 +1388,10 @@ static int isofs_read_inode(struct inode *inode, int relocated) inode->i_ino, de->flags[-high_sierra]); } #endif - inode_set_mtime_to_ts(inode, - inode_set_atime_to_ts(inode, inode_set_ctime(inode, iso_date(de->date, high_sierra), 0))); + ts = iso_date(de->date, high_sierra ? ISO_DATE_HIGH_SIERRA : 0); + inode_set_ctime_to_ts(inode, ts); + inode_set_atime_to_ts(inode, ts); + inode_set_mtime_to_ts(inode, ts); ei->i_first_extent = (isonum_733(de->extent) + isonum_711(de->ext_attr_length)); |
