git: 51e94a4658d2 - main - LinuxKPI: fix possible NULL dereference in linuxkpi_page_frag_alloc()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 11 Jan 2023 23:50:52 UTC
The branch main has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=51e94a4658d23016dd0ae67c189a89f53281cbcd
commit 51e94a4658d23016dd0ae67c189a89f53281cbcd
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-01-11 23:40:05 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-01-11 23:40:05 +0000
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
---
sys/compat/linuxkpi/common/src/linux_page.c | 2 ++
1 file changed, 2 insertions(+)
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. */