From: miklos@szeredi.hu
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org
Subject: [patch 5/9] fuse: fix setting i_mode bits
Date: Thu, 09 Aug 2007 11:20:51 +0200 [thread overview]
Message-ID: <20070809092506.884721608@szeredi.hu> (raw)
In-Reply-To: <20070809092046.656183199@szeredi.hu>
[-- Attachment #1: fuse_mode_fix.patch --]
[-- Type: text/plain, Size: 1749 bytes --]
From: Miklos Szeredi <mszeredi@suse.cz>
The patch titled "fuse: fix permission checking on sticky directories"
removed all but the S_IFMT bits from i_mode.
However some of these are unfortunately used by the VFS, such as the
execute, suid and sgid bits.
So only remove the sticky bit, which is used for checking deletion
from a directory.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
Index: linux/fs/fuse/inode.c
===================================================================
--- linux.orig/fs/fuse/inode.c 2007-08-09 11:01:55.000000000 +0200
+++ linux/fs/fuse/inode.c 2007-08-09 11:04:26.000000000 +0200
@@ -124,14 +124,7 @@ void fuse_change_attributes(struct inode
loff_t oldsize;
inode->i_ino = attr->ino;
- fi->orig_i_mode = (inode->i_mode & S_IFMT) | (attr->mode & 07777);
- /*
- * Don't set the mode bits in i_mode, unless we want the VFS
- * to check permissions. This prevents failures due to the
- * sticky bit check in may_delete().
- */
- if (fc->flags & FUSE_DEFAULT_PERMISSIONS)
- inode->i_mode = fi->orig_i_mode;
+ inode->i_mode = (inode->i_mode & S_IFMT) | (attr->mode & 07777);
inode->i_nlink = attr->nlink;
inode->i_uid = attr->uid;
inode->i_gid = attr->gid;
@@ -143,6 +136,15 @@ void fuse_change_attributes(struct inode
inode->i_ctime.tv_sec = attr->ctime;
inode->i_ctime.tv_nsec = attr->ctimensec;
+ /*
+ * Don't set the sticky bit in i_mode, unless we want the VFS
+ * to check permissions. This prevents failures due to the
+ * check in may_delete().
+ */
+ fi->orig_i_mode = inode->i_mode;
+ if (!(fc->flags & FUSE_DEFAULT_PERMISSIONS))
+ inode->i_mode &= ~S_ISVTX;
+
spin_lock(&fc->lock);
oldsize = inode->i_size;
i_size_write(inode, attr->size);
--
next prev parent reply other threads:[~2007-08-09 9:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-09 9:20 [patch 0/9] assorted fixes and cleanups miklos
2007-08-09 9:20 ` [patch 1/9] unprivileged mounts: fix subtype handling miklos
2007-08-09 9:20 ` [patch 2/9] VFS: check nanoseconds in utimensat miklos
2007-08-09 9:20 ` [patch 3/9] fix execute checking in permission() miklos
2007-08-09 9:20 ` [patch 4/9] exec: remove unnecessary check for MNT_NOEXEC miklos
2007-08-09 9:20 ` miklos [this message]
2007-08-09 9:20 ` [patch 6/9] fuse: clean up execute permission checking miklos
2007-08-09 9:20 ` [patch 7/9] clean out unused code in dentry pruning miklos
2007-08-09 9:20 ` [patch 8/9] UML: remove unnecessary hostfs_getattr() miklos
2007-08-09 9:20 ` [patch 9/9] fix warnings is revoked_inode.c miklos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070809092506.884721608@szeredi.hu \
--to=miklos@szeredi.hu \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®