# CVE-2025-37896: spi: spi-mem: Add fix to avoid divide error

- Severity: Medium 5.5 (CVSS:3.1, scored by NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.17%, higher than 7% of CVEs (2026-12-01)
- Published: 2025-05-20T15:21:32.685Z
- Modified: 2026-06-17T09:15:39.320Z
- Weaknesses: CWE-369
- Assigned by: Linux

## Description

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

spi: spi-mem: Add fix to avoid divide error

For some SPI flash memory operations, dummy bytes are not mandatory. For
example, in Winbond SPINAND flash memory devices, the `write_cache` and
`update_cache` operation variants have zero dummy bytes. Calculating the
duration for SPI memory operations with zero dummy bytes causes
a divide error when `ncycles` is calculated in the
spi_mem_calc_op_duration().

Add changes to skip the 'ncylcles' calculation for zero dummy bytes.

Following divide error is fixed by this change:

 Oops: divide error: 0000 [#1] PREEMPT SMP NOPTI
...

  ? do_trap+0xdb/0x100
  ? do_error_trap+0x75/0xb0
  ? spi_mem_calc_op_duration+0x56/0xb0
  ? exc_divide_error+0x3b/0x70
  ? spi_mem_calc_op_duration+0x56/0xb0
  ? asm_exc_divide_error+0x1b/0x20
  ? spi_mem_calc_op_duration+0x56/0xb0
  ? spinand_select_op_variant+0xee/0x190 [spinand]
  spinand_match_and_init+0x13e/0x1a0 [spinand]
  spinand_manufacturer_match+0x6e/0xa0 [spinand]
  spinand_probe+0x357/0x7f0 [spinand]
  ? kernfs_activate+0x87/0xd0
  spi_mem_probe+0x7a/0xb0
  spi_probe+0x7d/0x130

(As written by CVE List.)

## Affected

- Linux Linux: from 226d6cb3cb799aae46d0dd19a521133997d9db11 before 1915dbd67dadc0bb35670c8e28229baa29368d17; from 226d6cb3cb799aae46d0dd19a521133997d9db11 before 8e4d3d8a5e51e07bd0d6cdd81b5e4af79f796927; 6.14 (not affected: before 6.14; from 6.14.6 up to 6.14.*; from 6.15 up to *)
- linux linux_kernel: from 6.14 before 6.14.6; 6.15

## References

- <https://git.kernel.org/stable/c/1915dbd67dadc0bb35670c8e28229baa29368d17> (patch)
- <https://git.kernel.org/stable/c/8e4d3d8a5e51e07bd0d6cdd81b5e4af79f796927> (patch)

## Sources

- CVE List: [CVE-2025-37896](https://www.cve.org/CVERecord?id=CVE-2025-37896), CVE Terms of Use, modified 2026-05-11
- NVD: [CVE-2025-37896](https://nvd.nist.gov/vuln/detail/CVE-2025-37896), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2025-37896 · Whole record: https://cve.day/CVE-2025-37896.json · Rebuilt by cve.day 2026-11-25T22:58:58.274Z
