mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
libplugin: allow aux_command use in init()
Because we initalized plugin->io_rpc_conn *after* calling plugin->init, send_outreq would do a (harmless, in our case) wakeup on an uninitialized address: ``` ==1164079== Conditional jump or move depends on uninitialised value(s) ==1164079== at 0x1628FC: backend_wake (poll.c:227) ==1164079== by 0x160B98: io_wake (io.c:384) ==1164079== by 0x1160A8: ld_rpc_send (libplugin.c:255) ==1164079== by 0x1187E0: send_outreq (libplugin.c:1099) ==1164079== by 0x115041: init (xpay.c:1620) ``` Solution is simple: set plugin->io_rpc_conn to NULL, and don't wake it in this case. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
64c1522597
commit
090d605527
@ -253,7 +253,8 @@ static void ld_rpc_send(struct plugin *plugin, struct json_stream *stream)
|
||||
struct jstream *jstr = tal(plugin, struct jstream);
|
||||
jstr->js = tal_steal(jstr, stream);
|
||||
list_add_tail(&plugin->rpc_js_list, &jstr->list);
|
||||
io_wake(plugin->io_rpc_conn);
|
||||
if (plugin->io_rpc_conn)
|
||||
io_wake(plugin->io_rpc_conn);
|
||||
}
|
||||
|
||||
|
||||
@ -2376,6 +2377,7 @@ static struct plugin *new_plugin(const tal_t *ctx,
|
||||
/* Async RPC */
|
||||
p->rpc_buffer = tal_arr(p, char, 64);
|
||||
list_head_init(&p->rpc_js_list);
|
||||
p->io_rpc_conn = NULL;
|
||||
p->rpc_used = 0;
|
||||
p->rpc_read_offset = 0;
|
||||
p->rpc_len_read = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user