Whamcloud - gitweb
Branch b1_6
authoranserper <anserper>
Fri, 22 Feb 2008 23:09:55 +0000 (23:09 +0000)
committeranserper <anserper>
Fri, 22 Feb 2008 23:09:55 +0000 (23:09 +0000)
b=14852
i=shadow
i=adilger

additional id checks

lustre/osc/osc_request.c
lustre/ost/ost_handler.c
lustre/utils/obd.c

index 5839884..48da882 100644 (file)
@@ -626,6 +626,8 @@ static int osc_destroy(struct obd_export *exp, struct obdo *oa,
                 RETURN(-EINVAL);
         }
 
+        LASSERT(oa->o_id != 0);
+
         count = osc_resource_get_unused(exp, oa->o_id, &cancels, LCK_PW,
                                         LDLM_FL_DISCARD_DATA);
         if (exp_connect_cancelset(exp))
@@ -3371,6 +3373,10 @@ static int osc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                 if (!capable (CAP_SYS_ADMIN))
                         GOTO (out, err = -EPERM);
                 oa = &data->ioc_obdo1;
+
+                if (oa->o_id == 0)
+                        GOTO(out, err = -EINVAL);
+
                 oa->o_valid |= OBD_MD_FLGROUP;
 
                 err = osc_destroy(exp, oa, NULL, NULL, NULL);
index 7e8960c..e67da31 100644 (file)
@@ -96,6 +96,9 @@ static int ost_destroy(struct obd_export *exp, struct ptlrpc_request *req,
         if (body == NULL)
                 RETURN(-EFAULT);
 
+        if (body->oa.o_id == 0)
+                RETURN(-EPROTO);
+
         if (lustre_msg_buflen(req->rq_reqmsg, REQ_REC_OFF + 1)) {
                 struct ldlm_request *dlm;
                 dlm = lustre_swab_reqbuf(req, REQ_REC_OFF + 1, sizeof(*dlm),
index 387897e..4b03997 100644 (file)
@@ -1170,7 +1170,7 @@ int jt_obd_destroy(int argc, char **argv)
                 return CMD_HELP;
 
         id = strtoull(argv[1], &end, 0);
-        if (*end) {
+        if (*end || id == 0 || errno != 0) {
                 fprintf(stderr, "error: %s: invalid objid '%s'\n",
                         jt_cmdname(argv[0]), argv[1]);
                 return CMD_HELP;