From 39002a4e3c1b8d59d54faff56ec9aab3952aa80f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 14 Nov 2017 14:34:39 +0100 Subject: [PATCH] platform: fix double closing netlink socket The file descriptor is owned by the netlink socket instance, which we close in finalize. We most not close it when destroying the IO channel, otherwise the file descriptor gets closed twice. Closing an invalid file descriptor (or a descriptor that is already closed) is a serious bug, because the integer values are re-used, so there is a race that the close might affect an innocent file descriptor instead of just failing with EBADF. (cherry picked from commit 79482c9a9ec2c33d79a647329d475019d7dd4f0e) --- src/platform/nm-linux-platform.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 3d319ab205..359c3baf3a 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -6758,7 +6758,6 @@ constructed (GObject *_object) priv->event_channel = g_io_channel_unix_new (nl_socket_get_fd (priv->nlh)); g_io_channel_set_encoding (priv->event_channel, NULL, NULL); - g_io_channel_set_close_on_unref (priv->event_channel, TRUE); channel_flags = g_io_channel_get_flags (priv->event_channel); status = g_io_channel_set_flags (priv->event_channel,