During an HSM archive or restore, the progress is reported by the
copytool, in userspace. That value may be bogus. For instance, this
will crash the MDS in interval_set():
he.offset = -1;
he.length = 10;
rc = llapi_hsm_action_progress(hcp, &he, length, 0);
So check that userspace is giving a sane progress extent value.
Signed-off-by: frank zago <fzago@cray.com>
Change-Id: I0eb3fa9a66400a4ff3cee2f256c08e1d84744111
Reviewed-on: http://review.whamcloud.com/12285
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Jenkins
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Reviewed-by: Henri Doreau <henri.doreau@cea.fr>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
int rc, osz, nsz;
struct interval_node **new_vv;
struct interval_node *v, *node;
int rc, osz, nsz;
struct interval_node **new_vv;
struct interval_node *v, *node;
+ end = extent->offset + extent->length;
+ if (end <= extent->offset)
+ RETURN(-EINVAL);
+
mutex_lock(&crp->crp_lock);
/* new node index */
mutex_lock(&crp->crp_lock);
/* new node index */
v = crp->crp_node[crp->crp_cnt / NODE_VECTOR_SZ];
node = &v[crp->crp_cnt % NODE_VECTOR_SZ];
v = crp->crp_node[crp->crp_cnt / NODE_VECTOR_SZ];
node = &v[crp->crp_cnt % NODE_VECTOR_SZ];
- interval_set(node, extent->offset, extent->offset + extent->length);
+ interval_set(node, extent->offset, end);
/* try to insert, if entry already exist ignore the new one
* it can happen if ct sends 2 times the same progress */
if (interval_insert(node, &crp->crp_root) == NULL)
/* try to insert, if entry already exist ignore the new one
* it can happen if ct sends 2 times the same progress */
if (interval_insert(node, &crp->crp_root) == NULL)
rc = 0;
out:
mutex_unlock(&crp->crp_lock);
rc = 0;
out:
mutex_unlock(&crp->crp_lock);