Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
LU-5757 hsm: strengthen checks for flags and archive id
[fs/lustre-release.git]
/
lustre
/
llite
/
file.c
diff --git
a/lustre/llite/file.c
b/lustre/llite/file.c
index
7d9c922
..
99b790f
100644
(file)
--- a/
lustre/llite/file.c
+++ b/
lustre/llite/file.c
@@
-2106,6
+2106,11
@@
static int ll_hsm_state_set(struct inode *inode, struct hsm_state_set *hss)
{
struct md_op_data *op_data;
int rc;
+ ENTRY;
+
+ /* Detect out-of range masks */
+ if ((hss->hss_setmask | hss->hss_clearmask) & ~HSM_FLAGS_MASK)
+ RETURN(-EINVAL);
/* Non-root users are forbidden to set or clear flags which are
* NOT defined in HSM_USER_MASK. */
@@
-2113,6
+2118,11
@@
static int ll_hsm_state_set(struct inode *inode, struct hsm_state_set *hss)
!cfs_capable(CFS_CAP_SYS_ADMIN))
RETURN(-EPERM);
+ /* Detect out-of range archive id */
+ if ((hss->hss_valid & HSS_ARCHIVE_ID) &&
+ (hss->hss_archive_id > LL_HSM_MAX_ARCHIVE))
+ RETURN(-EINVAL);
+
op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0,
LUSTRE_OPC_ANY, hss);
if (IS_ERR(op_data))