Skip to content
Heist/ feed
Back to feed
UnratedFix available

mm/mempolicy: fix memory leaks in weighted_interleave_auto_store()

Type: advisorySources: OSV

In the Linux kernel, the following vulnerability has been resolved: mm/mempolicy: fix memory leaks in weighted_interleave_auto_store() weighted_interleave_auto_store() fetches old_wi_state inside the if (!input) block only. This causes two memory leaks: 1. When a user writes "false" and the current mode is already manual, the function returns early without freeing the freshly allocated new_wi_state. 2. When a user writes "true", old_wi_state stays NULL because the fetch is skipped entirely. The old state is then overwritten by rcu_assign_pointer() but never freed, since the cleanup path is gated on old_wi_state being non-NULL. A user can trigger this repeatedly by writing "1" in a loop. Fix both leaks by moving the old_wi_state fetch before the input check, making it unconditional. This also allows a unified early return for both "true" and "false" when the requested mode matches the current mode. Reviewed by: Donet Tom

Products
Kernel
Affected versions
Not specified
Fixed versions
6.18.27, 7.0.4
CVEs
CVE-2026-46042
Confirmed fixed CVEs
Not specified
Updated in this feed
8 Nov 2026, 01:49 UTC · Revision 1

Source evidence

mm/mempolicy: fix memory leaks in weighted_interleave_auto_store()

core-osv · Original source

Published 27 May 2026, 12:56 UTC

In the Linux kernel, the following vulnerability has been resolved: mm/mempolicy: fix memory leaks in weighted_interleave_auto_store() weighted_interleave_auto_store() fetches old_wi_state inside the if (!input) block only. This causes two memory leaks: 1. When a user writes "false" and the current mode is already manual, the function returns early without freeing the freshly allocated new_wi_state. 2. When a user writes "true", old_wi_state stays NULL because the fetch is skipped entirely. The old state is then overwritten by rcu_assign_pointer() but never freed, since the cleanup path is gated on old_wi_state being non-NULL. A user can trigger this repeatedly by writing "1" in a loop. Fix both leaks by moving the old_wi_state fetch before the input check, making it unconditional. This also allows a unified early return for both "true" and "false" when the requested mode matches the current mode. Reviewed by: Donet Tom

osv:CVE-2026-46042

Kernel

Fixed versions: 6.18.27, 7.0.4

Complete source record
{
  "id": "031c0c60a78455bbf0624b8cd66eb2324f53bed54bf29f178974ed295c2d4189",
  "url": "https://osv.dev/vulnerability/CVE-2026-46042",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "mm/mempolicy: fix memory leaks in weighted_interleave_auto_store()",
    "summary": "In the Linux kernel, the following vulnerability has been resolved: mm/mempolicy: fix memory leaks in weighted_interleave_auto_store() weighted_interleave_auto_store() fetches old_wi_state inside the if (!input) block only. This causes two memory leaks: 1. When a user writes \"false\" and the current mode is already manual, the function returns early without freeing the freshly allocated new_wi_state. 2. When a user writes \"true\", old_wi_state stays NULL because the fetch is skipped entirely. The old state is then overwritten by rcu_assign_pointer() but never freed, since the cleanup path is gated on old_wi_state being non-NULL. A user can trigger this repeatedly by writing \"1\" in a loop. Fix both leaks by moving the old_wi_state fetch before the input check, making it unconditional. This also allows a unified early return for both \"true\" and \"false\" when the requested mode matches the current mode. Reviewed by: Donet Tom",
    "evidence": "osv:CVE-2026-46042",
    "products": [
      {
        "name": {
          "value": "Kernel",
          "evidence": "/affected/1/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "6.18.27",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "7.0.4",
            "evidence": "/affected/1/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "unknown",
    "structured": {
      "id": "CVE-2026-46042",
      "aliases": [
        "CVE-2026-46042"
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
              "type": "GIT",
              "events": [
                {
                  "introduced": "e341f9c3c8412e57fe0042a33a2640245ecdf619"
                },
                {
                  "fixed": "c42a7efb9060d89b72708ffaf255d0002c2164a7"
                },
                {
                  "fixed": "39caa9ca863f96b3d00447c5aa200cabda489856"
                },
                {
                  "fixed": "6fae274ce0e3109cbbc4c18b354eaace1f0af7d7"
                }
              ]
            }
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-46042.json"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "6.16.0"
                },
                {
                  "fixed": "6.18.27"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "6.19.0"
                },
                {
                  "fixed": "7.0.4"
                }
              ]
            }
          ],
          "package": {
            "name": "Kernel",
            "ecosystem": "Linux"
          },
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-46042.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:52.762620050Z",
      "provider": "osv",
      "references": [
        "https://git.kernel.org/stable/c/39caa9ca863f96b3d00447c5aa200cabda489856",
        "https://git.kernel.org/stable/c/6fae274ce0e3109cbbc4c18b354eaace1f0af7d7",
        "https://git.kernel.org/stable/c/c42a7efb9060d89b72708ffaf255d0002c2164a7",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/46xxx/CVE-2026-46042.json",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-46042",
        "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/2026/46xxx/CVE-2026-46042.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-46042",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": null
  },
  "source_id": "core-osv",
  "document_id": 521504,
  "published_at": "2026-05-27T12:56:56.83+00:00"
}