From 388742d79164edb9d09a83b57f0a73323e90ce05 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 6 Jul 2022 13:53:06 +0930 Subject: [PATCH] channeld: fix uninitializes scid alias for dual-funding. Caused a crash in CI, reproduced under valgrind by calling any_channel_by_scid from io_poll_lightningd: ``` ==2422524== Conditional jump or move depends on uninitialised value(s) ==2422524== at 0x12C98D: any_channel_by_scid (channel.c:606) ==2422524== by 0x14FF75: io_poll_lightningd (lightningd.c:682) ==2422524== by 0x225FDE: io_loop (poll.c:420) ==2422524== by 0x14A914: io_loop_with_timers (io_loop_with_timers.c:22) ==2422524== by 0x150C4E: main (lightningd.c:1193) ==2422524== Uninitialised value was created by a heap allocation ==2422524== at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==2422524== by 0x234F61: allocate (tal.c:250) ==2422524== by 0x235522: tal_alloc_ (tal.c:428) ==2422524== by 0x12B500: new_unsaved_channel (channel.c:203) ==2422524== by 0x13B77A: json_openchannel_init (dual_open_control.c:2610) ==2422524== by 0x14C78D: command_exec (jsonrpc.c:630) ==2422524== by 0x14CD9F: rpc_command_hook_final (jsonrpc.c:765) ==2422524== by 0x181DDA: plugin_hook_call_ (plugin_hook.c:278) ==2422524== by 0x14D198: plugin_hook_call_rpc_command (jsonrpc.c:853) ==2422524== by 0x14D6A0: parse_request (jsonrpc.c:957) ==2422524== by 0x14DAFE: read_json (jsonrpc.c:1054) ==2422524== by 0x2231C8: next_plan (io.c:59) ``` Signed-off-by: Rusty Russell --- lightningd/channel.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lightningd/channel.c b/lightningd/channel.c index 92c6f809dc26..e1f059bc4752 100644 --- a/lightningd/channel.c +++ b/lightningd/channel.c @@ -237,6 +237,7 @@ struct channel *new_unsaved_channel(struct peer *peer, channel->shutdown_wrong_funding = NULL; channel->closing_feerate_range = NULL; channel->channel_update = NULL; + channel->alias[LOCAL] = channel->alias[REMOTE] = NULL; /* Channel is connected! */ channel->connected = true;