Skip to content
Heist/ feed
High

bpf, sockmap: Avoid using sk_socket after free when sending

Type: advisorySource: Official CVE List1 source record

In the Linux kernel, the following vulnerability has been resolved: bpf, sockmap: Avoid using sk_socket after free when sending The sk->sk_socket is not locked or referenced in backlog thread, and during the call to skb_send_sock(), there is a race condition with the release of sk_socket. All types of sockets(tcp/udp/unix/vsock) will be affected. Race conditions: ''' CPU0 CPU1 backlog::skb_send_sock sendmsg_unlocked sock_sendmsg sock_sendmsg_nosec close(fd): ... ops->release() -> sock_map_close() sk_socket->ops = NULL free(socket) sock->ops->sendmsg ^ panic here ''' The ref of psock become 0 after sock_map_close() executed. ''' void sock_map_close() { ... if (likely(psock)) { ... // !! here we remove psock and the ref of psock become 0 sock_map_remove_links(sk, psock) psock = sk_psock_get(sk); if (unlikely(!psock)) goto no_psock; <=== Control jumps here via goto ... cancel_delayed_work_sync(&psock->work); <=== not executed sk_psock_put(sk, psock); ... } ''' Based on the fact that we already wait for the workqueue to finish in sock_map_close() if psock is held, we simply increase the psock reference count to avoid race conditions. With this patch, if the backlog thread is running, sock_map_close() will wait for the backlog thread to complete and cancel all pending work. If no backlog running, any pending work that hasn't started by then will fail when invoked by sk_psock_get(), as the psock reference count have been zeroed, and sk_psock_drop() will cancel all jobs via cancel_d

Announced Source revision 1
Original source ↗

CVE-2025-38154

Primary source · Revision 1

Imported from structured advisory data. Source references identify upstream records or fields; verify affected versions and your deployed configuration.

Security context

Source reference: cve:CVE-2025-38154

Linux

Source reference: /containers/cna/affected/0/product

Affected versions
Not stated in this record
Fixed versions
Not stated in this record
Prerequisites
Not stated in this record

Linux

Source reference: /containers/cna/affected/1/product

Affected versions
Not stated in this record
Fixed versions
Not stated in this record
Prerequisites
Not stated in this record

Structured affected-version data

Original package identities and version rules from this source.

[
  {
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "vendor": "Linux",
    "product": "Linux",
    "versions": [
      {
        "status": "affected",
        "version": "4959ffc65a0e94f8acaac20deac49f89e6ded52d",
        "lessThan": "4edb40b05cb6a261775abfd8046804ca139a5546",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "5eabdf17fed2ad41b836bb4055ec36d95e512c50",
        "lessThan": "b19cbf0b9a91f5a0d93fbcd761ff71c48ab40ed9",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "e946428439a0d2079959f5603256ac51b6047017",
        "lessThan": "4c6fa65ab2aec7df94809478c8d28ef38676a1b7",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "4b4647add7d3c8530493f7247d11e257ee425bf0",
        "lessThan": "15c0250dae3b48a398447d2b364603821ed4ed90",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "4b4647add7d3c8530493f7247d11e257ee425bf0",
        "lessThan": "7c0a16f6ea2b1c82a03bccd5d1bdb4a7bbd4d987",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "4b4647add7d3c8530493f7247d11e257ee425bf0",
        "lessThan": "8259eb0e06d8f64c700f5fbdb28a5c18e10de291",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "3627605de498639a3c586c8684d12c89cba11073",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "5.15.162",
        "lessThan": "5.15.186",
        "versionType": "semver"
      },
      {
        "status": "affected",
        "version": "6.1.95",
        "lessThan": "6.1.142",
        "versionType": "semver"
      },
      {
        "status": "affected",
        "version": "6.6.35",
        "lessThan": "6.6.94",
        "versionType": "semver"
      },
      {
        "status": "affected",
        "version": "6.9.6",
        "lessThan": "6.10",
        "versionType": "semver"
      }
    ],
    "programFiles": [
      "net/core/skmsg.c"
    ],
    "defaultStatus": "unaffected"
  },
  {
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "vendor": "Linux",
    "product": "Linux",
    "versions": [
      {
        "status": "affected",
        "version": "6.10"
      },
      {
        "status": "unaffected",
        "version": "0",
        "lessThan": "6.10",
        "versionType": "semver"
      },
      {
        "status": "unaffected",
        "version": "5.15.186",
        "versionType": "semver",
        "lessThanOrEqual": "5.15.*"
      },
      {
        "status": "unaffected",
        "version": "6.1.142",
        "versionType": "semver",
        "lessThanOrEqual": "6.1.*"
      },
      {
        "status": "unaffected",
        "version": "6.6.94",
        "versionType": "semver",
        "lessThanOrEqual": "6.6.*"
      },
      {
        "status": "unaffected",
        "version": "6.12.34",
        "versionType": "semver",
        "lessThanOrEqual": "6.12.*"
      },
      {
        "status": "unaffected",
        "version": "6.15.3",
        "versionType": "semver",
        "lessThanOrEqual": "6.15.*"
      },
      {
        "status": "unaffected",
        "version": "6.16",
        "versionType": "original_commit_for_fix",
        "lessThanOrEqual": "*"
      }
    ],
    "programFiles": [
      "net/core/skmsg.c"
    ],
    "defaultStatus": "affected"
  }
]
Related CVEs
CVE-2025-38154

Source reference: /cveMetadata/cveId

Publisher severity

high

Source reference: /containers/cna/metrics

Event
#30530 · Revision 1
Added to Heist Feed
Publisher date
Read the original announcement