This is a note to let you know that I've just added the patch titled
vfs: canonicalize create mode in build_open_flags()
to the 3.5-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
vfs-canonicalize-create-mode-in-build_open_flags.patch
and it can be found in the queue-3.5 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.
>From e68726ff72cf7ba5e7d789857fcd9a75ca573f03 Mon Sep 17 00:00:00 2001
From: Miklos Szeredi <[email protected]>
Date: Wed, 15 Aug 2012 13:01:24 +0200
Subject: vfs: canonicalize create mode in build_open_flags()
From: Miklos Szeredi <[email protected]>
commit e68726ff72cf7ba5e7d789857fcd9a75ca573f03 upstream.
Userspace can pass weird create mode in open(2) that we canonicalize to
"(mode & S_IALLUGO) | S_IFREG" in vfs_create().
The problem is that we use the uncanonicalized mode before calling vfs_create()
with unforseen consequences.
So do the canonicalization early in build_open_flags().
Signed-off-by: Miklos Szeredi <[email protected]>
Tested-by: Richard W.M. Jones <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
fs/open.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--- a/fs/open.c
+++ b/fs/open.c
@@ -930,9 +930,10 @@ static inline int build_open_flags(int f
int lookup_flags = 0;
int acc_mode;
- if (!(flags & O_CREAT))
- mode = 0;
- op->mode = mode;
+ if (flags & O_CREAT)
+ op->mode = (mode & S_IALLUGO) | S_IFREG;
+ else
+ op->mode = 0;
/* Must never be set by userspace */
flags &= ~FMODE_NONOTIFY;
Patches currently in stable-queue which might be from [email protected] are
queue-3.5/vfs-canonicalize-create-mode-in-build_open_flags.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html