smbd: Remove callback for release_ip when "state" is free'ed
commitddf47e7fe314e0f5bf71ff53e35350e0ba530d08
authorVolker Lendecke <vl@samba.org>
Thu, 12 Oct 2023 15:19:45 +0000 (12 17:19 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 15 Dec 2023 11:06:34 +0000 (15 11:06 +0000)
tree3b544d996df7832a5a3a84e3a8c7dc238caf48ea
parent082c7df4d04c2a94c5413c1d6b7eae7be610f950
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>
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