Skip to contentSkip to conversation

fs/select: check return value of poll_select_set_timeout()

PATCH New lily 1 participant 1 message Aug 23, 2022 VFS

lore
Share & tools
lore

lily

author
#0 lore raw

PATCH 1/1 fs/select: check return value of poll_select_set_timeout()

Check poll_select_set_timeout(), which could fail and return error.

---
 fs/select.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/select.c +2 -2
index 0ee55af1a55c..d9febe1b846b 100644
@@ -1073,8 +1073,8 @@ SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, unsigned int, nfds,
 
 	if (timeout_msecs >= 0) {
 		to = &end_time;
-		poll_select_set_timeout(to, timeout_msecs / MSEC_PER_SEC,
-			NSEC_PER_MSEC * (timeout_msecs % MSEC_PER_SEC));
+		if (poll_select_set_timeout(to, timeout_msecs / MSEC_PER_SEC, NSEC_PER_MSEC * (timeout_msecs % MSEC_PER_SEC)))
+			return -EINVAL;
 	}
 
 	ret = do_sys_poll(ufds, nfds, to);
Signature · 1 line
2.25.1