Skip to content

Commit 9d58ba2

Browse files
committed
tty: use 64-bit timstamp
jira LE-3201 Rebuild_History Non-Buildable kernel-rt-4.18.0-553.27.1.rt7.368.el8_10 commit-author Arnd Bergmann <arnd@arndb.de> commit c884f87 The automated VFS conversion to timespec64 has left one caller of the deprecated get_seconds() function in the tty driver, this cleans it up to call ktime_get_real_seconds() instead, fixing the possible overflow. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit c884f87) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 825ac46 commit 9d58ba2

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

drivers/tty/tty_io.c

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -816,9 +816,9 @@ void start_tty(struct tty_struct *tty)
816816
}
817817
EXPORT_SYMBOL(start_tty);
818818

819-
static void tty_update_time(struct timespec *time)
819+
static void tty_update_time(struct timespec64 *time)
820820
{
821-
unsigned long sec = get_seconds();
821+
time64_t sec = ktime_get_real_seconds();
822822

823823
/*
824824
* We only care if the two values differ in anything other than the
@@ -869,13 +869,8 @@ static ssize_t tty_read(struct file *file, char __user *buf, size_t count,
869869
i = -EIO;
870870
tty_ldisc_deref(ld);
871871

872-
if (i > 0) {
873-
struct timespec ts;
874-
875-
ts = timespec64_to_timespec(inode->i_atime);
876-
tty_update_time(&ts);
877-
inode->i_atime = timespec_to_timespec64(ts);
878-
}
872+
if (i > 0)
873+
tty_update_time(&inode->i_atime);
879874

880875
return i;
881876
}
@@ -976,11 +971,7 @@ static inline ssize_t do_tty_write(
976971
cond_resched();
977972
}
978973
if (written) {
979-
struct timespec ts;
980-
981-
ts = timespec64_to_timespec(file_inode(file)->i_mtime);
982-
tty_update_time(&ts);
983-
file_inode(file)->i_mtime = timespec_to_timespec64(ts);
974+
tty_update_time(&file_inode(file)->i_mtime);
984975
ret = written;
985976
}
986977
out:

0 commit comments

Comments
 (0)