[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m1tytn23ee.fsf@fess.ebiederm.org>
Date: Thu, 11 Feb 2010 07:33:29 -0800
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Greg KH <gregkh@...e.de>
Cc: Jean Delvare <khali@...ux-fr.org>,
LKML <linux-kernel@...r.kernel.org>, Tejun Heo <tj@...nel.org>,
Serge Hallyn <serue@...ibm.com>
Subject: Re: [PATCH] sysfs: sysfs_sd_setattr set iattrs unconditionally
Greg I think this patch has slipped through the cracks.
Do I need to resend this regression fix or send it directly to Linus?
chmod and friends have been broken on sysfs since 2.6.32...
Eric
ebiederm@...ssion.com (Eric W. Biederman) writes:
> There is currently a bug in sysfs_sd_setattr inherited from
> sysfs_setattr in 2.6.32 where the first time we set the attributes
> on a sysfs file we allocate backing store but do not set the
> backing store attributes. Resulting in overly restrictive
> permissions on sysfs files.
>
> The fix is to simply modify the code so that it always executes
> when we update the sysfs attributes, as we did in 2.6.31 and earlier.
>
> Signed-off-by: Eric W. Biederman <ebiederm@...ssion.com>
> ---
> fs/sysfs/inode.c | 35 +++++++++++++++++------------------
> 1 files changed, 17 insertions(+), 18 deletions(-)
>
> diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
> index 220b758..6a06a1d 100644
> --- a/fs/sysfs/inode.c
> +++ b/fs/sysfs/inode.c
> @@ -81,24 +81,23 @@ int sysfs_sd_setattr(struct sysfs_dirent *sd, struct iattr * iattr)
> if (!sd_attrs)
> return -ENOMEM;
> sd->s_iattr = sd_attrs;
> - } else {
> - /* attributes were changed at least once in past */
> - iattrs = &sd_attrs->ia_iattr;
> -
> - if (ia_valid & ATTR_UID)
> - iattrs->ia_uid = iattr->ia_uid;
> - if (ia_valid & ATTR_GID)
> - iattrs->ia_gid = iattr->ia_gid;
> - if (ia_valid & ATTR_ATIME)
> - iattrs->ia_atime = iattr->ia_atime;
> - if (ia_valid & ATTR_MTIME)
> - iattrs->ia_mtime = iattr->ia_mtime;
> - if (ia_valid & ATTR_CTIME)
> - iattrs->ia_ctime = iattr->ia_ctime;
> - if (ia_valid & ATTR_MODE) {
> - umode_t mode = iattr->ia_mode;
> - iattrs->ia_mode = sd->s_mode = mode;
> - }
> + }
> + /* attributes were changed at least once in past */
> + iattrs = &sd_attrs->ia_iattr;
> +
> + if (ia_valid & ATTR_UID)
> + iattrs->ia_uid = iattr->ia_uid;
> + if (ia_valid & ATTR_GID)
> + iattrs->ia_gid = iattr->ia_gid;
> + if (ia_valid & ATTR_ATIME)
> + iattrs->ia_atime = iattr->ia_atime;
> + if (ia_valid & ATTR_MTIME)
> + iattrs->ia_mtime = iattr->ia_mtime;
> + if (ia_valid & ATTR_CTIME)
> + iattrs->ia_ctime = iattr->ia_ctime;
> + if (ia_valid & ATTR_MODE) {
> + umode_t mode = iattr->ia_mode;
> + iattrs->ia_mode = sd->s_mode = mode;
> }
> return 0;
> }
> --
> 1.6.5.2.143.g8cc62
--
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