linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] anon_inode: set S_IFREG on the anon_inode
@ 2010-05-14 20:05 Eric Paris
  2010-05-14 20:23 ` Al Viro
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Paris @ 2010-05-14 20:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: viro, akpm, npiggin

anon_inode_mkinode() sets inode->i_mode = S_IRUSR | S_IWUSR;  This means
that (inode->i_mode & S_IFMT) == 0.  This trips up some SELinux code that
needs to determine if a given inode is a regular file, a directory, etc.
The easiest solution is to just make sure that the anon_inode also sets
S_IFREG.

Signed-off-by: Eric Paris <eparis@redhat.com>
---

 fs/anon_inodes.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
index e4b75d6..9bd4b38 100644
--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@ -205,7 +205,7 @@ static struct inode *anon_inode_mkinode(void)
 	 * that it already _is_ on the dirty list.
 	 */
 	inode->i_state = I_DIRTY;
-	inode->i_mode = S_IRUSR | S_IWUSR;
+	inode->i_mode = S_IFREG | S_IRUSR | S_IWUSR;
 	inode->i_uid = current_fsuid();
 	inode->i_gid = current_fsgid();
 	inode->i_flags |= S_PRIVATE;


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-05-14 20:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-14 20:05 [PATCH] anon_inode: set S_IFREG on the anon_inode Eric Paris
2010-05-14 20:23 ` Al Viro
2010-05-14 20:26   ` Eric Paris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).