From 4461472701b12b14acfdcc2f3309926da269bd87 Mon Sep 17 00:00:00 2001 From: anserper Date: Fri, 22 Feb 2008 23:09:55 +0000 Subject: [PATCH] Branch b1_6 b=14852 i=shadow i=adilger additional id checks --- lustre/osc/osc_request.c | 6 ++++++ lustre/ost/ost_handler.c | 3 +++ lustre/utils/obd.c | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 5839884..48da882 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -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); diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 7e8960c..e67da31 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -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), diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c index 387897e..4b03997 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -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; -- 1.8.3.1