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 14:29:10 +0000 (14:29 +0000)
commit279187965b8b2adbd2939bf2a9e587edce04431d
tree74d90c1087d3025bdd644cd14ae1db7bf80f75e8
parentf8c02609f4807435cbdee1d1433429a549fc981e
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