Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9bf084f7 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds
Browse files

do_poll: return -EINTR when signalled



do_poll() checks signal_pending() but returns 0 when interrupted.  This means
the caller has to check signal_pending() again.

Change it to return -EINTR when signal_pending() and count == 0.

Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
Cc: Andi Kleen <ak@suse.de>
Cc: Davide Libenzi <davidel@xmailserver.org>
Cc: Vadim Lobanov <vlobanov@speakeasy.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 252e5725
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -616,10 +616,12 @@ static int do_poll(unsigned int nfds, struct poll_list *list,
		 * a poll_table to them on the next loop iteration.
		 * a poll_table to them on the next loop iteration.
		 */
		 */
		pt = NULL;
		pt = NULL;
		if (count || !*timeout || signal_pending(current))
		if (!count) {
			break;
			count = wait->error;
			count = wait->error;
		if (count)
			if (signal_pending(current))
				count = -EINTR;
		}
		if (count || !*timeout)
			break;
			break;


		if (*timeout < 0) {
		if (*timeout < 0) {
@@ -689,8 +691,6 @@ int do_sys_poll(struct pollfd __user *ufds, unsigned int nfds, s64 *timeout)


	poll_initwait(&table);
	poll_initwait(&table);
	fdcount = do_poll(nfds, head, &table, timeout);
	fdcount = do_poll(nfds, head, &table, timeout);
	if (!fdcount && signal_pending(current))
		fdcount = -EINTR;
	poll_freewait(&table);
	poll_freewait(&table);


	for (walk = head; walk; walk = walk->next) {
	for (walk = head; walk; walk = walk->next) {