From d7f407bab6b6b50c7414f50a0079145df22a20d9 Mon Sep 17 00:00:00 2001 From: Dmitry Eremin Date: Tue, 25 Feb 2014 22:41:26 +0400 Subject: [PATCH] LU-4629 mdc: fix issue found by Klocwork Insight tool Pointer 'mod' checked for NULL at line 160 may be dereferenced at line 208. Signed-off-by: Dmitry Eremin Change-Id: I130de2f5b2066b8797e2454d4a603f53b3ffcbef Reviewed-on: http://review.whamcloud.com/9387 Reviewed-by: Lai Siyao Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin --- lustre/mdc/mdc_reint.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lustre/mdc/mdc_reint.c b/lustre/mdc/mdc_reint.c index cb09729..a233011 100644 --- a/lustre/mdc/mdc_reint.c +++ b/lustre/mdc/mdc_reint.c @@ -203,12 +203,13 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data, rc = 0; } *request = req; - if (rc && req->rq_commit_cb) { - /* Put an extra reference on \var mod on error case. */ - obd_mod_put(*mod); - req->rq_commit_cb(req); - } - RETURN(rc); + if (rc && req->rq_commit_cb) { + /* Put an extra reference on \var mod on error case. */ + if (mod != NULL && *mod != NULL) + obd_mod_put(*mod); + req->rq_commit_cb(req); + } + RETURN(rc); } int mdc_create(struct obd_export *exp, struct md_op_data *op_data, -- 1.8.3.1