summaryrefslogtreecommitdiff
path: root/include/linux/hw_random.h
diff options
context:
space:
mode:
authorDuoming Zhou <duoming@zju.edu.cn>2024-03-12 03:59:05 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-05-30 10:49:45 +0300
commitce47e8ead9a72834cc68431d53f8092ce69bebb7 (patch)
tree8dc8cb1d8752e8691c142049e6ef2b33aa3c885b /include/linux/hw_random.h
parent264dd6fe25b64e5189bd8a2151d24e205b02d927 (diff)
downloadlinux-ce47e8ead9a72834cc68431d53f8092ce69bebb7.tar.xz
lib/test_hmm.c: handle src_pfns and dst_pfns allocation failure
[ Upstream commit c2af060d1c18beaec56351cf9c9bcbbc5af341a3 ] The kcalloc() in dmirror_device_evict_chunk() will return null if the physical memory has run out. As a result, if src_pfns or dst_pfns is dereferenced, the null pointer dereference bug will happen. Moreover, the device is going away. If the kcalloc() fails, the pages mapping a chunk could not be evicted. So add a __GFP_NOFAIL flag in kcalloc(). Finally, as there is no need to have physically contiguous memory, Switch kcalloc() to kvcalloc() in order to avoid failing allocations. Link: https://lkml.kernel.org/r/20240312005905.9939-1-duoming@zju.edu.cn Fixes: b2ef9f5a5cb3 ("mm/hmm/test: add selftest driver for HMM") Signed-off-by: Duoming Zhou <duoming@zju.edu.cn> Cc: Jérôme Glisse <jglisse@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/linux/hw_random.h')
0 files changed, 0 insertions, 0 deletions