From 00db41e39e6bf4fc4e2524171df9584ae7a0df22 Mon Sep 17 00:00:00 2001 From: tianzy Date: Fri, 31 Oct 2008 07:51:37 +0000 Subject: [PATCH] Branch b1_6 fix a possible NULL pointer in client_quota_ctl() b=17486 i=johann i=panda --- lustre/ptlrpc/pack_generic.c | 1 + lustre/quota/quota_ctl.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index 84ec8aa..2bafe82 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -1096,6 +1096,7 @@ void *lustre_swab_buf(struct lustre_msg *msg, int index, int min_size, { void *ptr = NULL; + LASSERT(msg != NULL); switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V1: ptr = lustre_msg_buf_v1(msg, index - 1, min_size); diff --git a/lustre/quota/quota_ctl.c b/lustre/quota/quota_ctl.c index 900f1ce..154a39f 100644 --- a/lustre/quota/quota_ctl.c +++ b/lustre/quota/quota_ctl.c @@ -289,8 +289,10 @@ int client_quota_ctl(struct obd_export *exp, struct obd_quotactl *oqctl) GOTO(out, rc); } - oqc = lustre_swab_repbuf(req, REPLY_REC_OFF, sizeof(*oqc), - lustre_swab_obd_quotactl); + oqc = NULL; + if (req->rq_repmsg) + oqc = lustre_swab_repbuf(req, REPLY_REC_OFF, sizeof(*oqc), + lustre_swab_obd_quotactl); if (oqc == NULL) { CERROR ("Can't unpack obd_quotactl\n"); GOTO(out, rc = -EPROTO); -- 1.8.3.1