git: 8cbf694e6808 - stable/13 - linux(4): Return EINVAL when the clockid has invalid bits are set

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Fri, 17 Jun 2022 19:41:37 UTC
The branch stable/13 has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=8cbf694e680835667db80f81a5d4103e5174de35

commit 8cbf694e680835667db80f81a5d4103e5174de35
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2022-05-31 08:46:15 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-06-17 19:35:41 +0000

    linux(4): Return EINVAL when the clockid has invalid bits are set
    
    Linux forbids PERTHREAD bit set for CLOCKFD clock.
    
    MFC after:              2 weeks
    
    (cherry picked from commit 539fadb493d34e6607f7492f018365bdc2abc23a)
---
 sys/compat/linux/linux_time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c
index 5d2269190931..32db84a570b9 100644
--- a/sys/compat/linux/linux_time.c
+++ b/sys/compat/linux/linux_time.c
@@ -283,7 +283,7 @@ linux_to_native_clockid(clockid_t *n, clockid_t l)
 			    unsupported_clockid, l);
 			return (ENOTSUP);
 		}
-		if (LINUX_CPUCLOCK_WHICH(l) >= LINUX_CPUCLOCK_MAX)
+		if ((l & LINUX_CLOCKFD_MASK) == LINUX_CLOCKFD_MASK)
 			return (EINVAL);
 
 		if (LINUX_CPUCLOCK_PERTHREAD(l))