From eba48ac10a2df096af78687911ed64ac750f14d3 Mon Sep 17 00:00:00 2001 From: Steve Guminski Date: Wed, 1 Mar 2017 13:46:19 -0500 Subject: [PATCH] LU-9076 ptlrpc: Prevent possible dereference of NULL pointers Check pointers for NULL before passing to other functions. Signed-off-by: Steve Guminski Change-Id: I5ad1e6675e9c5e41aee2dc59045ed67e9da5ea0d Reviewed-on: https://review.whamcloud.com/25909 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- lustre/ptlrpc/client.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 8660a82..13a3ece 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -2034,13 +2034,15 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) } ptlrpc_rqphase_move(req, RQ_PHASE_COMPLETE); - CDEBUG(req->rq_reqmsg != NULL ? D_RPCTRACE : 0, - "Completed RPC pname:cluuid:pid:xid:nid:" - "opc %s:%s:%d:%llu:%s:%d\n", - current_comm(), imp->imp_obd->obd_uuid.uuid, - lustre_msg_get_status(req->rq_reqmsg), req->rq_xid, - libcfs_nid2str(imp->imp_connection->c_peer.nid), - lustre_msg_get_opc(req->rq_reqmsg)); + if (req->rq_reqmsg != NULL) + CDEBUG(D_RPCTRACE, + "Completed RPC pname:cluuid:pid:xid:nid:" + "opc %s:%s:%d:%llu:%s:%d\n", current_comm(), + imp->imp_obd->obd_uuid.uuid, + lustre_msg_get_status(req->rq_reqmsg), + req->rq_xid, + libcfs_nid2str(imp->imp_connection->c_peer.nid), + lustre_msg_get_opc(req->rq_reqmsg)); spin_lock(&imp->imp_lock); /* Request already may be not on sending or delaying list. This -- 1.8.3.1