linux-yocto/tools/testing
Guangshuo Li e4a1e3e881 nvdimm: ndtest: Return -ENOMEM if devm_kcalloc() fails in ndtest_probe()
commit a9e6aa994917ee602798bbb03180a194b37865bb upstream.

devm_kcalloc() may fail. ndtest_probe() allocates three DMA address
arrays (dcr_dma, label_dma, dimm_dma) and later unconditionally uses
them in ndtest_nvdimm_init(), which can lead to a NULL pointer
dereference under low-memory conditions.

Check all three allocations and return -ENOMEM if any allocation fails,
jumping to the common error path. Do not emit an extra error message
since the allocator already warns on allocation failure.

Fixes: 9399ab61ad ("ndtest: Add dimms to the two buses")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-10-15 12:00:23 +02:00
..
crypto/chacha20-s390
cxl cxl/test: Improve init-order fidelity relative to real-world systems 2024-10-25 16:07:04 -05:00
fault-injection
ktest ktest.pl: Prevent recursion of default variable options 2025-08-20 18:30:29 +02:00
kunit kunit: qemu_configs: Disable faulting tests on 32-bit SPARC 2025-07-10 16:04:55 +02:00
memblock memblock: updates for 6.12-rc1 2024-09-25 11:35:19 -07:00
nvdimm nvdimm: ndtest: Return -ENOMEM if devm_kcalloc() fails in ndtest_probe() 2025-10-15 12:00:23 +02:00
radix-tree maple_tree: add regression test for spanning store bug 2024-10-17 08:35:10 -07:00
scatterlist
selftests selftests: watchdog: skip ping loop if WDIOF_KEEPALIVEPING not supported 2025-10-15 12:00:02 +02:00
shared test suite: use %zu to print size_t 2025-04-25 10:47:43 +02:00
vma mm/hugetlb: unshare page tables during VMA split, not before 2025-06-27 11:11:40 +01:00
vsock vsock/test: Fix occasional failure in SIOCOUTQ tests 2025-05-22 14:29:41 +02:00