Skip to content
Heist/ feed
Back to feed
UnratedFix available

net: openvswitch: remove never-working support for setting nsh fields

Type: advisorySources: OSV

In the Linux kernel, the following vulnerability has been resolved: net: openvswitch: remove never-working support for setting nsh fields The validation of the set(nsh(...)) action is completely wrong. It runs through the nsh_key_put_from_nlattr() function that is the same function that validates NSH keys for the flow match and the push_nsh() action. However, the set(nsh(...)) has a very different memory layout. Nested attributes in there are doubled in size in case of the masked set(). That makes proper validation impossible. There is also confusion in the code between the 'masked' flag, that says that the nested attributes are doubled in size containing both the value and the mask, and the 'is_mask' that says that the value we're parsing is the mask. This is causing kernel crash on trying to write into mask part of the match with SW_FLOW_KEY_PUT() during validation, while validate_nsh() doesn't allocate any memory for it: BUG: kernel NULL pointer dereference, address: 0000000000000018 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 1c2383067 P4D 1c2383067 PUD 20b703067 PMD 0 Oops: Oops: 0000 [#1] SMP NOPTI CPU: 8 UID: 0 Kdump: loaded Not tainted 6.17.0-rc4+ #107 PREEMPT(voluntary) RIP: 0010:nsh_key_put_from_nlattr+0x19d/0x610 [openvswitch] Call Trace: validate_nsh+0x60/0x90 [openvswitch] validate_set.constprop.0+0x270/0x3c0 [openvswitch] __ovs_nla_copy_actions+0x477/0x860 [openvswitch] ovs_nla_copy_actions+0x8d/0x100 [openvswitch] o

Products
Kernel
Affected versions
Not specified
Fixed versions
5.10.247, 5.15.197, 5.4.302, 6.1.159, 6.12.60, 6.17.10, 6.6.118
CVEs
CVE-2025-40254
Confirmed fixed CVEs
Not specified
Updated in this feed
4 Nov 2026, 13:24 UTC · Revision 1

Source evidence

net: openvswitch: remove never-working support for setting nsh fields

core-osv · Original source

Published 4 Dec 2025, 16:08 UTC

In the Linux kernel, the following vulnerability has been resolved: net: openvswitch: remove never-working support for setting nsh fields The validation of the set(nsh(...)) action is completely wrong. It runs through the nsh_key_put_from_nlattr() function that is the same function that validates NSH keys for the flow match and the push_nsh() action. However, the set(nsh(...)) has a very different memory layout. Nested attributes in there are doubled in size in case of the masked set(). That makes proper validation impossible. There is also confusion in the code between the 'masked' flag, that says that the nested attributes are doubled in size containing both the value and the mask, and the 'is_mask' that says that the value we're parsing is the mask. This is causing kernel crash on trying to write into mask part of the match with SW_FLOW_KEY_PUT() during validation, while validate_nsh() doesn't allocate any memory for it: BUG: kernel NULL pointer dereference, address: 0000000000000018 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 1c2383067 P4D 1c2383067 PUD 20b703067 PMD 0 Oops: Oops: 0000 [#1] SMP NOPTI CPU: 8 UID: 0 Kdump: loaded Not tainted 6.17.0-rc4+ #107 PREEMPT(voluntary) RIP: 0010:nsh_key_put_from_nlattr+0x19d/0x610 [openvswitch] Call Trace: validate_nsh+0x60/0x90 [openvswitch] validate_set.constprop.0+0x270/0x3c0 [openvswitch] __ovs_nla_copy_actions+0x477/0x860 [openvswitch] ovs_nla_copy_actions+0x8d/0x100 [openvswitch] o

osv:CVE-2025-40254

Kernel

Fixed versions: 5.4.302, 5.10.247, 5.15.197, 6.1.159, 6.6.118, 6.12.60, 6.17.10

Complete source record
{
  "id": "c3febfa4acab6c36b5e06041f4b2c2e2ff9fa5444a36463c156053d688f41fd3",
  "url": "https://osv.dev/vulnerability/CVE-2025-40254",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "net: openvswitch: remove never-working support for setting nsh fields",
    "summary": "In the Linux kernel, the following vulnerability has been resolved: net: openvswitch: remove never-working support for setting nsh fields The validation of the set(nsh(...)) action is completely wrong. It runs through the nsh_key_put_from_nlattr() function that is the same function that validates NSH keys for the flow match and the push_nsh() action. However, the set(nsh(...)) has a very different memory layout. Nested attributes in there are doubled in size in case of the masked set(). That makes proper validation impossible. There is also confusion in the code between the 'masked' flag, that says that the nested attributes are doubled in size containing both the value and the mask, and the 'is_mask' that says that the value we're parsing is the mask. This is causing kernel crash on trying to write into mask part of the match with SW_FLOW_KEY_PUT() during validation, while validate_nsh() doesn't allocate any memory for it: BUG: kernel NULL pointer dereference, address: 0000000000000018 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 1c2383067 P4D 1c2383067 PUD 20b703067 PMD 0 Oops: Oops: 0000 [#1] SMP NOPTI CPU: 8 UID: 0 Kdump: loaded Not tainted 6.17.0-rc4+ #107 PREEMPT(voluntary) RIP: 0010:nsh_key_put_from_nlattr+0x19d/0x610 [openvswitch] Call Trace: validate_nsh+0x60/0x90 [openvswitch] validate_set.constprop.0+0x270/0x3c0 [openvswitch] __ovs_nla_copy_actions+0x477/0x860 [openvswitch] ovs_nla_copy_actions+0x8d/0x100 [openvswitch] o",
    "evidence": "osv:CVE-2025-40254",
    "products": [
      {
        "name": {
          "value": "Kernel",
          "evidence": "/affected/1/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "5.4.302",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "5.10.247",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "5.15.197",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "6.1.159",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "6.6.118",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "6.12.60",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "6.17.10",
            "evidence": "/affected/1/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "unknown",
    "structured": {
      "id": "CVE-2025-40254",
      "aliases": [
        "CVE-2025-40254"
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
              "type": "GIT",
              "events": [
                {
                  "introduced": "b2d0f5d5dc53532e6f07bc546a476a55ebdfe0f3"
                },
                {
                  "fixed": "3415faa1fcb4150f29a72c5ecf959339d797feb7"
                },
                {
                  "fixed": "3d2e7d3b28469081ccf08301df07cc411a1cc5e9"
                },
                {
                  "fixed": "f95bef5ba0b88d971b02c776f24bd17544930a3a"
                },
                {
                  "fixed": "87d2429381ddcf8cbd30c8c36793a4f7916d5f99"
                },
                {
                  "fixed": "0b903f33c31c82b1c3591279fd8a23893802b987"
                },
                {
                  "fixed": "9c61d8fe1350b7322f4953318165d6719c3b1475"
                },
                {
                  "fixed": "4689ba45296dbb3a47e70a1bc2ed0328263e48f3"
                },
                {
                  "fixed": "dfe28c4167a9259fc0c372d9f9473e1ac95cff67"
                }
              ]
            }
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-40254.json"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "4.15.0"
                },
                {
                  "fixed": "5.4.302"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "5.5.0"
                },
                {
                  "fixed": "5.10.247"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "5.11.0"
                },
                {
                  "fixed": "5.15.197"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "5.16.0"
                },
                {
                  "fixed": "6.1.159"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "6.2.0"
                },
                {
                  "fixed": "6.6.118"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "6.7.0"
                },
                {
                  "fixed": "6.12.60"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "6.13.0"
                },
                {
                  "fixed": "6.17.10"
                }
              ]
            }
          ],
          "package": {
            "name": "Kernel",
            "ecosystem": "Linux"
          },
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-40254.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:35.688887494Z",
      "provider": "osv",
      "references": [
        "https://cert-portal.siemens.com/productcert/html/ssa-253495.html",
        "https://git.kernel.org/stable/c/0b903f33c31c82b1c3591279fd8a23893802b987",
        "https://git.kernel.org/stable/c/3415faa1fcb4150f29a72c5ecf959339d797feb7",
        "https://git.kernel.org/stable/c/3d2e7d3b28469081ccf08301df07cc411a1cc5e9",
        "https://git.kernel.org/stable/c/4689ba45296dbb3a47e70a1bc2ed0328263e48f3",
        "https://git.kernel.org/stable/c/87d2429381ddcf8cbd30c8c36793a4f7916d5f99",
        "https://git.kernel.org/stable/c/9c61d8fe1350b7322f4953318165d6719c3b1475",
        "https://git.kernel.org/stable/c/dfe28c4167a9259fc0c372d9f9473e1ac95cff67",
        "https://git.kernel.org/stable/c/f95bef5ba0b88d971b02c776f24bd17544930a3a",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/40xxx/CVE-2025-40254.json",
        "https://nvd.nist.gov/vuln/detail/CVE-2025-40254",
        "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
      ],
      "provider_metadata": {
        "cna_assigner": "Linux",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/40xxx/CVE-2025-40254.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2025-40254",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": null
  },
  "source_id": "core-osv",
  "document_id": 503056,
  "published_at": "2025-12-04T16:08:16.305+00:00"
}