Skip to content
Heist/ feed
Back to feed
HighFix available

nfc: nci: add flush_workqueue to prevent uaf

Type: advisorySources: OSV

In the Linux kernel, the following vulnerability has been resolved: nfc: nci: add flush_workqueue to prevent uaf Our detector found a concurrent use-after-free bug when detaching an NCI device. The main reason for this bug is the unexpected scheduling between the used delayed mechanism (timer and workqueue). The race can be demonstrated below: Thread-1 Thread-2 | nci_dev_up() | nci_open_device() | __nci_request(nci_reset_req) | nci_send_cmd | queue_work(cmd_work) nci_unregister_device() | nci_close_device() | ... del_timer_sync(cmd_timer)[1] | ... | Worker nci_free_device() | nci_cmd_work() kfree(ndev)[3] | mod_timer(cmd_timer)[2] In short, the cleanup routine thought that the cmd_timer has already been detached by [1] but the mod_timer can re-attach the timer [2], even it is already released [3], resulting in UAF. This UAF is easy to trigger, crash trace by POC is like below [ 66.703713] ================================================================== [ 66.703974] BUG: KASAN: use-after-free in enqueue_timer+0x448/0x490 [ 66.703974] Write of size 8 at addr ffff888009fb7058 by task kworker/u4:1/33 [ 66.703974] [ 66.703974] CPU: 1 PID: 33 Comm: kworker/u4:1 Not tainted 5.18.0-rc2 #5 [ 66.703974] Workqueue: nfc2_nci_cmd_wq nci_cmd_work [ 66.703974] Call Trace: [ 66.703974] [ 66.703974] dump_stack_lvl+0x57/0x7d [ 66.703974] print_report.cold+0x5e/0x5db [ 66.703974] ? enqueue_timer+0x448/0x490 [ 66.703974] kasan_report+0xbe/0x1c0 [ 66.703974] ? enqueue_timer+0x448/0x490 [ 66.703

Products
Kernel
Affected versions
Not specified
Fixed versions
4.14.276, 4.19.239, 4.9.311, 5.10.112, 5.15.35, 5.17.4, 5.4.190
CVEs
CVE-2022-49059
Confirmed fixed CVEs
Not specified
Updated in this feed
4 Nov 2026, 17:53 UTC · Revision 1

Source evidence

nfc: nci: add flush_workqueue to prevent uaf

core-osv · Original source

Published 26 Feb 2025, 01:54 UTC

In the Linux kernel, the following vulnerability has been resolved: nfc: nci: add flush_workqueue to prevent uaf Our detector found a concurrent use-after-free bug when detaching an NCI device. The main reason for this bug is the unexpected scheduling between the used delayed mechanism (timer and workqueue). The race can be demonstrated below: Thread-1 Thread-2 | nci_dev_up() | nci_open_device() | __nci_request(nci_reset_req) | nci_send_cmd | queue_work(cmd_work) nci_unregister_device() | nci_close_device() | ... del_timer_sync(cmd_timer)[1] | ... | Worker nci_free_device() | nci_cmd_work() kfree(ndev)[3] | mod_timer(cmd_timer)[2] In short, the cleanup routine thought that the cmd_timer has already been detached by [1] but the mod_timer can re-attach the timer [2], even it is already released [3], resulting in UAF. This UAF is easy to trigger, crash trace by POC is like below [ 66.703713] ================================================================== [ 66.703974] BUG: KASAN: use-after-free in enqueue_timer+0x448/0x490 [ 66.703974] Write of size 8 at addr ffff888009fb7058 by task kworker/u4:1/33 [ 66.703974] [ 66.703974] CPU: 1 PID: 33 Comm: kworker/u4:1 Not tainted 5.18.0-rc2 #5 [ 66.703974] Workqueue: nfc2_nci_cmd_wq nci_cmd_work [ 66.703974] Call Trace: [ 66.703974] [ 66.703974] dump_stack_lvl+0x57/0x7d [ 66.703974] print_report.cold+0x5e/0x5db [ 66.703974] ? enqueue_timer+0x448/0x490 [ 66.703974] kasan_report+0xbe/0x1c0 [ 66.703974] ? enqueue_timer+0x448/0x490 [ 66.703

osv:CVE-2022-49059

Kernel

Fixed versions: 4.9.311, 4.14.276, 4.19.239, 5.4.190, 5.10.112, 5.15.35, 5.17.4

Complete source record
{
  "id": "730642a792b221c3b4d4c72475645698f424948b3acea7161342dc51ca9a9c33",
  "url": "https://osv.dev/vulnerability/CVE-2022-49059",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "nfc: nci: add flush_workqueue to prevent uaf",
    "summary": "In the Linux kernel, the following vulnerability has been resolved: nfc: nci: add flush_workqueue to prevent uaf Our detector found a concurrent use-after-free bug when detaching an NCI device. The main reason for this bug is the unexpected scheduling between the used delayed mechanism (timer and workqueue). The race can be demonstrated below: Thread-1 Thread-2 | nci_dev_up() | nci_open_device() | __nci_request(nci_reset_req) | nci_send_cmd | queue_work(cmd_work) nci_unregister_device() | nci_close_device() | ... del_timer_sync(cmd_timer)[1] | ... | Worker nci_free_device() | nci_cmd_work() kfree(ndev)[3] | mod_timer(cmd_timer)[2] In short, the cleanup routine thought that the cmd_timer has already been detached by [1] but the mod_timer can re-attach the timer [2], even it is already released [3], resulting in UAF. This UAF is easy to trigger, crash trace by POC is like below [ 66.703713] ================================================================== [ 66.703974] BUG: KASAN: use-after-free in enqueue_timer+0x448/0x490 [ 66.703974] Write of size 8 at addr ffff888009fb7058 by task kworker/u4:1/33 [ 66.703974] [ 66.703974] CPU: 1 PID: 33 Comm: kworker/u4:1 Not tainted 5.18.0-rc2 #5 [ 66.703974] Workqueue: nfc2_nci_cmd_wq nci_cmd_work [ 66.703974] Call Trace: [ 66.703974] [ 66.703974] dump_stack_lvl+0x57/0x7d [ 66.703974] print_report.cold+0x5e/0x5db [ 66.703974] ? enqueue_timer+0x448/0x490 [ 66.703974] kasan_report+0xbe/0x1c0 [ 66.703974] ? enqueue_timer+0x448/0x490 [ 66.703",
    "evidence": "osv:CVE-2022-49059",
    "products": [
      {
        "name": {
          "value": "Kernel",
          "evidence": "/affected/1/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "4.9.311",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "4.14.276",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "4.19.239",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "5.4.190",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "5.10.112",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "5.15.35",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "5.17.4",
            "evidence": "/affected/1/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "high",
    "structured": {
      "id": "CVE-2022-49059",
      "aliases": [
        "CVE-2022-49059"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
              "type": "GIT",
              "events": [
                {
                  "introduced": "6a2968aaf50c7a22fced77a5e24aa636281efca8"
                },
                {
                  "fixed": "7d3232214ca4ea8f7d18df264c3b254aa8089d7f"
                },
                {
                  "fixed": "9d243aff5f7e6b04e907c617426bbdf26e996ac8"
                },
                {
                  "fixed": "1a1748d0dd0f0a98535c6baeef671c8722107639"
                },
                {
                  "fixed": "5c63ad2b0a267a524c12c88acb1ba9c2d109a801"
                },
                {
                  "fixed": "67677050cecbe0edfdd81cd508415e9636ba7c65"
                },
                {
                  "fixed": "9ded5ae40f4fe37fcc28f36d76bf45df20be5432"
                },
                {
                  "fixed": "edd4600120641e1714e30112e69a548cfb68e067"
                },
                {
                  "fixed": "ef27324e2cb7bb24542d6cb2571740eefe6b00dc"
                }
              ]
            }
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-49059.json"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "3.2.0"
                },
                {
                  "fixed": "4.9.311"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "4.10.0"
                },
                {
                  "fixed": "4.14.276"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "4.15.0"
                },
                {
                  "fixed": "4.19.239"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "4.20.0"
                },
                {
                  "fixed": "5.4.190"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "5.5.0"
                },
                {
                  "fixed": "5.10.112"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "5.11.0"
                },
                {
                  "fixed": "5.15.35"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "5.16.0"
                },
                {
                  "fixed": "5.17.4"
                }
              ]
            }
          ],
          "package": {
            "name": "Kernel",
            "ecosystem": "Linux"
          },
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-49059.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:38.477702512Z",
      "provider": "osv",
      "references": [
        "https://git.kernel.org/stable/c/1a1748d0dd0f0a98535c6baeef671c8722107639",
        "https://git.kernel.org/stable/c/5c63ad2b0a267a524c12c88acb1ba9c2d109a801",
        "https://git.kernel.org/stable/c/67677050cecbe0edfdd81cd508415e9636ba7c65",
        "https://git.kernel.org/stable/c/7d3232214ca4ea8f7d18df264c3b254aa8089d7f",
        "https://git.kernel.org/stable/c/9d243aff5f7e6b04e907c617426bbdf26e996ac8",
        "https://git.kernel.org/stable/c/9ded5ae40f4fe37fcc28f36d76bf45df20be5432",
        "https://git.kernel.org/stable/c/edd4600120641e1714e30112e69a548cfb68e067",
        "https://git.kernel.org/stable/c/ef27324e2cb7bb24542d6cb2571740eefe6b00dc",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/49xxx/CVE-2022-49059.json",
        "https://nvd.nist.gov/vuln/detail/CVE-2022-49059",
        "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/2022/49xxx/CVE-2022-49059.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2022-49059",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 505522,
  "published_at": "2025-02-26T01:54:29.819+00:00"
}