git: 539fadb493d3 - main - linux(4): Return EINVAL when the clockid has invalid bits are set

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Tue, 31 May 2022 08:59:37 UTC
The branch main has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=539fadb493d34e6607f7492f018365bdc2abc23a

commit 539fadb493d34e6607f7492f018365bdc2abc23a
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2022-05-31 08:46:15 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-05-31 08:46:15 +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
---
 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))