# CVE-2025-38274: fpga: fix potential null pointer deref in fpga_mgr_test_img_load_sgt()

- 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.19%, higher than 9% of CVEs (2026-12-01)
- Published: 2025-07-10T07:41:55.041Z
- Modified: 2026-06-17T09:16:31.730Z
- Weaknesses: CWE-476
- Assigned by: Linux

## Description

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

fpga: fix potential null pointer deref in fpga_mgr_test_img_load_sgt()

fpga_mgr_test_img_load_sgt() allocates memory for sgt using
kunit_kzalloc() however it does not check if the allocation failed.
It then passes sgt to sg_alloc_table(), which passes it to
__sg_alloc_table(). This function calls memset() on sgt in an attempt to
zero it out. If the allocation fails then sgt will be NULL and the
memset will trigger a NULL pointer dereference.

Fix this by checking the allocation with KUNIT_ASSERT_NOT_ERR_OR_NULL().

(As written by CVE List.)

## Affected

- Linux Linux: from ccbc1c302115d8125d6a96296ba52702c6de0ade before e69e2cfd8b38d9463a250e153ef4963a604d61e9; from ccbc1c302115d8125d6a96296ba52702c6de0ade before 8b2230ac7ff0aeb2441132df638a82ab124f8624; from ccbc1c302115d8125d6a96296ba52702c6de0ade before eb4c74eaa6e2d15f3bbd32941c9d2a25b29a718d; from ccbc1c302115d8125d6a96296ba52702c6de0ade before 6ebf1982038af12f3588417e4fd0417d2551da28; 6.6 (not affected: before 6.6; from 6.6.94 up to 6.6.*; from 6.12.34 up to 6.12.*; from 6.15.3 up to 6.15.*; from 6.16 up to *)
- linux linux_kernel: from 6.6 before 6.6.94; from 6.7 before 6.12.34; from 6.13 before 6.15.3

## References

- <https://git.kernel.org/stable/c/e69e2cfd8b38d9463a250e153ef4963a604d61e9> (patch)
- <https://git.kernel.org/stable/c/8b2230ac7ff0aeb2441132df638a82ab124f8624> (patch)
- <https://git.kernel.org/stable/c/eb4c74eaa6e2d15f3bbd32941c9d2a25b29a718d> (patch)
- <https://git.kernel.org/stable/c/6ebf1982038af12f3588417e4fd0417d2551da28> (patch)

## Sources

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

---

Page: https://cve.day/CVE-2025-38274 · Whole record: https://cve.day/CVE-2025-38274.json · Rebuilt by cve.day 2026-11-25T22:59:01.049Z
