[lustre-devel] [PATCH 04/40] lustre: osc: page fault in osc_release_bounce_pages()

James Simmons jsimmons at infradead.org
Sun Apr 9 05:12:44 PDT 2023


From: Andriy Skulysh <andriy.skulysh at hpe.com>

pga[i] can be uninitialized. It happens after following
code path in osc_build_rpc():

	oa = kmem_cache_zalloc(osc_obdo_kmem, GFP_NOFS);
	if (!oa) {
		rc = -ENOMEM;
		goto out;
	}

Fixes: ef93d889b4c6 ("lustre: sec: encryption for write path")
HPE-bug-id: LUS-10991
WC-bug-id: https://jira.whamcloud.com/browse/LU-16333
Signed-off-by: Andriy Skulysh <andriy.skulysh at hpe.com>
Reviewed-by: Alexander Zarochentsev <alexander.zarochentsev at hpe.com>
Reviewed-by: Alexander Boyko <c17825 at cray.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49210
Reviewed-by: Sebastien Buisson <sbuisson at ddn.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Reviewed-by: Alexander Boyko <alexander.boyko at hpe.com>
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
 fs/lustre/osc/osc_request.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/lustre/osc/osc_request.c b/fs/lustre/osc/osc_request.c
index bd294c5..6ea1db6 100644
--- a/fs/lustre/osc/osc_request.c
+++ b/fs/lustre/osc/osc_request.c
@@ -1463,6 +1463,9 @@ static inline void osc_release_bounce_pages(struct brw_page **pga,
 	struct page **pa = NULL;
 	int i, j = 0;
 
+	if (!pga[0])
+		return;
+
 	if (PageChecked(pga[0]->pg)) {
 		pa = kvmalloc_array(page_count, sizeof(*pa),
 				    GFP_KERNEL | __GFP_ZERO);
-- 
1.8.3.1



More information about the lustre-devel mailing list