diff options
author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2023-01-11 23:40:05 +0000 |
---|---|---|
committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2023-01-11 23:40:05 +0000 |
commit | 51e94a4658d23016dd0ae67c189a89f53281cbcd (patch) | |
tree | d4f49488215c683a291b283259bf80e8e8eca9e7 /sys/compat/linuxkpi/common/src | |
parent | ad70f2e22ef29f94bf5208b3a9a2389575330b06 (diff) | |
download | src-51e94a4658d23016dd0ae67c189a89f53281cbcd.tar.gz src-51e94a4658d23016dd0ae67c189a89f53281cbcd.zip |
LinuxKPI: fix possible NULL dereference in linuxkpi_page_frag_alloc()
Fix a possible NULL pointer deref in case alloc_pages() fails.
This is theoretical so far as up to now no code in the tree uses
linuxkpi_page_frag_alloc().
Reported by: Coverity via emaste
Coverity ID: 1502345
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
X-MFC-with: 55038a6306a570c9f2df89f5ad076de0f7d98152
Diffstat (limited to 'sys/compat/linuxkpi/common/src')
-rw-r--r-- | sys/compat/linuxkpi/common/src/linux_page.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c index 2bbe8f502cba..4c93d2f69354 100644 --- a/sys/compat/linuxkpi/common/src/linux_page.c +++ b/sys/compat/linuxkpi/common/src/linux_page.c @@ -451,6 +451,8 @@ linuxkpi_page_frag_alloc(struct page_frag_cache *pfc, "supported", __func__, fragsz)); pages = alloc_pages(gfp, flsl(howmany(fragsz, PAGE_SIZE) - 1)); + if (pages == NULL) + return (NULL); pfc->va = linux_page_address(pages); /* Passed in as "count" to __page_frag_cache_drain(). Unused by us. */ |