[PATCH 04/19] staging/lustre/llite: strengthen checks for hsm flags and archive id

2015-09-14 Thread green
From: Bruno Faccini <bruno.facc...@intel.com>

Prior to this patch undefined flags bits and out of range
archive id can be set.

Signed-off-by: Bruno Faccini <bruno.facc...@intel.com>
Reviewed-on: http://review.whamcloud.com/13337
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5757
Reviewed-by: frank zago <fz...@cray.com>
Reviewed-by: Henri Doreau <henri.dor...@cea.fr>
Signed-off-by: Oleg Drokin <oleg.dro...@intel.com>
---
 drivers/staging/lustre/lustre/include/lustre/lustre_idl.h | 7 +++
 drivers/staging/lustre/lustre/llite/file.c| 9 +
 2 files changed, 16 insertions(+)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h 
b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
index e79af19..9416d95 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
@@ -365,6 +365,13 @@ static inline __u64 fid_ver_oid(const struct lu_fid *fid)
return ((__u64)fid_ver(fid) << 32 | fid_oid(fid));
 }
 
+/* copytool uses a 32b bitmask field to encode archive-Ids during register
+ * with MDT thru kuc.
+ * archive num = 0 => all
+ * archive num from 1 to 32
+ */
+#define LL_HSM_MAX_ARCHIVE (sizeof(__u32) * 8)
+
 /**
  * Note that reserved SEQ numbers below 12 will conflict with ldiskfs
  * inodes in the IGIF namespace, so these reserved SEQ numbers can be
diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index e332326..b610032 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -2118,12 +2118,21 @@ static int ll_hsm_state_set(struct inode *inode, struct 
hsm_state_set *hss)
struct md_op_data   *op_data;
int  rc;
 
+   /* 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. */
if (((hss->hss_setmask | hss->hss_clearmask) & ~HSM_USER_MASK) &&
!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))
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Archive

2014-08-17 Thread Raphael Philipe
Where is the archive for this list?
I cannot find it.

Thank you.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: Archive

2014-08-17 Thread Greg KH
On Sun, Aug 17, 2014 at 09:46:34AM -0300, Raphael Philipe wrote:
 Where is the archive for this list?
 I cannot find it.
 
 Thank you.
 ___
 devel mailing list
 de...@linuxdriverproject.org
 http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Did you look at the link above?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: Archive

2014-08-17 Thread Raphael Philipe
I suspected that, but since the domain name is different
(de...@linuxdriverproject.org and de...@driverdev.osuosl.org) , I
thought that was better to ask.

I got to the mailing list de...@driverdev.osuosl.org while running the
get_mainteiner.pl script for a patch that I did.

What is the difference between those two address?

regards



On Sun, Aug 17, 2014 at 9:51 AM, Greg KH g...@kroah.com wrote:
 On Sun, Aug 17, 2014 at 09:46:34AM -0300, Raphael Philipe wrote:
 Where is the archive for this list?
 I cannot find it.

 Thank you.
 ___
 devel mailing list
 de...@linuxdriverproject.org
 http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

 Did you look at the link above?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: Archive

2014-08-17 Thread Greg KH

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

On Sun, Aug 17, 2014 at 10:01:59AM -0300, Raphael Philipe wrote:
 I suspected that, but since the domain name is different
 (de...@linuxdriverproject.org and de...@driverdev.osuosl.org) , I
 thought that was better to ask.
 
 I got to the mailing list de...@driverdev.osuosl.org while running the
 get_mainteiner.pl script for a patch that I did.
 
 What is the difference between those two address?

There is none, it's just how dns works with the box we used to use for
hosting the mailing list, sorry for the confusion.

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel