summaryrefslogtreecommitdiffstats
path: root/src/socket_wrapper.c
diff options
context:
space:
mode:
authorAnoop C S <anoopcs@redhat.com>2018-06-15 12:36:54 +0530
committerAndreas Schneider <asn@samba.org>2018-08-09 10:59:11 +0200
commit8ba0d9cf9769579f3c68f78b33477c10aa133e8c (patch)
tree18e6dd7c1f2ed11e0f095ea135db1c5ac8d0e011 /src/socket_wrapper.c
parent4d732f6d037cfc2ca3c44c51081163b1d3e06b17 (diff)
downloadsocket_wrapper-8ba0d9cf9769579f3c68f78b33477c10aa133e8c.tar.gz
socket_wrapper-8ba0d9cf9769579f3c68f78b33477c10aa133e8c.tar.xz
socket_wrapper-8ba0d9cf9769579f3c68f78b33477c10aa133e8c.zip
swrap: Fix thread deadlock found by Coverity scan
CID 175897 CID 175898 Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'src/socket_wrapper.c')
-rw-r--r--src/socket_wrapper.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index d9076f6..1a91c0e 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -4656,13 +4656,14 @@ static ssize_t swrap_sendmsg_before(int fd,
if (si->bound == 0) {
ret = swrap_auto_bind(fd, si, si->family);
if (ret == -1) {
+ SWRAP_UNLOCK_SI(si);
if (errno == ENOTSOCK) {
swrap_remove_stale(fd);
ret = -ENOTSOCK;
} else {
SWRAP_LOG(SWRAP_LOG_ERROR, "swrap_sendmsg_before failed");
}
- goto out;
+ return ret;
}
}
@@ -4866,6 +4867,7 @@ static int swrap_recvmsg_before(int fd,
if (si->bound == 0) {
ret = swrap_auto_bind(fd, si, si->family);
if (ret == -1) {
+ SWRAP_UNLOCK_SI(si);
/*
* When attempting to read or write to a
* descriptor, if an underlying autobind fails
@@ -4879,7 +4881,7 @@ static int swrap_recvmsg_before(int fd,
SWRAP_LOG(SWRAP_LOG_ERROR,
"swrap_recvmsg_before failed");
}
- goto out;
+ return ret;
}
}
break;