浏览代码

tomoyo: Fix pathname calculation breakage.

Commit 7177a9c4b509 ("fs: call rename2 if exists") changed
"struct inode_operations"->rename == NULL if
"struct inode_operations"->rename2 != NULL .

TOMOYO needs to check for both ->rename and ->rename2 , or
a system on (e.g.) ext4 filesystem won't boot.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Tetsuo Handa 11 年之前
父节点
当前提交
8fe7a268b1
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      security/tomoyo/realpath.c

+ 3 - 2
security/tomoyo/realpath.c

@@ -173,7 +173,7 @@ static char *tomoyo_get_local_path(struct dentry *dentry, char * const buffer,
 		 * Use filesystem name if filesystem does not support rename()
 		 * Use filesystem name if filesystem does not support rename()
 		 * operation.
 		 * operation.
 		 */
 		 */
-		if (!inode->i_op->rename)
+		if (!inode->i_op->rename && !inode->i_op->rename2)
 			goto prepend_filesystem_name;
 			goto prepend_filesystem_name;
 	}
 	}
 	/* Prepend device name. */
 	/* Prepend device name. */
@@ -282,7 +282,8 @@ char *tomoyo_realpath_from_path(struct path *path)
 		 * Get local name for filesystems without rename() operation
 		 * Get local name for filesystems without rename() operation
 		 * or dentry without vfsmount.
 		 * or dentry without vfsmount.
 		 */
 		 */
-		if (!path->mnt || !inode->i_op->rename)
+		if (!path->mnt ||
+		    (!inode->i_op->rename && !inode->i_op->rename2))
 			pos = tomoyo_get_local_path(path->dentry, buf,
 			pos = tomoyo_get_local_path(path->dentry, buf,
 						    buf_len - 1);
 						    buf_len - 1);
 		/* Get absolute name for the rest. */
 		/* Get absolute name for the rest. */