From: Martin Schwenke Date: Fri, 21 Jan 2022 01:14:05 +0000 (+1100) Subject: ctdb-locking: Don't pass NULL to tevent_req_is_unix_error() X-Git-Tag: talloc-2.3.4~279 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d52b497d11a2d5d82fabc8d20d656682af2f3c9d;p=thirdparty%2Fsamba.git ctdb-locking: Don't pass NULL to tevent_req_is_unix_error() If there is an error then this pointer is unconditionally dereferenced. However, the only possible error appears to be ENOMEM, where a crash caused by dereferencing a NULL pointer isn't a terrible outcome. In the absence of a security issue this is probably not worth backporting. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/server/ctdb_lock_helper.c b/ctdb/server/ctdb_lock_helper.c index 6b6fbbe27a5..51d2992b64e 100644 --- a/ctdb/server/ctdb_lock_helper.c +++ b/ctdb/server/ctdb_lock_helper.c @@ -230,9 +230,9 @@ static void wait_for_parent_check(struct tevent_req *subreq) tevent_req_set_callback(subreq, wait_for_parent_check, req); } -static bool wait_for_parent_recv(struct tevent_req *req) +static bool wait_for_parent_recv(struct tevent_req *req, int *perr) { - if (tevent_req_is_unix_error(req, NULL)) { + if (tevent_req_is_unix_error(req, perr)) { return false; } @@ -273,6 +273,7 @@ int main(int argc, char *argv[]) int ppid; const char *lock_type; bool status; + int err; reset_scheduler(); @@ -336,9 +337,11 @@ int main(int argc, char *argv[]) tevent_req_poll(req, ev); - status = wait_for_parent_recv(req); + status = wait_for_parent_recv(req, &err); if (! status) { - fprintf(stderr, "locking: wait_for_parent_recv() failed\n"); + fprintf(stderr, + "locking: wait_for_parent_recv() failed (%d)\n", + err); } talloc_free(ev);