[SCM] Samba Shared Repository - branch master updated

Noel Power npower at samba.org
Wed Sep 4 14:21:02 UTC 2019


The branch, master has been updated
       via  9173ae5f7f0 s3/lib/ctdbd_conn: assert hdr following read/recv
      from  123267138e9 tevent: Release tevent 0.10.1

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 9173ae5f7f02d2f1675d505ee3da7e62cceeafd0
Author: David Disseldorp <ddiss at samba.org>
Date:   Tue Sep 3 15:26:19 2019 +0200

    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 at samba.org>
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Noel Power <npower at samba.org>
    
    Autobuild-User(master): Noel Power <npower at samba.org>
    Autobuild-Date(master): Wed Sep  4 14:20:16 UTC 2019 on sn-devel-184

-----------------------------------------------------------------------

Summary of changes:
 source3/lib/ctdbd_conn.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

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");


-- 
Samba Shared Repository



More information about the samba-cvs mailing list