CVE-2024-14040 (GCVE-0-2024-14040)
Vulnerability from cvelistv5 – Published: 2026-07-26 06:30 – Updated: 2026-07-26 06:30
VLAI
EPSS
VEX
Title
net: nexthop: Increase weight to u16
Summary
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
No CVSS data available.
Assigner
References
1 reference
Impacted products
{
"containers": {
"cna": {
"affected": [
{
"defaultStatus": "unaffected",
"product": "Linux",
"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",
"vendor": "Linux",
"versions": [
{
"lessThan": "b72a6a7ab9573e06d5c2fcb92eaa28614a735bfd",
"status": "affected",
"version": "1da177e4c3f41524e886b7f1b8a0c1fc7321cac2",
"versionType": "git"
}
]
},
{
"defaultStatus": "affected",
"product": "Linux",
"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",
"vendor": "Linux",
"versions": [
{
"lessThanOrEqual": "*",
"status": "unaffected",
"version": "6.12",
"versionType": "original_commit_for_fix"
}
]
}
],
"cpeApplicability": [
{
"nodes": [
{
"cpeMatch": [
{
"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
"versionEndExcluding": "6.12",
"vulnerable": true
}
],
"negate": false,
"operator": "OR"
}
]
}
],
"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 \u003e8-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."
}
],
"providerMetadata": {
"dateUpdated": "2026-07-26T06:30:17.607Z",
"orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"shortName": "Linux"
},
"references": [
{
"url": "https://git.kernel.org/stable/c/b72a6a7ab9573e06d5c2fcb92eaa28614a735bfd"
}
],
"title": "net: nexthop: Increase weight to u16",
"x_generator": {
"engine": "bippy-1.2.0"
}
}
},
"cveMetadata": {
"assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"assignerShortName": "Linux",
"cveId": "CVE-2024-14040",
"datePublished": "2026-07-26T06:30:17.607Z",
"dateReserved": "2026-07-26T06:29:25.532Z",
"dateUpdated": "2026-07-26T06:30:17.607Z",
"state": "PUBLISHED"
},
"dataType": "CVE_RECORD",
"dataVersion": "5.2",
"vulnerability-lookup:meta": {
"nvd": "{\"cve\":{\"id\":\"CVE-2024-14040\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2026-07-26T07:16:39.583\",\"lastModified\":\"2026-07-26T07:16:39.583\",\"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 \u003e8-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.\"}],\"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\":\"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2\",\"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\":\"6.12\",\"lessThanOrEqual\":\"*\",\"versionType\":\"original_commit_for_fix\",\"status\":\"unaffected\"}]}]}],\"metrics\":{},\"references\":[{\"url\":\"https://git.kernel.org/stable/c/b72a6a7ab9573e06d5c2fcb92eaa28614a735bfd\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"}]}}"
}
}
Loading…
Loading…
Experimental. This forecast is provided for visualization only and may change without notice. Do not use it for operational decisions.
Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Loading…
The MITRE ATT&CK techniques below are AI-generated suggestions, inferred from the description of the
vulnerability by the CIRCL/vulnerability-attack-technique-classification-roberta-base
model, served locally by ML-Gateway.
They have not been verified by an analyst and are provided for guidance only.
Loading…
Loading…