[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1217428647.20373.235.camel@moss-spartans.epoch.ncsc.mil>
Date: Wed, 30 Jul 2008 10:37:27 -0400
From: Stephen Smalley <sds@...ho.nsa.gov>
To: Miklos Szeredi <miklos@...redi.hu>
Cc: viro@...IV.linux.org.uk, akpm@...ux-foundation.org,
jmorris@...ei.org, linux-security-module@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [patch] vfs: make security_inode_setattr() calling consistent
On Wed, 2008-07-30 at 14:06 +0200, Miklos Szeredi wrote:
> From: Miklos Szeredi <mszeredi@...e.cz>
>
> Call security_inode_setattr() consistetly before inode_change_ok().
> It doesn't make sense to try to "optimize" the i_op->setattr == NULL
> case, as most filesystem do define their own setattr function.
>
> Signed-off-by: Miklos Szeredi <mszeredi@...e.cz>
Unfortunate since we'd prefer to have the DAC checks applied first, and
since inode_change_ok() may alter the ia_mode in response to those
checks, but it does seem inconsistent at present and it doesn't yield
any difference in the ltp selinux testsuite results.
Acked-by: Stephen Smalley <sds@...ho.nsa.gov>
> ---
> fs/attr.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> Index: linux-2.6/fs/attr.c
> ===================================================================
> --- linux-2.6.orig/fs/attr.c 2008-07-30 13:52:35.000000000 +0200
> +++ linux-2.6/fs/attr.c 2008-07-30 13:52:41.000000000 +0200
> @@ -159,17 +159,17 @@ int notify_change(struct dentry * dentry
> if (!(attr->ia_valid & ~(ATTR_KILL_SUID | ATTR_KILL_SGID)))
> return 0;
>
> + error = security_inode_setattr(dentry, attr);
> + if (error)
> + return error;
> +
> if (ia_valid & ATTR_SIZE)
> down_write(&dentry->d_inode->i_alloc_sem);
>
> if (inode->i_op && inode->i_op->setattr) {
> - error = security_inode_setattr(dentry, attr);
> - if (!error)
> - error = inode->i_op->setattr(dentry, attr);
> + error = inode->i_op->setattr(dentry, attr);
> } else {
> error = inode_change_ok(inode, attr);
> - if (!error)
> - error = security_inode_setattr(dentry, attr);
> if (!error) {
> if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
> (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid))
--
Stephen Smalley
National Security Agency
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists