diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-01-01 13:24:47 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-01-01 14:04:51 +0100 |
commit | 6b8fa52806b2a7bb443ccf9153b5328b741f68db (patch) | |
tree | 687aa80419ad0cb0b0a42a24f28ba85274cb72b8 /pflocal | |
parent | 1589f5fbe8fd87858d1a06517db5a7baae918f4f (diff) | |
download | hurd-6b8fa52806b2a7bb443ccf9153b5328b741f68db.tar.gz hurd-6b8fa52806b2a7bb443ccf9153b5328b741f68db.tar.bz2 hurd-6b8fa52806b2a7bb443ccf9153b5328b741f68db.zip |
pflocal: Fix unsafe increment of refs
Diffstat (limited to 'pflocal')
-rw-r--r-- | pflocal/sock.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pflocal/sock.c b/pflocal/sock.c index 2acf5f4e..174494cd 100644 --- a/pflocal/sock.c +++ b/pflocal/sock.c @@ -356,7 +356,11 @@ addr_get_sock (struct addr *addr, struct sock **sock) pthread_mutex_lock (&addr->lock); *sock = addr->sock; if (*sock) - (*sock)->refs++; + { + pthread_mutex_lock (&(*sock)->lock); + (*sock)->refs++; + pthread_mutex_unlock (&(*sock)->lock); + } pthread_mutex_unlock (&addr->lock); return *sock ? 0 : EADDRNOTAVAIL; } |