diff mbox series

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

Message ID 1681042400-15491-5-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series lustre: backport OpenSFS changes from March XX, 2023 | expand

Commit Message

James Simmons April 9, 2023, 12:12 p.m. UTC
From: Andriy Skulysh <andriy.skulysh@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@hpe.com>
Reviewed-by: Alexander Zarochentsev <alexander.zarochentsev@hpe.com>
Reviewed-by: Alexander Boyko <c17825@cray.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49210
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Alexander Boyko <alexander.boyko@hpe.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/osc/osc_request.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

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);