summaryrefslogtreecommitdiff
path: root/source3/lib/ctdbd_conn.c
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@samba.org>2019-09-03 15:26:19 +0200
committerNoel Power <npower@samba.org>2019-09-04 14:20:16 +0000
commit9173ae5f7f02d2f1675d505ee3da7e62cceeafd0 (patch)
treea42d250df7c81ba4ed0225f002ff3c09c05fd575 /source3/lib/ctdbd_conn.c
parent123267138e993c6a87990c0022e89f4970c0ac12 (diff)
downloadsamba-9173ae5f7f02d2f1675d505ee3da7e62cceeafd0.tar.gz
s3/lib/ctdbd_conn: assert hdr following read/recv
ctdb_pkt_recv_recv() and ctdb_read_packet() give us a non-null hdr on success, so drop the error path check in favour of an assert. This fixes a regression in 3913b9a4088b83d6ed7f94d136a26ecfa7e16b35, where tevent_req_error() may be skipped in the ctdbd_parse_done() ctdb_pkt_recv_recv() error path. Reported-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Noel Power <npower@samba.org> Autobuild-User(master): Noel Power <npower@samba.org> Autobuild-Date(master): Wed Sep 4 14:20:16 UTC 2019 on sn-devel-184
Diffstat (limited to 'source3/lib/ctdbd_conn.c')
-rw-r--r--source3/lib/ctdbd_conn.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 8a8fbec4552..843e57287b6 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -404,11 +404,12 @@ static int ctdb_read_req(struct ctdbd_connection *conn, uint32_t reqid,
next_pkt:
ret = ctdb_read_packet(conn->fd, conn->timeout, mem_ctx, &hdr);
- if (hdr == NULL || ret != 0) {
+ if (ret != 0) {
DBG_ERR("ctdb_read_packet failed: %s\n", strerror(ret));
cluster_fatal("failed to read data from ctdbd\n");
return -1;
}
+ SMB_ASSERT(hdr != NULL);
DEBUG(11, ("Received ctdb packet\n"));
ctdb_packet_dump(hdr);
@@ -605,6 +606,7 @@ void ctdbd_socket_readable(struct tevent_context *ev,
DBG_ERR("ctdb_read_packet failed: %s\n", strerror(ret));
cluster_fatal("failed to read data from ctdbd\n");
}
+ SMB_ASSERT(hdr != NULL);
ret = ctdb_handle_message(ev, conn, hdr);
@@ -1086,6 +1088,7 @@ int ctdbd_traverse(struct ctdbd_connection *conn, uint32_t db_id,
DBG_ERR("ctdb_read_packet failed: %s\n", strerror(ret));
cluster_fatal("failed to read data from ctdbd\n");
}
+ SMB_ASSERT(hdr != NULL);
if (hdr->operation != CTDB_REQ_MESSAGE) {
DEBUG(0, ("Got operation %u, expected a message\n",
@@ -1946,10 +1949,11 @@ static void ctdbd_parse_done(struct tevent_req *subreq)
ret = ctdb_pkt_recv_recv(subreq, state, &hdr);
TALLOC_FREE(subreq);
- if ((hdr == NULL) || tevent_req_error(req, ret)) {
+ if (tevent_req_error(req, ret)) {
DBG_ERR("ctdb_pkt_recv_recv returned %s\n", strerror(ret));
return;
}
+ SMB_ASSERT(hdr != NULL);
if (hdr->operation != CTDB_REPLY_CALL) {
DBG_ERR("received invalid reply\n");