Skip to content
Heist/ feed
Back to feed
HighFix available

media: mtk-jpeg: Fix use after free bug due to error path handling in mtk_jpeg_dec_device_run

Type: advisorySources: OSV

In the Linux kernel, the following vulnerability has been resolved: media: mtk-jpeg: Fix use after free bug due to error path handling in mtk_jpeg_dec_device_run In mtk_jpeg_probe, &jpeg->job_timeout_work is bound with mtk_jpeg_job_timeout_work. In mtk_jpeg_dec_device_run, if error happens in mtk_jpeg_set_dec_dst, it will finally start the worker while mark the job as finished by invoking v4l2_m2m_job_finish. There are two methods to trigger the bug. If we remove the module, it which will call mtk_jpeg_remove to make cleanup. The possible sequence is as follows, which will cause a use-after-free bug. CPU0 CPU1 mtk_jpeg_dec_... | start worker | |mtk_jpeg_job_timeout_work mtk_jpeg_remove | v4l2_m2m_release | kfree(m2m_dev); | | | v4l2_m2m_get_curr_priv | m2m_dev->curr_ctx //use If we close the file descriptor, which will call mtk_jpeg_release, it will have a similar sequence. Fix this bug by starting timeout worker only if started jpegdec worker successfully. Then v4l2_m2m_job_finish will only be called in either mtk_jpeg_job_timeout_work or mtk_jpeg_dec_device_run.

Products
Kernel
Affected versions
Not specified
Fixed versions
5.10.210, 5.15.149, 6.1.76, 6.6.15, 6.7.3
CVEs
CVE-2023-52491
Confirmed fixed CVEs
Not specified
Updated in this feed
4 Nov 2026, 20:01 UTC · Revision 1

Source evidence

media: mtk-jpeg: Fix use after free bug due to error path handling in mtk_jpeg_dec_device_run

core-osv · Original source

Published 29 Feb 2024, 15:52 UTC

In the Linux kernel, the following vulnerability has been resolved: media: mtk-jpeg: Fix use after free bug due to error path handling in mtk_jpeg_dec_device_run In mtk_jpeg_probe, &jpeg->job_timeout_work is bound with mtk_jpeg_job_timeout_work. In mtk_jpeg_dec_device_run, if error happens in mtk_jpeg_set_dec_dst, it will finally start the worker while mark the job as finished by invoking v4l2_m2m_job_finish. There are two methods to trigger the bug. If we remove the module, it which will call mtk_jpeg_remove to make cleanup. The possible sequence is as follows, which will cause a use-after-free bug. CPU0 CPU1 mtk_jpeg_dec_... | start worker | |mtk_jpeg_job_timeout_work mtk_jpeg_remove | v4l2_m2m_release | kfree(m2m_dev); | | | v4l2_m2m_get_curr_priv | m2m_dev->curr_ctx //use If we close the file descriptor, which will call mtk_jpeg_release, it will have a similar sequence. Fix this bug by starting timeout worker only if started jpegdec worker successfully. Then v4l2_m2m_job_finish will only be called in either mtk_jpeg_job_timeout_work or mtk_jpeg_dec_device_run.

osv:CVE-2023-52491

Kernel

Fixed versions: 5.10.210, 5.15.149, 6.1.76, 6.6.15, 6.7.3

Complete source record
{
  "id": "fabd4c13d598c864542b605bfc93bd0bd62d8724cc8c4a4f0a48cb754681f93b",
  "url": "https://osv.dev/vulnerability/CVE-2023-52491",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "media: mtk-jpeg: Fix use after free bug due to error path handling in mtk_jpeg_dec_device_run",
    "summary": "In the Linux kernel, the following vulnerability has been resolved: media: mtk-jpeg: Fix use after free bug due to error path handling in mtk_jpeg_dec_device_run In mtk_jpeg_probe, &jpeg->job_timeout_work is bound with mtk_jpeg_job_timeout_work. In mtk_jpeg_dec_device_run, if error happens in mtk_jpeg_set_dec_dst, it will finally start the worker while mark the job as finished by invoking v4l2_m2m_job_finish. There are two methods to trigger the bug. If we remove the module, it which will call mtk_jpeg_remove to make cleanup. The possible sequence is as follows, which will cause a use-after-free bug. CPU0 CPU1 mtk_jpeg_dec_... | start worker | |mtk_jpeg_job_timeout_work mtk_jpeg_remove | v4l2_m2m_release | kfree(m2m_dev); | | | v4l2_m2m_get_curr_priv | m2m_dev->curr_ctx //use If we close the file descriptor, which will call mtk_jpeg_release, it will have a similar sequence. Fix this bug by starting timeout worker only if started jpegdec worker successfully. Then v4l2_m2m_job_finish will only be called in either mtk_jpeg_job_timeout_work or mtk_jpeg_dec_device_run.",
    "evidence": "osv:CVE-2023-52491",
    "products": [
      {
        "name": {
          "value": "Kernel",
          "evidence": "/affected/1/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "5.10.210",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "5.15.149",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "6.1.76",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "6.6.15",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "6.7.3",
            "evidence": "/affected/1/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "high",
    "structured": {
      "id": "CVE-2023-52491",
      "aliases": [
        "CVE-2023-52491"
      ],
      "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": "b2f0d2724ba477d326e9d654d4db1c93e98f8b93"
                },
                {
                  "fixed": "43872f44eee6c6781fea1348b38885d8e78face9"
                },
                {
                  "fixed": "1b1036c60a37a30caf6759a90fe5ecd06ec35590"
                },
                {
                  "fixed": "9fec4db7fff54d9b0306a332bab31eac47eeb5f6"
                },
                {
                  "fixed": "8254d54d00eb6cdb8367399c7f912eb8d354ecd7"
                },
                {
                  "fixed": "6e2f37022f0fc0893da4d85a0500c9d547fffd4c"
                },
                {
                  "fixed": "206c857dd17d4d026de85866f1b5f0969f2a109e"
                }
              ]
            }
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2023-52491.json"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "4.12.0"
                },
                {
                  "fixed": "5.10.210"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "5.11.0"
                },
                {
                  "fixed": "5.15.149"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "5.16.0"
                },
                {
                  "fixed": "6.1.76"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "6.2.0"
                },
                {
                  "fixed": "6.6.15"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "6.7.0"
                },
                {
                  "fixed": "6.7.3"
                }
              ]
            }
          ],
          "package": {
            "name": "Kernel",
            "ecosystem": "Linux"
          },
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2023-52491.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:39.425567488Z",
      "provider": "osv",
      "references": [
        "https://git.kernel.org/stable/c/1b1036c60a37a30caf6759a90fe5ecd06ec35590",
        "https://git.kernel.org/stable/c/206c857dd17d4d026de85866f1b5f0969f2a109e",
        "https://git.kernel.org/stable/c/43872f44eee6c6781fea1348b38885d8e78face9",
        "https://git.kernel.org/stable/c/6e2f37022f0fc0893da4d85a0500c9d547fffd4c",
        "https://git.kernel.org/stable/c/8254d54d00eb6cdb8367399c7f912eb8d354ecd7",
        "https://git.kernel.org/stable/c/9fec4db7fff54d9b0306a332bab31eac47eeb5f6",
        "https://lists.debian.org/debian-lts-announce/2024/06/msg00017.html",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/52xxx/CVE-2023-52491.json",
        "https://nvd.nist.gov/vuln/detail/CVE-2023-52491",
        "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/2023/52xxx/CVE-2023-52491.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2023-52491",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 506454,
  "published_at": "2024-02-29T15:52:09.891+00:00"
}