From: Nathaniel Clark Date: Mon, 23 Jun 2014 01:32:07 +0000 (-0400) Subject: staging/lustre/llite: Only kill SGID/SUID bits X-Git-Tag: v5.15~17495^2~1360 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=98639249b3a9a10730078046c2f7e76756f96b50;p=platform%2Fkernel%2Flinux-starfive.git staging/lustre/llite: Only kill SGID/SUID bits Check that attr mode is valid before using it when determining if to clear SGID and SUID bits in ll_setattr. Signed-off-by: Nathaniel Clark Reviewed-on: http://review.whamcloud.com/10153 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4924 Reviewed-by: Lai Siyao Reviewed-by: Andreas Dilger Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index deca27e..7eadd60 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -1537,12 +1537,14 @@ int ll_setattr(struct dentry *de, struct iattr *attr) !(attr->ia_mode & S_ISGID)))) attr->ia_valid |= ATTR_FORCE; - if ((mode & S_ISUID) && + if ((attr->ia_valid & ATTR_MODE) && + (mode & S_ISUID) && !(attr->ia_mode & S_ISUID) && !(attr->ia_valid & ATTR_KILL_SUID)) attr->ia_valid |= ATTR_KILL_SUID; - if (((mode & (S_ISGID|S_IXGRP)) == (S_ISGID|S_IXGRP)) && + if ((attr->ia_valid & ATTR_MODE) && + ((mode & (S_ISGID|S_IXGRP)) == (S_ISGID|S_IXGRP)) && !(attr->ia_mode & S_ISGID) && !(attr->ia_valid & ATTR_KILL_SGID)) attr->ia_valid |= ATTR_KILL_SGID;