UPSTREAM: um: sigio: Return error from add_sigio_fd()

If we run out of space, return an error instead of 0.

Bug: 176213565
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
(cherry picked from commit d66c91836b)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I49c7b93b79f086ca21968c90b4e740048abe8e59
This commit is contained in:
Johannes Berg
2020-11-23 20:44:02 +01:00
committed by Greg Kroah-Hartman
parent 06156034f4
commit b96ba1e7ff

View File

@@ -167,15 +167,17 @@ static void update_thread(void)
int add_sigio_fd(int fd)
{
struct pollfd *p;
int err = 0, i, n;
int err, i, n;
sigio_lock();
for (i = 0; i < all_sigio_fds.used; i++) {
if (all_sigio_fds.poll[i].fd == fd)
break;
}
if (i == all_sigio_fds.used)
if (i == all_sigio_fds.used) {
err = -ENOSPC;
goto out;
}
p = &all_sigio_fds.poll[i];