6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Malaya Kumar Rout [ Upstream commit 06aba58e58492d2b8eae059274caed29025ea96e ] The function validates tv_sec to be within [-KTIME_SEC_MAX, KTIME_SEC_MAX] but never validates that tv_nsec is within the valid range of [0, NSEC_PER_SEC-1] before using it in timespec64_add(). timespec64_add() expects both timespec64 structures to have normalized values with tv_nsec in the range [0, 999999999]. If off->val.tv_nsec contains invalid values (negative or >= NSEC_PER_SEC), it could lead to incorrect calculations or unexpected behavior. Add validation to ensure tv_nsec is within the valid range before performing the addition. Fixes: 04a8682a71be ("fs/proc: Introduce /proc/pid/timens_offsets") Signed-off-by: Malaya Kumar Rout Signed-off-by: Thomas Gleixner Link: https://patch.msgid.link/20260704093429.89350-1-malayarout91@gmail.com Signed-off-by: Sasha Levin --- kernel/time/namespace.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/time/namespace.c b/kernel/time/namespace.c index 0775b9ec952af..09a4cc85a9fbc 100644 --- a/kernel/time/namespace.c +++ b/kernel/time/namespace.c @@ -410,6 +410,11 @@ int proc_timens_set_offset(struct file *file, struct task_struct *p, goto out; } + if (off->val.tv_nsec < 0 || off->val.tv_nsec >= NSEC_PER_SEC) { + err = -EINVAL; + goto out; + } + err = -ERANGE; if (off->val.tv_sec > KTIME_SEC_MAX || -- 2.53.0