summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-11-14 14:34:39 +0100
committerThomas Haller <thaller@redhat.com>2017-11-14 15:10:42 +0100
commit79482c9a9ec2c33d79a647329d475019d7dd4f0e (patch)
tree1bf7ae1676755a242149771e34e45ebbab97dfa1
parent5b29c2e5b93c30347919b40e0885280fdb83c1a5 (diff)
downloadNetworkManager-79482c9a9ec2c33d79a647329d475019d7dd4f0e.tar.gz
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.
-rw-r--r--src/platform/nm-linux-platform.c1
1 files changed, 0 insertions, 1 deletions
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,