diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-01-05 01:32:49 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-01-05 01:32:49 +0100 |
commit | 05a15f8c43e7a167983f19bd866b90158661703e (patch) | |
tree | a71d747f75f2155f49eb04e32ef0066b0a89dd4c /pfinet | |
parent | 89c9590e020e1372cfab037b7789aaef89b4f544 (diff) | |
download | hurd-05a15f8c43e7a167983f19bd866b90158661703e.tar.gz hurd-05a15f8c43e7a167983f19bd866b90158661703e.tar.bz2 hurd-05a15f8c43e7a167983f19bd866b90158661703e.zip |
lwip,pfinet: Fix crash on make_sock_user getting EINTR
_ports_create_port_internal may return EINTR.
* lwip/port-objs.c (make_sock_user): Set errno when ports_create_port
returns an error.
* pfinet/socket.c (make_sock_user): Likewise.
* lwip/io-ops.c (lwip_S_io_reauthenticate): Loop while make_sock_user
errors with EINTR.
* pfinet/io-ops.c (S_io_reauthenticate): Likewise.
Diffstat (limited to 'pfinet')
-rw-r--r-- | pfinet/io-ops.c | 9 | ||||
-rw-r--r-- | pfinet/socket.c | 5 |
2 files changed, 12 insertions, 2 deletions
diff --git a/pfinet/io-ops.c b/pfinet/io-ops.c index e0e1875b..c1b6e5b5 100644 --- a/pfinet/io-ops.c +++ b/pfinet/io-ops.c @@ -374,7 +374,14 @@ S_io_reauthenticate (struct sock_user *user, aux_gids = agbuf; pthread_mutex_lock (&global_lock); - newuser = make_sock_user (user->sock, 0, 1, 0); + do + newuser = make_sock_user (user->sock, 0, 1, 0); + while (!newuser && errno == EINTR); + if (!newuser) + { + pthread_mutex_unlock (&global_lock); + return 0; + } auth = getauth (); newright = ports_get_send_right (newuser); diff --git a/pfinet/socket.c b/pfinet/socket.c index 4a12426c..059520ae 100644 --- a/pfinet/socket.c +++ b/pfinet/socket.c @@ -81,7 +81,10 @@ make_sock_user (struct socket *sock, int isroot, int noinstall, int consume) err = ports_create_port (socketport_class, pfinet_bucket, sizeof (struct sock_user), &user); if (err) - return 0; + { + errno = err; + return 0; + } /* We maintain a reference count in `struct socket' (a member not in the original Linux structure), because there can be multiple |