Skip to content
Medium 4.4

bpf: Fix NULL task dereference in task work cancellation

CVE-2026-139346 First seen on SecPulse

Affected packages

PackageAffected → Fixed
LinuxLinux —
LinuxKernel
≥ 6.18.0, < 6.18.65→ 6.18.65
≥ 6.19.0, < 7.3.6→ 7.3.6

Fix status by distribution

Records published by each distribution for this CVE. Fixed versions differ by release; check each link.

Original description The description as published by the source.

In the Linux kernel, the following vulnerability has been resolved:

bpf: Fix NULL task dereference in task work cancellation

bpf_task_work_irq() publishes ctx->work with task_work_add() before
changing the context from SCHEDULING to SCHEDULED. The target task can
run the callback on another CPU before the handler reaches its final
state transition.

The handler then reloads ctx->task for cancellation if its final cmpxchg
observes FREED. By that point the callback or context destruction may
already have cleared ctx->task, causing task_work_cancel() to dereference
a NULL task pointer.

One concrete interleaving is:

  1. CPU 0 changes PENDING to SCHEDULING and successfully queues
    ctx->work with task_work_add(), but has not attempted the final
    state cmpxchg.

  2. The target task on CPU 1 runs the callback. It changes SCHEDULING
    to RUNNING, executes the BPF subprogram, resets ctx->task,
    publishes STANDBY and drops the callback's context reference.

  3. CPU 2 deletes the map value. It changes STANDBY to FREED and drops
    the map's context reference without queuing asynchronous
    cancellation.

  4. CPU 0 resumes. Its SCHEDULING-to-SCHEDULED cmpxchg observes FREED,
    and the cancellation attempt passes NULL to task_work_cancel().

If deletion publishes FREED before the callback claims RUNNING, the
callback takes its FREED exit and drops its context reference. Context
destruction can then clear ctx->task before CPU 0 attempts cancellation.

A c…

Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory

References

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details