mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] fs/select: check return value of poll_select_set_timeout()
@ 2022-08-23  5:47 lily
  0 siblings, 0 replies; only message in thread
From: lily @ 2022-08-23  5:47 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel; +Cc: viro, lily

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

Signed-off-by: Li Zhong <floridsleeves@gmail.com>
---
 fs/select.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/select.c b/fs/select.c
index 0ee55af1a55c..d9febe1b846b 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -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);
-- 
2.25.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-23  5:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-23  5:47 [PATCH v1] fs/select: check return value of poll_select_set_timeout() lily

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®