{"id":"CVE-2025-38274","state":"PUBLISHED","title":"fpga: fix potential null pointer deref in fpga_mgr_test_img_load_sgt()","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nfpga: fix potential null pointer deref in fpga_mgr_test_img_load_sgt()\n\nfpga_mgr_test_img_load_sgt() allocates memory for sgt using\nkunit_kzalloc() however it does not check if the allocation failed.\nIt then passes sgt to sg_alloc_table(), which passes it to\n__sg_alloc_table(). This function calls memset() on sgt in an attempt to\nzero it out. If the allocation fails then sgt will be NULL and the\nmemset will trigger a NULL pointer dereference.\n\nFix this by checking the allocation with KUNIT_ASSERT_NOT_ERR_OR_NULL().","publishedAt":"2025-07-10T07:41:55.041Z","updatedAt":"2026-05-11T21:24:42.305Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"ccbc1c302115d8125d6a96296ba52702c6de0ade","status":"affected","lessThan":"e69e2cfd8b38d9463a250e153ef4963a604d61e9","versionType":"git"},{"version":"ccbc1c302115d8125d6a96296ba52702c6de0ade","status":"affected","lessThan":"8b2230ac7ff0aeb2441132df638a82ab124f8624","versionType":"git"},{"version":"ccbc1c302115d8125d6a96296ba52702c6de0ade","status":"affected","lessThan":"eb4c74eaa6e2d15f3bbd32941c9d2a25b29a718d","versionType":"git"},{"version":"ccbc1c302115d8125d6a96296ba52702c6de0ade","status":"affected","lessThan":"6ebf1982038af12f3588417e4fd0417d2551da28","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/fpga/tests/fpga-mgr-test.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.6","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.6","versionType":"semver"},{"version":"6.6.94","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.34","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.3","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/fpga/tests/fpga-mgr-test.c"]}],"references":["https://git.kernel.org/stable/c/e69e2cfd8b38d9463a250e153ef4963a604d61e9","https://git.kernel.org/stable/c/8b2230ac7ff0aeb2441132df638a82ab124f8624","https://git.kernel.org/stable/c/eb4c74eaa6e2d15f3bbd32941c9d2a25b29a718d","https://git.kernel.org/stable/c/6ebf1982038af12f3588417e4fd0417d2551da28"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:09.358Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/38xxx/CVE-2025-38274.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-38274","state":"PUBLISHED","datePublished":"2025-07-10T07:41:55.041Z","dateUpdated":"2026-05-11T21:24:42.305Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T04:51:23.998Z"},"containers":{"cna":{"title":"fpga: fix potential null pointer deref in fpga_mgr_test_img_load_sgt()","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nfpga: fix potential null pointer deref in fpga_mgr_test_img_load_sgt()\n\nfpga_mgr_test_img_load_sgt() allocates memory for sgt using\nkunit_kzalloc() however it does not check if the allocation failed.\nIt then passes sgt to sg_alloc_table(), which passes it to\n__sg_alloc_table(). This function calls memset() on sgt in an attempt to\nzero it out. If the allocation fails then sgt will be NULL and the\nmemset will trigger a NULL pointer dereference.\n\nFix this by checking the allocation with KUNIT_ASSERT_NOT_ERR_OR_NULL()."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"ccbc1c302115d8125d6a96296ba52702c6de0ade","status":"affected","lessThan":"e69e2cfd8b38d9463a250e153ef4963a604d61e9","versionType":"git"},{"version":"ccbc1c302115d8125d6a96296ba52702c6de0ade","status":"affected","lessThan":"8b2230ac7ff0aeb2441132df638a82ab124f8624","versionType":"git"},{"version":"ccbc1c302115d8125d6a96296ba52702c6de0ade","status":"affected","lessThan":"eb4c74eaa6e2d15f3bbd32941c9d2a25b29a718d","versionType":"git"},{"version":"ccbc1c302115d8125d6a96296ba52702c6de0ade","status":"affected","lessThan":"6ebf1982038af12f3588417e4fd0417d2551da28","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/fpga/tests/fpga-mgr-test.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.6","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.6","versionType":"semver"},{"version":"6.6.94","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.34","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.3","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/fpga/tests/fpga-mgr-test.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/e69e2cfd8b38d9463a250e153ef4963a604d61e9"},{"url":"https://git.kernel.org/stable/c/8b2230ac7ff0aeb2441132df638a82ab124f8624"},{"url":"https://git.kernel.org/stable/c/eb4c74eaa6e2d15f3bbd32941c9d2a25b29a718d"},{"url":"https://git.kernel.org/stable/c/6ebf1982038af12f3588417e4fd0417d2551da28"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-05-11T21:24:42.305Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6","versionEndExcluding":"6.6.94"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6","versionEndExcluding":"6.12.34"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6","versionEndExcluding":"6.15.3"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6","versionEndExcluding":"6.16"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}