CVE-2025-40222 (GCVE-0-2025-40222)
Vulnerability from cvelistv5
Published
2025-12-04 15:31
Modified
2025-12-04 15:31
Severity ?
Summary
In the Linux kernel, the following vulnerability has been resolved: tty: serial: sh-sci: fix RSCI FIFO overrun handling The receive error handling code is shared between RSCI and all other SCIF port types, but the RSCI overrun_reg is specified as a memory offset, while for other SCIF types it is an enum value used to index into the sci_port_params->regs array, as mentioned above the sci_serial_in() function. For RSCI, the overrun_reg is CSR (0x48), causing the sci_getreg() call inside the sci_handle_fifo_overrun() function to index outside the bounds of the regs array, which currently has a size of 20, as specified by SCI_NR_REGS. Because of this, we end up accessing memory outside of RSCI's rsci_port_params structure, which, when interpreted as a plat_sci_reg, happens to have a non-zero size, causing the following WARN when sci_serial_in() is called, as the accidental size does not match the supported register sizes. The existence of the overrun_reg needs to be checked because SCIx_SH3_SCIF_REGTYPE has overrun_reg set to SCLSR, but SCLSR is not present in the regs array. Avoid calling sci_getreg() for port types which don't use standard register handling. Use the ops->read_reg() and ops->write_reg() functions to properly read and write registers for RSCI, and change the type of the status variable to accommodate the 32-bit CSR register. sci_getreg() and sci_serial_in() are also called with overrun_reg in the sci_mpxed_interrupt() interrupt handler, but that code path is not used for RSCI, as it does not have a muxed interrupt. ------------[ cut here ]------------ Invalid register access WARNING: CPU: 0 PID: 0 at drivers/tty/serial/sh-sci.c:522 sci_serial_in+0x38/0xac Modules linked in: renesas_usbhs at24 rzt2h_adc industrialio_adc sha256 cfg80211 bluetooth ecdh_generic ecc rfkill fuse drm backlight ipv6 CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.17.0-rc1+ #30 PREEMPT Hardware name: Renesas RZ/T2H EVK Board based on r9a09g077m44 (DT) pstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : sci_serial_in+0x38/0xac lr : sci_serial_in+0x38/0xac sp : ffff800080003e80 x29: ffff800080003e80 x28: ffff800082195b80 x27: 000000000000000d x26: ffff8000821956d0 x25: 0000000000000000 x24: ffff800082195b80 x23: ffff000180e0d800 x22: 0000000000000010 x21: 0000000000000000 x20: 0000000000000010 x19: ffff000180e72000 x18: 000000000000000a x17: ffff8002bcee7000 x16: ffff800080000000 x15: 0720072007200720 x14: 0720072007200720 x13: 0720072007200720 x12: 0720072007200720 x11: 0000000000000058 x10: 0000000000000018 x9 : ffff8000821a6a48 x8 : 0000000000057fa8 x7 : 0000000000000406 x6 : ffff8000821fea48 x5 : ffff00033ef88408 x4 : ffff8002bcee7000 x3 : ffff800082195b80 x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff800082195b80 Call trace: sci_serial_in+0x38/0xac (P) sci_handle_fifo_overrun.isra.0+0x70/0x134 sci_er_interrupt+0x50/0x39c __handle_irq_event_percpu+0x48/0x140 handle_irq_event+0x44/0xb0 handle_fasteoi_irq+0xf4/0x1a0 handle_irq_desc+0x34/0x58 generic_handle_domain_irq+0x1c/0x28 gic_handle_irq+0x4c/0x140 call_on_irq_stack+0x30/0x48 do_interrupt_handler+0x80/0x84 el1_interrupt+0x34/0x68 el1h_64_irq_handler+0x18/0x24 el1h_64_irq+0x6c/0x70 default_idle_call+0x28/0x58 (P) do_idle+0x1f8/0x250 cpu_startup_entry+0x34/0x3c rest_init+0xd8/0xe0 console_on_rootfs+0x0/0x6c __primary_switched+0x88/0x90 ---[ end trace 0000000000000000 ]---
Impacted products
Vendor Product Version
Linux Linux Version: 0666e3fe95ab55c295984f2f51277ec27d3f190c
Version: 0666e3fe95ab55c295984f2f51277ec27d3f190c
Create a notification for this product.
Show details on NVD website


{
  "containers": {
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "drivers/tty/serial/sh-sci.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "2ec9bbd09a6cdf5b8c726be34f29630faf585d07",
              "status": "affected",
              "version": "0666e3fe95ab55c295984f2f51277ec27d3f190c",
              "versionType": "git"
            },
            {
              "lessThan": "ef8fef45c74b5a0059488fda2df65fa133f7d7d0",
              "status": "affected",
              "version": "0666e3fe95ab55c295984f2f51277ec27d3f190c",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "drivers/tty/serial/sh-sci.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "6.17"
            },
            {
              "lessThan": "6.17",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.17.*",
              "status": "unaffected",
              "version": "6.17.6",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.18",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "cpeApplicability": [
        {
          "nodes": [
            {
              "cpeMatch": [
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.17.6",
                  "versionStartIncluding": "6.17",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.18",
                  "versionStartIncluding": "6.17",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\ntty: serial: sh-sci: fix RSCI FIFO overrun handling\n\nThe receive error handling code is shared between RSCI and all other\nSCIF port types, but the RSCI overrun_reg is specified as a memory\noffset, while for other SCIF types it is an enum value used to index\ninto the sci_port_params-\u003eregs array, as mentioned above the\nsci_serial_in() function.\n\nFor RSCI, the overrun_reg is CSR (0x48), causing the sci_getreg() call\ninside the sci_handle_fifo_overrun() function to index outside the\nbounds of the regs array, which currently has a size of 20, as specified\nby SCI_NR_REGS.\n\nBecause of this, we end up accessing memory outside of RSCI\u0027s\nrsci_port_params structure, which, when interpreted as a plat_sci_reg,\nhappens to have a non-zero size, causing the following WARN when\nsci_serial_in() is called, as the accidental size does not match the\nsupported register sizes.\n\nThe existence of the overrun_reg needs to be checked because\nSCIx_SH3_SCIF_REGTYPE has overrun_reg set to SCLSR, but SCLSR is not\npresent in the regs array.\n\nAvoid calling sci_getreg() for port types which don\u0027t use standard\nregister handling.\n\nUse the ops-\u003eread_reg() and ops-\u003ewrite_reg() functions to properly read\nand write registers for RSCI, and change the type of the status variable\nto accommodate the 32-bit CSR register.\n\nsci_getreg() and sci_serial_in() are also called with overrun_reg in the\nsci_mpxed_interrupt() interrupt handler, but that code path is not used\nfor RSCI, as it does not have a muxed interrupt.\n\n------------[ cut here ]------------\nInvalid register access\nWARNING: CPU: 0 PID: 0 at drivers/tty/serial/sh-sci.c:522 sci_serial_in+0x38/0xac\nModules linked in: renesas_usbhs at24 rzt2h_adc industrialio_adc sha256 cfg80211 bluetooth ecdh_generic ecc rfkill fuse drm backlight ipv6\nCPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.17.0-rc1+ #30 PREEMPT\nHardware name: Renesas RZ/T2H EVK Board based on r9a09g077m44 (DT)\npstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)\npc : sci_serial_in+0x38/0xac\nlr : sci_serial_in+0x38/0xac\nsp : ffff800080003e80\nx29: ffff800080003e80 x28: ffff800082195b80 x27: 000000000000000d\nx26: ffff8000821956d0 x25: 0000000000000000 x24: ffff800082195b80\nx23: ffff000180e0d800 x22: 0000000000000010 x21: 0000000000000000\nx20: 0000000000000010 x19: ffff000180e72000 x18: 000000000000000a\nx17: ffff8002bcee7000 x16: ffff800080000000 x15: 0720072007200720\nx14: 0720072007200720 x13: 0720072007200720 x12: 0720072007200720\nx11: 0000000000000058 x10: 0000000000000018 x9 : ffff8000821a6a48\nx8 : 0000000000057fa8 x7 : 0000000000000406 x6 : ffff8000821fea48\nx5 : ffff00033ef88408 x4 : ffff8002bcee7000 x3 : ffff800082195b80\nx2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff800082195b80\nCall trace:\n sci_serial_in+0x38/0xac (P)\n sci_handle_fifo_overrun.isra.0+0x70/0x134\n sci_er_interrupt+0x50/0x39c\n __handle_irq_event_percpu+0x48/0x140\n handle_irq_event+0x44/0xb0\n handle_fasteoi_irq+0xf4/0x1a0\n handle_irq_desc+0x34/0x58\n generic_handle_domain_irq+0x1c/0x28\n gic_handle_irq+0x4c/0x140\n call_on_irq_stack+0x30/0x48\n do_interrupt_handler+0x80/0x84\n el1_interrupt+0x34/0x68\n el1h_64_irq_handler+0x18/0x24\n el1h_64_irq+0x6c/0x70\n default_idle_call+0x28/0x58 (P)\n do_idle+0x1f8/0x250\n cpu_startup_entry+0x34/0x3c\n rest_init+0xd8/0xe0\n console_on_rootfs+0x0/0x6c\n __primary_switched+0x88/0x90\n---[ end trace 0000000000000000 ]---"
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2025-12-04T15:31:14.142Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/2ec9bbd09a6cdf5b8c726be34f29630faf585d07"
        },
        {
          "url": "https://git.kernel.org/stable/c/ef8fef45c74b5a0059488fda2df65fa133f7d7d0"
        }
      ],
      "title": "tty: serial: sh-sci: fix RSCI FIFO overrun handling",
      "x_generator": {
        "engine": "bippy-1.2.0"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2025-40222",
    "datePublished": "2025-12-04T15:31:14.142Z",
    "dateReserved": "2025-04-16T07:20:57.180Z",
    "dateUpdated": "2025-12-04T15:31:14.142Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2",
  "vulnerability-lookup:meta": {
    "nvd": "{\"cve\":{\"id\":\"CVE-2025-40222\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2025-12-04T16:16:14.627\",\"lastModified\":\"2025-12-04T17:15:08.283\",\"vulnStatus\":\"Awaiting Analysis\",\"cveTags\":[],\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\ntty: serial: sh-sci: fix RSCI FIFO overrun handling\\n\\nThe receive error handling code is shared between RSCI and all other\\nSCIF port types, but the RSCI overrun_reg is specified as a memory\\noffset, while for other SCIF types it is an enum value used to index\\ninto the sci_port_params-\u003eregs array, as mentioned above the\\nsci_serial_in() function.\\n\\nFor RSCI, the overrun_reg is CSR (0x48), causing the sci_getreg() call\\ninside the sci_handle_fifo_overrun() function to index outside the\\nbounds of the regs array, which currently has a size of 20, as specified\\nby SCI_NR_REGS.\\n\\nBecause of this, we end up accessing memory outside of RSCI\u0027s\\nrsci_port_params structure, which, when interpreted as a plat_sci_reg,\\nhappens to have a non-zero size, causing the following WARN when\\nsci_serial_in() is called, as the accidental size does not match the\\nsupported register sizes.\\n\\nThe existence of the overrun_reg needs to be checked because\\nSCIx_SH3_SCIF_REGTYPE has overrun_reg set to SCLSR, but SCLSR is not\\npresent in the regs array.\\n\\nAvoid calling sci_getreg() for port types which don\u0027t use standard\\nregister handling.\\n\\nUse the ops-\u003eread_reg() and ops-\u003ewrite_reg() functions to properly read\\nand write registers for RSCI, and change the type of the status variable\\nto accommodate the 32-bit CSR register.\\n\\nsci_getreg() and sci_serial_in() are also called with overrun_reg in the\\nsci_mpxed_interrupt() interrupt handler, but that code path is not used\\nfor RSCI, as it does not have a muxed interrupt.\\n\\n------------[ cut here ]------------\\nInvalid register access\\nWARNING: CPU: 0 PID: 0 at drivers/tty/serial/sh-sci.c:522 sci_serial_in+0x38/0xac\\nModules linked in: renesas_usbhs at24 rzt2h_adc industrialio_adc sha256 cfg80211 bluetooth ecdh_generic ecc rfkill fuse drm backlight ipv6\\nCPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.17.0-rc1+ #30 PREEMPT\\nHardware name: Renesas RZ/T2H EVK Board based on r9a09g077m44 (DT)\\npstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)\\npc : sci_serial_in+0x38/0xac\\nlr : sci_serial_in+0x38/0xac\\nsp : ffff800080003e80\\nx29: ffff800080003e80 x28: ffff800082195b80 x27: 000000000000000d\\nx26: ffff8000821956d0 x25: 0000000000000000 x24: ffff800082195b80\\nx23: ffff000180e0d800 x22: 0000000000000010 x21: 0000000000000000\\nx20: 0000000000000010 x19: ffff000180e72000 x18: 000000000000000a\\nx17: ffff8002bcee7000 x16: ffff800080000000 x15: 0720072007200720\\nx14: 0720072007200720 x13: 0720072007200720 x12: 0720072007200720\\nx11: 0000000000000058 x10: 0000000000000018 x9 : ffff8000821a6a48\\nx8 : 0000000000057fa8 x7 : 0000000000000406 x6 : ffff8000821fea48\\nx5 : ffff00033ef88408 x4 : ffff8002bcee7000 x3 : ffff800082195b80\\nx2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff800082195b80\\nCall trace:\\n sci_serial_in+0x38/0xac (P)\\n sci_handle_fifo_overrun.isra.0+0x70/0x134\\n sci_er_interrupt+0x50/0x39c\\n __handle_irq_event_percpu+0x48/0x140\\n handle_irq_event+0x44/0xb0\\n handle_fasteoi_irq+0xf4/0x1a0\\n handle_irq_desc+0x34/0x58\\n generic_handle_domain_irq+0x1c/0x28\\n gic_handle_irq+0x4c/0x140\\n call_on_irq_stack+0x30/0x48\\n do_interrupt_handler+0x80/0x84\\n el1_interrupt+0x34/0x68\\n el1h_64_irq_handler+0x18/0x24\\n el1h_64_irq+0x6c/0x70\\n default_idle_call+0x28/0x58 (P)\\n do_idle+0x1f8/0x250\\n cpu_startup_entry+0x34/0x3c\\n rest_init+0xd8/0xe0\\n console_on_rootfs+0x0/0x6c\\n __primary_switched+0x88/0x90\\n---[ end trace 0000000000000000 ]---\"}],\"metrics\":{},\"references\":[{\"url\":\"https://git.kernel.org/stable/c/2ec9bbd09a6cdf5b8c726be34f29630faf585d07\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/ef8fef45c74b5a0059488fda2df65fa133f7d7d0\",\"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 seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.


Loading…

Loading…