CVE-2023-54295 (GCVE-0-2023-54295)

Vulnerability from cvelistv5 – Published: 2025-12-30 12:23 – Updated: 2025-12-30 12:23
VLAI?
Title
mtd: spi-nor: Fix shift-out-of-bounds in spi_nor_set_erase_type
Summary
In the Linux kernel, the following vulnerability has been resolved: mtd: spi-nor: Fix shift-out-of-bounds in spi_nor_set_erase_type spi_nor_set_erase_type() was used either to set or to mask out an erase type. When we used it to mask out an erase type a shift-out-of-bounds was hit: UBSAN: shift-out-of-bounds in drivers/mtd/spi-nor/core.c:2237:24 shift exponent 4294967295 is too large for 32-bit type 'int' The setting of the size_{shift, mask} and of the opcode are unnecessary when the erase size is zero, as throughout the code just the erase size is considered to determine whether an erase type is supported or not. Setting the opcode to 0xFF was wrong too as nobody guarantees that 0xFF is an unused opcode. Thus when masking out an erase type, just set the erase size to zero. This will fix the shift-out-of-bounds. [ta: refine changes, new commit message, fix compilation error]
Severity ?
No CVSS data available.
Assigner
Impacted products
Vendor Product Version
Linux Linux Affected: 5390a8df769ec9ba9c995191bb0867430f602ebb , < e6409208c13f7c56adc12dd795abf4141e3d5e64 (git)
Affected: 5390a8df769ec9ba9c995191bb0867430f602ebb , < 61d44a4db2f54dbac7d22c2541574ea5755e0468 (git)
Affected: 5390a8df769ec9ba9c995191bb0867430f602ebb , < 53b2916ebde741c657a857fa1936c0d9fcb59170 (git)
Affected: 5390a8df769ec9ba9c995191bb0867430f602ebb , < 99341b8aee7b5b4255b339345bbcaa35867dfd0c (git)
Affected: 5390a8df769ec9ba9c995191bb0867430f602ebb , < f0f0cfdc3a024e21161714f2e05f0df3b84d42ad (git)
Create a notification for this product.
    Linux Linux Affected: 4.20
Unaffected: 0 , < 4.20 (semver)
Unaffected: 5.10.173 , ≤ 5.10.* (semver)
Unaffected: 5.15.99 , ≤ 5.15.* (semver)
Unaffected: 6.1.16 , ≤ 6.1.* (semver)
Unaffected: 6.2.3 , ≤ 6.2.* (semver)
Unaffected: 6.3 , ≤ * (original_commit_for_fix)
Create a notification for this product.
Show details on NVD website

{
  "containers": {
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "drivers/mtd/spi-nor/core.c",
            "drivers/mtd/spi-nor/core.h",
            "drivers/mtd/spi-nor/sfdp.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "e6409208c13f7c56adc12dd795abf4141e3d5e64",
              "status": "affected",
              "version": "5390a8df769ec9ba9c995191bb0867430f602ebb",
              "versionType": "git"
            },
            {
              "lessThan": "61d44a4db2f54dbac7d22c2541574ea5755e0468",
              "status": "affected",
              "version": "5390a8df769ec9ba9c995191bb0867430f602ebb",
              "versionType": "git"
            },
            {
              "lessThan": "53b2916ebde741c657a857fa1936c0d9fcb59170",
              "status": "affected",
              "version": "5390a8df769ec9ba9c995191bb0867430f602ebb",
              "versionType": "git"
            },
            {
              "lessThan": "99341b8aee7b5b4255b339345bbcaa35867dfd0c",
              "status": "affected",
              "version": "5390a8df769ec9ba9c995191bb0867430f602ebb",
              "versionType": "git"
            },
            {
              "lessThan": "f0f0cfdc3a024e21161714f2e05f0df3b84d42ad",
              "status": "affected",
              "version": "5390a8df769ec9ba9c995191bb0867430f602ebb",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "drivers/mtd/spi-nor/core.c",
            "drivers/mtd/spi-nor/core.h",
            "drivers/mtd/spi-nor/sfdp.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "4.20"
            },
            {
              "lessThan": "4.20",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.10.*",
              "status": "unaffected",
              "version": "5.10.173",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.15.*",
              "status": "unaffected",
              "version": "5.15.99",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.1.*",
              "status": "unaffected",
              "version": "6.1.16",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.2.*",
              "status": "unaffected",
              "version": "6.2.3",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.3",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "cpeApplicability": [
        {
          "nodes": [
            {
              "cpeMatch": [
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.10.173",
                  "versionStartIncluding": "4.20",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.15.99",
                  "versionStartIncluding": "4.20",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.1.16",
                  "versionStartIncluding": "4.20",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.2.3",
                  "versionStartIncluding": "4.20",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.3",
                  "versionStartIncluding": "4.20",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nmtd: spi-nor: Fix shift-out-of-bounds in spi_nor_set_erase_type\n\nspi_nor_set_erase_type() was used either to set or to mask out an erase\ntype. When we used it to mask out an erase type a shift-out-of-bounds\nwas hit:\nUBSAN: shift-out-of-bounds in drivers/mtd/spi-nor/core.c:2237:24\nshift exponent 4294967295 is too large for 32-bit type \u0027int\u0027\n\nThe setting of the size_{shift, mask} and of the opcode are unnecessary\nwhen the erase size is zero, as throughout the code just the erase size\nis considered to determine whether an erase type is supported or not.\nSetting the opcode to 0xFF was wrong too as nobody guarantees that 0xFF\nis an unused opcode. Thus when masking out an erase type, just set the\nerase size to zero. This will fix the shift-out-of-bounds.\n\n[ta: refine changes, new commit message, fix compilation error]"
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2025-12-30T12:23:32.458Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/e6409208c13f7c56adc12dd795abf4141e3d5e64"
        },
        {
          "url": "https://git.kernel.org/stable/c/61d44a4db2f54dbac7d22c2541574ea5755e0468"
        },
        {
          "url": "https://git.kernel.org/stable/c/53b2916ebde741c657a857fa1936c0d9fcb59170"
        },
        {
          "url": "https://git.kernel.org/stable/c/99341b8aee7b5b4255b339345bbcaa35867dfd0c"
        },
        {
          "url": "https://git.kernel.org/stable/c/f0f0cfdc3a024e21161714f2e05f0df3b84d42ad"
        }
      ],
      "title": "mtd: spi-nor: Fix shift-out-of-bounds in spi_nor_set_erase_type",
      "x_generator": {
        "engine": "bippy-1.2.0"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2023-54295",
    "datePublished": "2025-12-30T12:23:32.458Z",
    "dateReserved": "2025-12-30T12:06:44.527Z",
    "dateUpdated": "2025-12-30T12:23:32.458Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2",
  "vulnerability-lookup:meta": {
    "nvd": "{\"cve\":{\"id\":\"CVE-2023-54295\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2025-12-30T13:16:18.593\",\"lastModified\":\"2025-12-31T20:42:43.210\",\"vulnStatus\":\"Awaiting Analysis\",\"cveTags\":[],\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\nmtd: spi-nor: Fix shift-out-of-bounds in spi_nor_set_erase_type\\n\\nspi_nor_set_erase_type() was used either to set or to mask out an erase\\ntype. When we used it to mask out an erase type a shift-out-of-bounds\\nwas hit:\\nUBSAN: shift-out-of-bounds in drivers/mtd/spi-nor/core.c:2237:24\\nshift exponent 4294967295 is too large for 32-bit type \u0027int\u0027\\n\\nThe setting of the size_{shift, mask} and of the opcode are unnecessary\\nwhen the erase size is zero, as throughout the code just the erase size\\nis considered to determine whether an erase type is supported or not.\\nSetting the opcode to 0xFF was wrong too as nobody guarantees that 0xFF\\nis an unused opcode. Thus when masking out an erase type, just set the\\nerase size to zero. This will fix the shift-out-of-bounds.\\n\\n[ta: refine changes, new commit message, fix compilation error]\"}],\"metrics\":{},\"references\":[{\"url\":\"https://git.kernel.org/stable/c/53b2916ebde741c657a857fa1936c0d9fcb59170\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/61d44a4db2f54dbac7d22c2541574ea5755e0468\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/99341b8aee7b5b4255b339345bbcaa35867dfd0c\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/e6409208c13f7c56adc12dd795abf4141e3d5e64\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/f0f0cfdc3a024e21161714f2e05f0df3b84d42ad\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"}]}}"
  }
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.


Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…