summaryrefslogtreecommitdiff
path: root/src/udev/udev-builtin-net_id.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2016-01-25 20:28:38 +0100
committerTom Gundersen <teg@jklm.no>2016-01-25 20:28:38 +0100
commitf49ce89edf37a20abed923782dd8176d6c0e7166 (patch)
tree5174563e958ef5be22eebd7d9b848d37e724a911 /src/udev/udev-builtin-net_id.c
parent164228707d7785a27316e2f28be7068044127016 (diff)
parent6c1e69f9456d022f14dd00737126cfa4d9cca10c (diff)
Merge pull request #2392 from poettering/dnssec18
eightteenth dnssec patch
Diffstat (limited to 'src/udev/udev-builtin-net_id.c')
-rw-r--r--src/udev/udev-builtin-net_id.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index e83b8b1c12..104d5111c5 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -106,6 +106,8 @@
#include "string-util.h"
#include "udev.h"
+#define ONBOARD_INDEX_MAX (16*1024-1)
+
enum netname_type{
NET_UNDEF,
NET_PCI,
@@ -152,6 +154,13 @@ static int dev_pci_onboard(struct udev_device *dev, struct netnames *names) {
if (idx <= 0)
return -EINVAL;
+ /* Some BIOSes report rubbish indexes that are excessively high (2^24-1 is an index VMware likes to report for
+ * example). Let's define a cut-off where we don't consider the index reliable anymore. We pick some arbitrary
+ * cut-off, which is somewhere beyond the realistic number of physical network interface a system might
+ * have. Ideally the kernel would already filter his crap for us, but it doesn't currently. */
+ if (idx > ONBOARD_INDEX_MAX)
+ return -ENOENT;
+
/* kernel provided port index for multiple ports on a single PCI function */
attr = udev_device_get_sysattr_value(dev, "dev_port");
if (attr)