Whamcloud - gitweb
Branch b1_6
authortianzy <tianzy>
Fri, 31 Oct 2008 07:51:37 +0000 (07:51 +0000)
committertianzy <tianzy>
Fri, 31 Oct 2008 07:51:37 +0000 (07:51 +0000)
fix a possible NULL pointer in client_quota_ctl()
b=17486
i=johann
i=panda

lustre/ptlrpc/pack_generic.c
lustre/quota/quota_ctl.c

index 84ec8aa..2bafe82 100644 (file)
@@ -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);
index 900f1ce..154a39f 100644 (file)
@@ -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);