mirror of
https://github.com/torvalds/linux.git
synced 2024-09-21 15:33:19 +00:00
staging/lustre/obdecho: Better handle invalid create requests
When gettng an invalid create request in echo code (wrong group, or no group at all), just return an error instead of crashing. Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
61ece0e60d
commit
01de911e14
|
@ -1210,8 +1210,10 @@ static int echo_create_object(const struct lu_env *env, struct echo_device *ed,
|
|||
int rc;
|
||||
int created = 0;
|
||||
|
||||
if ((oa->o_valid & OBD_MD_FLID) == 0) { /* no obj id */
|
||||
CERROR("No valid oid\n");
|
||||
if (!(oa->o_valid & OBD_MD_FLID) ||
|
||||
!(oa->o_valid & OBD_MD_FLGROUP) ||
|
||||
!fid_seq_is_echo(ostid_seq(&oa->o_oi))) {
|
||||
CERROR("invalid oid " DOSTID "\n", POSTID(&oa->o_oi));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -1222,16 +1224,11 @@ static int echo_create_object(const struct lu_env *env, struct echo_device *ed,
|
|||
}
|
||||
|
||||
/* setup object ID here */
|
||||
LASSERT(oa->o_valid & OBD_MD_FLGROUP);
|
||||
lsm->lsm_oi = oa->o_oi;
|
||||
|
||||
if (ostid_id(&lsm->lsm_oi) == 0)
|
||||
ostid_set_id(&lsm->lsm_oi, ++last_object_id);
|
||||
|
||||
/* Only echo objects are allowed to be created */
|
||||
LASSERT((oa->o_valid & OBD_MD_FLGROUP) &&
|
||||
(ostid_seq(&oa->o_oi) == FID_SEQ_ECHO));
|
||||
|
||||
rc = obd_create(env, ec->ec_exp, oa, &lsm, oti);
|
||||
if (rc != 0) {
|
||||
CERROR("Cannot create objects: rc = %d\n", rc);
|
||||
|
|
Loading…
Reference in New Issue
Block a user