← Back to CVE Explorer

CVE-2024-14040

Full vulnerability record from the local CVENow database.

Description

In the Linux kernel, the following vulnerability has been resolved: net: nexthop: Increase weight to u16 In CLOS networks, as link failures occur at various points in the network, ECMP weights of the involved nodes are adjusted to compensate. With high fan-out of the involved nodes, and overall high number of nodes, a (non-)ECMP weight ratio that we would like to configure does not fit into 8 bits. Instead of, say, 255:254, we might like to configure something like 1000:999. For these deployments, the 8-bit weight may not be enough. To that end, in this patch increase the next hop weight from u8 to u16. Increasing the width of an integral type can be tricky, because while the code still compiles, the types may not check out anymore, and numerical errors come up. To prevent this, the conversion was done in two steps. First the type was changed from u8 to a single-member structure, which invalidated all uses of the field. This allowed going through them one by one and audit for type correctness. Then the structure was replaced with a vanilla u16 again. This should ensure that no place was missed. The UAPI for configuring nexthop group members is that an attribute NHA_GROUP carries an array of struct nexthop_grp entries: struct nexthop_grp { __u32 id; /* nexthop id - must exist */ __u8 weight; /* weight of this nexthop */ __u8 resvd1; __u16 resvd2; }; The field resvd1 is currently validated and required to be zero. We can lift this requirement and carry high-order bits of the weight in the reserved field: struct nexthop_grp { __u32 id; /* nexthop id - must exist */ __u8 weight; /* weight of this nexthop */ __u8 weight_high; __u16 resvd2; }; Keeping the fields split this way was chosen in case an existing userspace makes assumptions about the width of the weight field, and to sidestep any endianness issues. The weight field is currently encoded as the weight value minus one, because weight of 0 is invalid. This same trick is impossible for the new weight_high field, because zero must mean actual zero. With this in place: - Old userspace is guaranteed to carry weight_high of 0, therefore configuring 8-bit weights as appropriate. When dumping nexthops with 16-bit weight, it would only show the lower 8 bits. But configuring such nexthops implies existence of userspace aware of the extension in the first place. - New userspace talking to an old kernel will work as long as it only attempts to configure 8-bit weights, where the high-order bits are zero. Old kernel will bounce attempts at configuring >8-bit weights. Renaming reserved fields as they are allocated for some purpose is commonly done in Linux. Whoever touches a reserved field is doing so at their own risk. nexthop_grp::resvd1 in particular is currently used by at least strace, however they carry an own copy of UAPI headers, and the conversion should be trivial. A helper is provided for decoding the weight out of the two fields. Forcing a conversion seems preferable to bending backwards and introducing anonymous unions or whatever.

Severity
HIGH
CVSS score
7.8 (v3.1)
Vulnerability status
Received
Source identifier
416baaa9-dc9f-4396-8d5f-8c081fb06d67
Published
2026-07-26 07:16:39.583000
Last modified
2026-10-30 13:17:20.013000
View original CVE JSON
{
  "id": "CVE-2024-14040",
  "sourceIdentifier": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
  "published": "2026-07-26T07:16:39.583",
  "lastModified": "2026-10-30T13:17:20.013",
  "vulnStatus": "Received",
  "cveTags": [],
  "descriptions": [
    {
      "lang": "en",
      "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nnet: nexthop: Increase weight to u16\n\nIn CLOS networks, as link failures occur at various points in the network,\nECMP weights of the involved nodes are adjusted to compensate. With high\nfan-out of the involved nodes, and overall high number of nodes,\na (non-)ECMP weight ratio that we would like to configure does not fit into\n8 bits. Instead of, say, 255:254, we might like to configure something like\n1000:999. For these deployments, the 8-bit weight may not be enough.\n\nTo that end, in this patch increase the next hop weight from u8 to u16.\n\nIncreasing the width of an integral type can be tricky, because while the\ncode still compiles, the types may not check out anymore, and numerical\nerrors come up. To prevent this, the conversion was done in two steps.\nFirst the type was changed from u8 to a single-member structure, which\ninvalidated all uses of the field. This allowed going through them one by\none and audit for type correctness. Then the structure was replaced with a\nvanilla u16 again. This should ensure that no place was missed.\n\nThe UAPI for configuring nexthop group members is that an attribute\nNHA_GROUP carries an array of struct nexthop_grp entries:\n\n\tstruct nexthop_grp {\n\t\t__u32\tid;\t  /* nexthop id - must exist */\n\t\t__u8\tweight;   /* weight of this nexthop */\n\t\t__u8\tresvd1;\n\t\t__u16\tresvd2;\n\t};\n\nThe field resvd1 is currently validated and required to be zero. We can\nlift this requirement and carry high-order bits of the weight in the\nreserved field:\n\n\tstruct nexthop_grp {\n\t\t__u32\tid;\t  /* nexthop id - must exist */\n\t\t__u8\tweight;   /* weight of this nexthop */\n\t\t__u8\tweight_high;\n\t\t__u16\tresvd2;\n\t};\n\nKeeping the fields split this way was chosen in case an existing userspace\nmakes assumptions about the width of the weight field, and to sidestep any\nendianness issues.\n\nThe weight field is currently encoded as the weight value minus one,\nbecause weight of 0 is invalid. This same trick is impossible for the new\nweight_high field, because zero must mean actual zero. With this in place:\n\n- Old userspace is guaranteed to carry weight_high of 0, therefore\n  configuring 8-bit weights as appropriate. When dumping nexthops with\n  16-bit weight, it would only show the lower 8 bits. But configuring such\n  nexthops implies existence of userspace aware of the extension in the\n  first place.\n\n- New userspace talking to an old kernel will work as long as it only\n  attempts to configure 8-bit weights, where the high-order bits are zero.\n  Old kernel will bounce attempts at configuring >8-bit weights.\n\nRenaming reserved fields as they are allocated for some purpose is commonly\ndone in Linux. Whoever touches a reserved field is doing so at their own\nrisk. nexthop_grp::resvd1 in particular is currently used by at least\nstrace, however they carry an own copy of UAPI headers, and the conversion\nshould be trivial. A helper is provided for decoding the weight out of the\ntwo fields. Forcing a conversion seems preferable to bending backwards and\nintroducing anonymous unions or whatever."
    },
    {
      "lang": "es",
      "value": "En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\nnet: nexthop: Aumentar el peso a u16\n\nEn las redes CLOS, a medida que ocurren fallos de enlace en varios puntos de la red, los pesos ECMP de los nodos involucrados se ajustan para compensar. Con una alta ramificación de los nodos involucrados y un número total elevado de nodos, una relación de peso (no-)ECMP que nos gustaría configurar no cabe en 8 bits. En lugar de, digamos, 255:254, podríamos querer configurar algo como 1000:999. Para estas implementaciones, el peso de 8 bits podría no ser suficiente.\n\nCon ese fin, en este parche se aumenta el peso del siguiente salto de u8 a u16.\n\nAumentar el ancho de un tipo integral puede ser complicado, porque si bien el código aún compila, los tipos podrían ya no coincidir y surgen errores numéricos. Para evitar esto, la conversión se realizó en dos pasos. Primero, el tipo se cambió de u8 a una estructura de un solo miembro, lo que invalidó todos los usos del campo. Esto permitió revisarlos uno por uno y auditar la corrección del tipo. Luego, la estructura fue reemplazada por un u16 estándar nuevamente. Esto debería asegurar que no se omitió ningún lugar.\n\nLa UAPI para configurar los miembros del grupo nexthop es que un atributo NHA_GROUP lleva un array de entradas de struct nexthop_grp:\n\n\tstruct nexthop_grp {\n\t\t__u32\tid;\t  /* id de nexthop - debe existir */\n\t\t__u8\tweight;   /* peso de este nexthop */\n\t\t__u8\tresvd1;\n\t\t__u16\tresvd2;\n\t};\n\nEl campo resvd1 está actualmente validado y se requiere que sea cero. Podemos levantar este requisito y llevar los bits de orden superior del peso en el campo reservado:\n\n\tstruct nexthop_grp {\n\t\t__u32\tid;\t  /* id de nexthop - debe existir */\n\t\t__u8\tweight;   /* peso de este nexthop */\n\t\t__u8\tweight_high;\n\t\t__u16\tresvd2;\n\t};\n\nSe eligió mantener los campos divididos de esta manera en caso de que un userspace existente haga suposiciones sobre el ancho del campo de peso, y para evitar cualquier problema de endianness.\n\nEl campo de peso está actualmente codificado como el valor del peso menos uno, porque un peso de 0 es inválido. Este mismo truco es imposible para el nuevo campo weight_high, porque cero debe significar cero real. Con esto implementado:\n\n- Se garantiza que el userspace antiguo llevará un weight_high de 0, por lo tanto, configurando pesos de 8 bits según corresponda. Al volcar nexthops con peso de 16 bits, solo mostraría los 8 bits inferiores. Pero configurar tales nexthops implica la existencia de un userspace consciente de la extensión en primer lugar.\n\n- El nuevo userspace que se comunica con un kernel antiguo funcionará siempre y cuando solo intente configurar pesos de 8 bits, donde los bits de orden superior son cero. El kernel antiguo rechazará los intentos de configurar pesos >8 bits.\n\nRenombrar campos reservados a medida que se asignan para algún propósito es algo común en Linux. Quien toque un campo reservado lo hace bajo su propio riesgo. nexthop_grp::resvd1 en particular es actualmente utilizado por al menos strace, sin embargo, llevan una copia propia de los encabezados UAPI, y la conversión debería ser trivial. Se proporciona una función de ayuda para decodificar el peso de los dos campos. Forzar una conversión parece preferible a hacer malabares e introducir uniones anónimas o lo que sea."
    }
  ],
  "affected": [
    {
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
      "affectedData": [
        {
          "vendor": "Linux",
          "product": "Linux",
          "defaultStatus": "unaffected",
          "programFiles": [
            "include/net/nexthop.h",
            "include/uapi/linux/nexthop.h",
            "net/ipv4/nexthop.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "versions": [
            {
              "version": "283a72a5599e80750699d2021830a294ed9ab3f3",
              "lessThan": "f9d682935afe102d6b7060914304c04483d6cbd6",
              "versionType": "git",
              "status": "affected"
            },
            {
              "version": "283a72a5599e80750699d2021830a294ed9ab3f3",
              "lessThan": "2860d59e4ce2bb428c8cecd3b95585012910b7d0",
              "versionType": "git",
              "status": "affected"
            },
            {
              "version": "283a72a5599e80750699d2021830a294ed9ab3f3",
              "lessThan": "b72a6a7ab9573e06d5c2fcb92eaa28614a735bfd",
              "versionType": "git",
              "status": "affected"
            }
          ]
        },
        {
          "vendor": "Linux",
          "product": "Linux",
          "defaultStatus": "affected",
          "programFiles": [
            "include/net/nexthop.h",
            "include/uapi/linux/nexthop.h",
            "net/ipv4/nexthop.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "versions": [
            {
              "version": "5.13",
              "status": "affected"
            },
            {
              "version": "0",
              "lessThan": "5.13",
              "versionType": "semver",
              "status": "unaffected"
            },
            {
              "version": "6.1.191",
              "lessThanOrEqual": "6.1.*",
              "versionType": "semver",
              "status": "unaffected"
            },
            {
              "version": "6.6.160",
              "lessThanOrEqual": "6.6.*",
              "versionType": "semver",
              "status": "unaffected"
            },
            {
              "version": "6.12",
              "lessThanOrEqual": "*",
              "versionType": "original_commit_for_fix",
              "status": "unaffected"
            }
          ]
        }
      ]
    }
  ],
  "metrics": {
    "cvssMetricV31": [
      {
        "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "type": "Secondary",
        "cvssData": {
          "version": "3.1",
          "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
          "baseScore": 7.8,
          "baseSeverity": "HIGH",
          "attackVector": "LOCAL",
          "attackComplexity": "LOW",
          "privilegesRequired": "LOW",
          "userInteraction": "NONE",
          "scope": "UNCHANGED",
          "confidentialityImpact": "HIGH",
          "integrityImpact": "HIGH",
          "availabilityImpact": "HIGH"
        },
        "exploitabilityScore": 1.8,
        "impactScore": 5.9
      }
    ],
    "ssvcV203": [
      {
        "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
        "ssvcData": {
          "timestamp": "2026-10-15T21:40:23.769784Z",
          "id": "CVE-2024-14040",
          "options": [
            {
              "exploitation": "none"
            },
            {
              "automatable": "no"
            },
            {
              "technicalImpact": "total"
            }
          ],
          "role": "CISA Coordinator",
          "version": "2.0.3"
        }
      }
    ]
  },
  "weaknesses": [
    {
      "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
      "type": "Secondary",
      "description": [
        {
          "lang": "en",
          "value": "CWE-787"
        }
      ]
    }
  ],
  "references": [
    {
      "url": "https://git.kernel.org/stable/c/2860d59e4ce2bb428c8cecd3b95585012910b7d0",
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
    },
    {
      "url": "https://git.kernel.org/stable/c/b72a6a7ab9573e06d5c2fcb92eaa28614a735bfd",
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
    },
    {
      "url": "https://git.kernel.org/stable/c/f9d682935afe102d6b7060914304c04483d6cbd6",
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
    }
  ]
}