summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-10-03 15:41:29 +0200
committerThomas Haller <thaller@redhat.com>2018-10-11 05:56:18 +0200
commit9aa628cedb707e9c4f0e0dba437ec22375a0032e (patch)
tree422ca24d3feaeaa9d805d3241b87c30a77392af9
parent1f856b7cb3dc1f229753d3a14acb26a8316ba13d (diff)
downloadNetworkManager-9aa628cedb707e9c4f0e0dba437ec22375a0032e.tar.gz
ndisc: keep NMNDisc instance alive while processing IO in event_ready()
event_ready() calls ndp_callall_eventfd_handler(), which invokes our own callback, which may invoke change notification. At that point, it's not guaranteed that the signal handler won't destroy the ndisc instance, which means, the "struct ndp" gets destroyed while invoking callbacks. That's bad, because libndp is not robust against that. Ensure the object stays alive long enough.
-rw-r--r--src/ndisc/nm-lndp-ndisc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/ndisc/nm-lndp-ndisc.c b/src/ndisc/nm-lndp-ndisc.c
index c0a0cd4096..8d237e86c7 100644
--- a/src/ndisc/nm-lndp-ndisc.c
+++ b/src/ndisc/nm-lndp-ndisc.c
@@ -491,6 +491,7 @@ receive_rs (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data)
static gboolean
event_ready (GIOChannel *source, GIOCondition condition, NMNDisc *ndisc)
{
+ gs_unref_object NMNDisc *ndisc_keep_alive = g_object_ref (ndisc);
nm_auto_pop_netns NMPNetns *netns = NULL;
NMLndpNDiscPrivate *priv = NM_LNDP_NDISC_GET_PRIVATE ((NMLndpNDisc *) ndisc);