summaryrefslogtreecommitdiff
path: root/src/platform/wifi
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2015-08-06 14:26:05 +0200
committerThomas Haller <thaller@redhat.com>2015-08-11 18:31:46 +0200
commitab41c13b0611c6cc967b055d328637a143b5c59b (patch)
tree5a9aafd65acfbc6de0f66b9e24cc235f9102bf66 /src/platform/wifi
parentbfb459f8edd1b5ff42768fc91cb8cc652ed6012d (diff)
downloadNetworkManager-ab41c13b0611c6cc967b055d328637a143b5c59b.tar.gz
core: avoid ioctls on non existent devices
Performing an ioctl on a non existent device may cause the automatic load of a kernel module if the device name matches a module alias. Check if the device actually exists before calling the ioctl.
Diffstat (limited to 'src/platform/wifi')
-rw-r--r--src/platform/wifi/wifi-utils-wext.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/platform/wifi/wifi-utils-wext.c b/src/platform/wifi/wifi-utils-wext.c
index 0d7488b3ed..96bcf53d26 100644
--- a/src/platform/wifi/wifi-utils-wext.c
+++ b/src/platform/wifi/wifi-utils-wext.c
@@ -33,6 +33,7 @@
#include "wifi-utils-private.h"
#include "wifi-utils-wext.h"
#include "nm-utils.h"
+#include "nm-platform-utils.h"
/* Hacks necessary to #include wireless.h; yay for WEXT */
#ifndef __user
@@ -662,6 +663,9 @@ wifi_wext_is_wifi (const char *iface)
struct iwreq iwr;
gboolean is_wifi = FALSE;
+ if (!nmp_utils_device_exists (iface))
+ return FALSE;
+
fd = socket (PF_INET, SOCK_DGRAM, 0);
if (fd >= 0) {
strncpy (iwr.ifr_ifrn.ifrn_name, iface, IFNAMSIZ);