From 6631debaa32d42c8e45f24a696c2e033d525c061 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 3 Oct 2018 15:44:36 +0200 Subject: [PATCH] ndisc: abort handling IO in event_ready() if we are unable to switch namespace It should never happen that we are unable to switch the namespace. However, in case it does, we cannot just return G_SOURCE_CONTINUE, because we will just endlessly trying to process IO without actually reading from the socket. This shouldn't happen, but the instance is hosed and something is very wrong. No longer handle the socket to avoid an endless loop. (cherry picked from commit d444fcde34f06711208494a65cd0ea9b9ba2c592) --- src/ndisc/nm-lndp-ndisc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ndisc/nm-lndp-ndisc.c b/src/ndisc/nm-lndp-ndisc.c index 8d237e86c7..8bb1812764 100644 --- a/src/ndisc/nm-lndp-ndisc.c +++ b/src/ndisc/nm-lndp-ndisc.c @@ -497,8 +497,11 @@ event_ready (GIOChannel *source, GIOCondition condition, NMNDisc *ndisc) _LOGD ("processing libndp events"); - if (!nm_ndisc_netns_push (ndisc, &netns)) - return G_SOURCE_CONTINUE; + if (!nm_ndisc_netns_push (ndisc, &netns)) { + /* something is very wrong. Stop handling events. */ + priv->event_id = 0; + return G_SOURCE_REMOVE; + } ndp_callall_eventfd_handler (priv->ndp); return G_SOURCE_CONTINUE;