smbd: Remove callback for release_ip when "state" is free'ed
authorVolker Lendecke <vl@samba.org>
Thu, 12 Oct 2023 15:19:45 +0000 (17:19 +0200)
committerJule Anger <janger@samba.org>
Sat, 16 Dec 2023 15:07:15 +0000 (15:07 +0000)
commit2640bae75e3abab1a9959b2de14dad29020852de
tree4ae29181af1f9c37b04205705fe98407107fe74c
parent43b7068676a00a5169ac6f34e97a1bacf8d0c29d
smbd: Remove callback for release_ip when "state" is free'ed

If a client connects to a non-public address first followed by a connect
to public address with the same client_guid and a connection to
the non-public address gets disconnected first, we hit by a use-after-free
talloc_get_type_abort() called from release_ip() as
"xconn" is already gone, taking smbd_release_ip_state with it.

We need to decide between calling ctdbd_unregister_ips() by default, as
it means the tcp connection is really gone and ctdb needs to remove the
'tickle' information.  But when a connection was passed to a different
smbd process, we need to use ctdbd_passed_ips() as the tcp connection is
still alive and the 'tickle' information should not be removed within
ctdb.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15523

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit ddf47e7fe314e0f5bf71ff53e35350e0ba530d08)
selftest/flapping.d/smbXsrv_client_ctdb_registered_ips [deleted file]
selftest/knownfail.d/smbXsrv_client_ctdb_registered_ips [deleted file]
source3/smbd/smb2_negprot.c
source3/smbd/smb2_process.c