From: Dmitry Eremin Date: Tue, 25 Feb 2014 18:41:26 +0000 (+0400) Subject: LU-4629 mdc: fix issue found by Klocwork Insight tool X-Git-Tag: 2.5.58~66 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F87%2F9387%2F4;p=fs%2Flustre-release.git 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 --- 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,