[lustre-devel] [PATCH 18/42] lustre: osc: Fix possible null pointer

James Simmons <[email protected]>
Newsgroups org.lustre.lists.lustre-devel
Message-ID <[email protected]>
From: Patrick Farrell <[email protected]>

Change init to fix possible null pointer access.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15014
Lustre-commit: 20b56835b82c5d21c ("LU-15014 osc: Fix possible null pointer")
Signed-off-by: Patrick Farrell <[email protected]>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/44975
Reviewed-by: Andreas Dilger <[email protected]>
Reviewed-by: James Simmons <[email protected]>
Reviewed-by: Arshad Hussain <[email protected]>
Reviewed-by: Oleg Drokin <[email protected]>
Signed-off-by: James Simmons <[email protected]>
---
 fs/lustre/osc/osc_cache.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/lustre/osc/osc_cache.c b/fs/lustre/osc/osc_cache.c
index a9dc985bfa18..b339aeff0828 100644
--- a/fs/lustre/osc/osc_cache.c
+++ b/fs/lustre/osc/osc_cache.c
@@ -2300,14 +2300,12 @@ int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops,
 			struct cl_page *page, loff_t offset)
 {
 	struct osc_async_page *oap = &ops->ops_oap;
-	struct page *vmpage = page->cp_vmpage;
 
 	if (!page)
-		return -EIO;
+		return cfs_size_round(sizeof(*oap));
 
 	oap->oap_obj = osc;
-
-	oap->oap_page = vmpage;
+	oap->oap_page = page->cp_vmpage;
 	oap->oap_obj_off = offset;
 	LASSERT(!(offset & ~PAGE_MASK));
 
@@ -2323,7 +2321,7 @@ int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops,
 	INIT_LIST_HEAD(&oap->oap_rpc_item);
 
 	CDEBUG(D_INFO, "oap %p vmpage %p obj off %llu\n",
-	       oap, vmpage, oap->oap_obj_off);
+	       oap, oap->oap_page, oap->oap_obj_off);
 	return 0;
 }
 EXPORT_SYMBOL(osc_prep_async_page);
-- 
2.27.0

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.