[lustre-devel] [PATCH 479/622] lustre: osc: prevent use after free

James Simmons jsimmons at infradead.org
Thu Feb 27 13:15:47 PST 2020


From: Bobi Jam <bobijam at whamcloud.com>

Clear aa_oa after it's been freed to prevent use after free.

WC-bug-id: https://jira.whamcloud.com/browse/LU-12581
Lustre-commit: 61c9f8797771 ("LU-12581 osc: prevent use after free")
Signed-off-by: Bobi Jam <bobijam at whamcloud.com>
Reviewed-on: https://review.whamcloud.com/35601
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell at whamcloud.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
 fs/lustre/osc/osc_request.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/lustre/osc/osc_request.c b/fs/lustre/osc/osc_request.c
index 75e0823..7ba9ea5 100644
--- a/fs/lustre/osc/osc_request.c
+++ b/fs/lustre/osc/osc_request.c
@@ -748,6 +748,7 @@ static int osc_shrink_grant_interpret(const struct lu_env *env,
 	osc_update_grant(cli, body);
 out:
 	kmem_cache_free(osc_obdo_kmem, aa->aa_oa);
+	aa->aa_oa = NULL;
 
 	return rc;
 }
@@ -2131,6 +2132,7 @@ static int brw_interpret(const struct lu_env *env,
 		cl_object_attr_unlock(obj);
 	}
 	kmem_cache_free(osc_obdo_kmem, aa->aa_oa);
+	aa->aa_oa = NULL;
 
 	if (lustre_msg_get_opc(req->rq_reqmsg) == OST_WRITE && rc == 0)
 		osc_inc_unstable_pages(req);
-- 
1.8.3.1



More information about the lustre-devel mailing list