1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
samba-mirror/ctdb/common
Rusty Russell 9e84872ecd ctdb_io: fix use-after-free on invalid packets
Wolfgang saw a talloc complaint about using freed memory in ctdb_tcp_read_cb.
His fix was to remove the talloc_free() in that function, which causes
loops when a socket is closed (as it does not get removed from the event
system), eg:
	netcat 192.168.1.2 4379 < /dev/null

The real bug is that when we have more than one pending packet in the
queue, we loop calling the callback without any safeguards should that
callback free the queue (as it tends to do on invalid packets).  This
can be reproduced by sending more than one bogus packet at once:
	# Length word at start: 4 == empty packet (assumed little endian)
	/usr/bin/printf \\4\\0\\0\\0\\4\\0\\0\\0 > /tmp/pkt
	netcat 192.168.1.2 4379 < /tmp/pkt

Using a destructor we can check if the callback frees us, and exit
immediately.  Elsewhere, we return after the callback anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(This used to be ctdb commit 4d0523dd94fb07e860b3e8118691f93d1ef8d0fa)
2009-12-02 11:27:23 +11:00
..
cmdline.c update the handling of debug levels so that we always can use a literal instead of a numeric value. 2009-07-01 09:17:13 +10:00
ctdb_io.c ctdb_io: fix use-after-free on invalid packets 2009-12-02 11:27:23 +11:00
ctdb_logging.c make the ringbuffer logging more efficient and marshall the data by writing to a tmpfile instead of continously talloc resizing a blob 2009-11-18 19:10:50 +11:00
ctdb_ltdb.c we don't need ctdb_ltdb_persistent_store() any more 2008-07-30 19:58:03 +10:00
ctdb_message.c When we dispatch a message to a handler, pass the data as a real talloc object so that the handler can talloc_steal() the message content. 2009-07-02 12:58:49 +10:00
ctdb_util.c update the handling of debug levels so that we always can use a literal instead of a numeric value. 2009-07-01 09:17:13 +10:00
rb_tree.c merge from ronnie 2008-02-04 20:07:15 +11:00
rb_tree.h add a function to return the first entry that is stored in a tree where 2007-08-15 10:57:21 +10:00
system_aix.c move common code of system_linux.c and system_aix.c into new system_common.c 2009-02-28 03:08:31 +01:00
system_common.c move common code of system_linux.c and system_aix.c into new system_common.c 2009-02-28 03:08:31 +01:00
system_linux.c lower the debug levels for the "create FD messages" so we dont fill up the logs. 2009-10-21 15:26:24 +11:00