diff options
author | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2013-04-14 09:21:47 -0400 |
---|---|---|
committer | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2013-06-20 07:47:49 -0400 |
commit | 37ec43cdc4c776bd39aae469fdfa494bdf0344c7 (patch) | |
tree | 589b7010500c1a159ef25a6d4ce71d91c5ab765e | |
parent | 8912176ce04368d3a0699860c5a0cc64c49a1eba (diff) |
evm: calculate HMAC after initializing posix acl on tmpfs
Included in the EVM hmac calculation is the i_mode. Any changes to
the i_mode need to be reflected in the hmac. shmem_mknod() currently
calls generic_acl_init(), which modifies the i_mode, after calling
security_inode_init_security(). This patch reverses the order in
which they are called.
Reported-by: Sven Vermeulen <sven.vermeulen@siphos.be>
Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Acked-by: Hugh Dickins <hughd@google.com>
-rw-r--r-- | mm/shmem.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index 5e6a8422658b..a8e10722f8dc 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -1939,6 +1939,13 @@ shmem_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) | |||
1939 | 1939 | ||
1940 | inode = shmem_get_inode(dir->i_sb, dir, mode, dev, VM_NORESERVE); | 1940 | inode = shmem_get_inode(dir->i_sb, dir, mode, dev, VM_NORESERVE); |
1941 | if (inode) { | 1941 | if (inode) { |
1942 | #ifdef CONFIG_TMPFS_POSIX_ACL | ||
1943 | error = generic_acl_init(inode, dir); | ||
1944 | if (error) { | ||
1945 | iput(inode); | ||
1946 | return error; | ||
1947 | } | ||
1948 | #endif | ||
1942 | error = security_inode_init_security(inode, dir, | 1949 | error = security_inode_init_security(inode, dir, |
1943 | &dentry->d_name, | 1950 | &dentry->d_name, |
1944 | shmem_initxattrs, NULL); | 1951 | shmem_initxattrs, NULL); |
@@ -1948,15 +1955,8 @@ shmem_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) | |||
1948 | return error; | 1955 | return error; |
1949 | } | 1956 | } |
1950 | } | 1957 | } |
1951 | #ifdef CONFIG_TMPFS_POSIX_ACL | 1958 | |
1952 | error = generic_acl_init(inode, dir); | ||
1953 | if (error) { | ||
1954 | iput(inode); | ||
1955 | return error; | ||
1956 | } | ||
1957 | #else | ||
1958 | error = 0; | 1959 | error = 0; |
1959 | #endif | ||
1960 | dir->i_size += BOGO_DIRENT_SIZE; | 1960 | dir->i_size += BOGO_DIRENT_SIZE; |
1961 | dir->i_ctime = dir->i_mtime = CURRENT_TIME; | 1961 | dir->i_ctime = dir->i_mtime = CURRENT_TIME; |
1962 | d_instantiate(dentry, inode); | 1962 | d_instantiate(dentry, inode); |