FAILED: patch "[PATCH] posix-timers: Accept NULL clock_getres() output in stubs" failed to apply to 5.10-stable tree
Subsystems (2)
Sasha Levin
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 5b819071e4346256c4edbae5cc2095dff25694fc
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 5b819071e4346256c4edbae5cc2095dff25694fc Mon Sep 17 00:00:00 2001
From: Hungyu Lin <[email protected]>
Date: Tue, 20 Oct 2026 16:11:21 +0000
Subject: [PATCH] posix-timers: Accept NULL clock_getres() output in stubs
With CONFIG_POSIX_TIMERS disabled, clock_getres() returns -EFAULT for a supported clock when the result pointer is NULL. POSIX permits a NULL result pointer to suppress returning the clock resolution.
Only copy the result when a destination is provided, in both the native and time32 stubs. This matches the full POSIX timer implementation and preserves clock ID validation.
--- kernel/time/posix-stubs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/time/posix-stubs.c +2 -2
@@ -83,7 +83,7 @@ SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock, struct __kernel_timecase CLOCK_REALTIME :case CLOCK_MONOTONIC :case CLOCK_BOOTTIME : -if (put_timespec64 (&rtn_tp, tp)) +if (tp &&put_timespec64 (&rtn_tp, tp))return -EFAULT ;return 0 ;default :
@@ -166,7 +166,7 @@ SYSCALL_DEFINE2(clock_getres_time32, clockid_t, which_clock,case CLOCK_REALTIME :case CLOCK_MONOTONIC :case CLOCK_BOOTTIME : -if (put_old_timespec32 (&rtn_tp, tp)) +if (tp &&put_old_timespec32 (&rtn_tp, tp))return -EFAULT ;return 0 ;default :
Signature · 1 line
2.53.0
PATCH 1/1 posix-timers: Accept NULL clock_getres() output in stubs
[ Upstream commit 5b819071e4346256c4edbae5cc2095dff25694fc ]
With CONFIG_POSIX_TIMERS disabled, clock_getres() returns -EFAULT for a supported clock when the result pointer is NULL. POSIX permits a NULL result pointer to suppress returning the clock resolution.
Only copy the result when a destination is provided, in both the native and time32 stubs. This matches the full POSIX timer implementation and preserves clock ID validation.
--- kernel/time/posix-stubs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/time/posix-stubs.c +2 -2
@@ -116,7 +116,7 @@ SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock, struct __kernel_timecase CLOCK_REALTIME :case CLOCK_MONOTONIC :case CLOCK_BOOTTIME : -if (put_timespec64 (&rtn_tp, tp)) +if (tp &&put_timespec64 (&rtn_tp, tp))return -EFAULT ;return 0 ;default :
@@ -210,7 +210,7 @@ SYSCALL_DEFINE2(clock_getres_time32, clockid_t, which_clock,case CLOCK_REALTIME :case CLOCK_MONOTONIC :case CLOCK_BOOTTIME : -if (put_old_timespec32 (&rtn_tp, tp)) +if (tp &&put_old_timespec32 (&rtn_tp, tp))return -EFAULT ;return 0 ;default :
base-commit: 3a323bc22b881a5bdc1646080f93f5ecb22850bf
Signature · 1 line
2.43.0