diff options
-rw-r--r-- | fs/fat/inode.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 05689198f5af..5f04c5c810fb 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -31,6 +31,11 @@ | |||
31 | 31 | ||
32 | #define KB_IN_SECTORS 2 | 32 | #define KB_IN_SECTORS 2 |
33 | 33 | ||
34 | /* DOS dates from 1980/1/1 through 2107/12/31 */ | ||
35 | #define FAT_DATE_MIN (0<<9 | 1<<5 | 1) | ||
36 | #define FAT_DATE_MAX (127<<9 | 12<<5 | 31) | ||
37 | #define FAT_TIME_MAX (23<<11 | 59<<5 | 29) | ||
38 | |||
34 | /* | 39 | /* |
35 | * A deserialized copy of the on-disk structure laid out in struct | 40 | * A deserialized copy of the on-disk structure laid out in struct |
36 | * fat_boot_sector. | 41 | * fat_boot_sector. |
@@ -1605,6 +1610,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, | |||
1605 | int debug; | 1610 | int debug; |
1606 | long error; | 1611 | long error; |
1607 | char buf[50]; | 1612 | char buf[50]; |
1613 | struct timespec64 ts; | ||
1608 | 1614 | ||
1609 | /* | 1615 | /* |
1610 | * GFP_KERNEL is ok here, because while we do hold the | 1616 | * GFP_KERNEL is ok here, because while we do hold the |
@@ -1698,6 +1704,12 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, | |||
1698 | sbi->free_clus_valid = 0; | 1704 | sbi->free_clus_valid = 0; |
1699 | sbi->prev_free = FAT_START_ENT; | 1705 | sbi->prev_free = FAT_START_ENT; |
1700 | sb->s_maxbytes = 0xffffffff; | 1706 | sb->s_maxbytes = 0xffffffff; |
1707 | fat_time_fat2unix(sbi, &ts, 0, cpu_to_le16(FAT_DATE_MIN), 0); | ||
1708 | sb->s_time_min = ts.tv_sec; | ||
1709 | |||
1710 | fat_time_fat2unix(sbi, &ts, cpu_to_le16(FAT_TIME_MAX), | ||
1711 | cpu_to_le16(FAT_DATE_MAX), 0); | ||
1712 | sb->s_time_max = ts.tv_sec; | ||
1701 | 1713 | ||
1702 | if (!sbi->fat_length && bpb.fat32_length) { | 1714 | if (!sbi->fat_length && bpb.fat32_length) { |
1703 | struct fat_boot_fsinfo *fsinfo; | 1715 | struct fat_boot_fsinfo *fsinfo; |