diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2010-02-15 19:46:15 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2010-02-16 01:26:36 -0500 |
commit | 97d6931ead3e89a764cdaa3ad0924037367f0d34 (patch) | |
tree | ad69e76208832699a97e897af73b6aa23a655609 /security/tomoyo/tomoyo.c | |
parent | 7ef612331fb219620cc1abfc2446bb027d388aa0 (diff) |
TOMOYO: Remove unneeded parameter.
tomoyo_path_perm() tomoyo_path2_perm() and tomoyo_check_rewrite_permission()
always receive tomoyo_domain(). We can move it from caller to callee.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/tomoyo/tomoyo.c')
-rw-r--r-- | security/tomoyo/tomoyo.c | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/security/tomoyo/tomoyo.c b/security/tomoyo/tomoyo.c index e3945d0511b8..c94e35c3c759 100644 --- a/security/tomoyo/tomoyo.c +++ b/security/tomoyo/tomoyo.c | |||
@@ -100,33 +100,33 @@ static int tomoyo_bprm_check_security(struct linux_binprm *bprm) | |||
100 | static int tomoyo_path_truncate(struct path *path, loff_t length, | 100 | static int tomoyo_path_truncate(struct path *path, loff_t length, |
101 | unsigned int time_attrs) | 101 | unsigned int time_attrs) |
102 | { | 102 | { |
103 | return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_TRUNCATE, path); | 103 | return tomoyo_path_perm(TOMOYO_TYPE_TRUNCATE, path); |
104 | } | 104 | } |
105 | 105 | ||
106 | static int tomoyo_path_unlink(struct path *parent, struct dentry *dentry) | 106 | static int tomoyo_path_unlink(struct path *parent, struct dentry *dentry) |
107 | { | 107 | { |
108 | struct path path = { parent->mnt, dentry }; | 108 | struct path path = { parent->mnt, dentry }; |
109 | return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_UNLINK, &path); | 109 | return tomoyo_path_perm(TOMOYO_TYPE_UNLINK, &path); |
110 | } | 110 | } |
111 | 111 | ||
112 | static int tomoyo_path_mkdir(struct path *parent, struct dentry *dentry, | 112 | static int tomoyo_path_mkdir(struct path *parent, struct dentry *dentry, |
113 | int mode) | 113 | int mode) |
114 | { | 114 | { |
115 | struct path path = { parent->mnt, dentry }; | 115 | struct path path = { parent->mnt, dentry }; |
116 | return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_MKDIR, &path); | 116 | return tomoyo_path_perm(TOMOYO_TYPE_MKDIR, &path); |
117 | } | 117 | } |
118 | 118 | ||
119 | static int tomoyo_path_rmdir(struct path *parent, struct dentry *dentry) | 119 | static int tomoyo_path_rmdir(struct path *parent, struct dentry *dentry) |
120 | { | 120 | { |
121 | struct path path = { parent->mnt, dentry }; | 121 | struct path path = { parent->mnt, dentry }; |
122 | return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_RMDIR, &path); | 122 | return tomoyo_path_perm(TOMOYO_TYPE_RMDIR, &path); |
123 | } | 123 | } |
124 | 124 | ||
125 | static int tomoyo_path_symlink(struct path *parent, struct dentry *dentry, | 125 | static int tomoyo_path_symlink(struct path *parent, struct dentry *dentry, |
126 | const char *old_name) | 126 | const char *old_name) |
127 | { | 127 | { |
128 | struct path path = { parent->mnt, dentry }; | 128 | struct path path = { parent->mnt, dentry }; |
129 | return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_SYMLINK, &path); | 129 | return tomoyo_path_perm(TOMOYO_TYPE_SYMLINK, &path); |
130 | } | 130 | } |
131 | 131 | ||
132 | static int tomoyo_path_mknod(struct path *parent, struct dentry *dentry, | 132 | static int tomoyo_path_mknod(struct path *parent, struct dentry *dentry, |
@@ -149,7 +149,7 @@ static int tomoyo_path_mknod(struct path *parent, struct dentry *dentry, | |||
149 | type = TOMOYO_TYPE_MKSOCK; | 149 | type = TOMOYO_TYPE_MKSOCK; |
150 | break; | 150 | break; |
151 | } | 151 | } |
152 | return tomoyo_path_perm(tomoyo_domain(), type, &path); | 152 | return tomoyo_path_perm(type, &path); |
153 | } | 153 | } |
154 | 154 | ||
155 | static int tomoyo_path_link(struct dentry *old_dentry, struct path *new_dir, | 155 | static int tomoyo_path_link(struct dentry *old_dentry, struct path *new_dir, |
@@ -157,8 +157,7 @@ static int tomoyo_path_link(struct dentry *old_dentry, struct path *new_dir, | |||
157 | { | 157 | { |
158 | struct path path1 = { new_dir->mnt, old_dentry }; | 158 | struct path path1 = { new_dir->mnt, old_dentry }; |
159 | struct path path2 = { new_dir->mnt, new_dentry }; | 159 | struct path path2 = { new_dir->mnt, new_dentry }; |
160 | return tomoyo_path2_perm(tomoyo_domain(), TOMOYO_TYPE_LINK, &path1, | 160 | return tomoyo_path2_perm(TOMOYO_TYPE_LINK, &path1, &path2); |
161 | &path2); | ||
162 | } | 161 | } |
163 | 162 | ||
164 | static int tomoyo_path_rename(struct path *old_parent, | 163 | static int tomoyo_path_rename(struct path *old_parent, |
@@ -168,15 +167,14 @@ static int tomoyo_path_rename(struct path *old_parent, | |||
168 | { | 167 | { |
169 | struct path path1 = { old_parent->mnt, old_dentry }; | 168 | struct path path1 = { old_parent->mnt, old_dentry }; |
170 | struct path path2 = { new_parent->mnt, new_dentry }; | 169 | struct path path2 = { new_parent->mnt, new_dentry }; |
171 | return tomoyo_path2_perm(tomoyo_domain(), TOMOYO_TYPE_RENAME, &path1, | 170 | return tomoyo_path2_perm(TOMOYO_TYPE_RENAME, &path1, &path2); |
172 | &path2); | ||
173 | } | 171 | } |
174 | 172 | ||
175 | static int tomoyo_file_fcntl(struct file *file, unsigned int cmd, | 173 | static int tomoyo_file_fcntl(struct file *file, unsigned int cmd, |
176 | unsigned long arg) | 174 | unsigned long arg) |
177 | { | 175 | { |
178 | if (cmd == F_SETFL && ((arg ^ file->f_flags) & O_APPEND)) | 176 | if (cmd == F_SETFL && ((arg ^ file->f_flags) & O_APPEND)) |
179 | return tomoyo_check_rewrite_permission(tomoyo_domain(), file); | 177 | return tomoyo_check_rewrite_permission(file); |
180 | return 0; | 178 | return 0; |
181 | } | 179 | } |
182 | 180 | ||
@@ -196,50 +194,46 @@ static int tomoyo_dentry_open(struct file *f, const struct cred *cred) | |||
196 | static int tomoyo_file_ioctl(struct file *file, unsigned int cmd, | 194 | static int tomoyo_file_ioctl(struct file *file, unsigned int cmd, |
197 | unsigned long arg) | 195 | unsigned long arg) |
198 | { | 196 | { |
199 | return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_IOCTL, | 197 | return tomoyo_path_perm(TOMOYO_TYPE_IOCTL, &file->f_path); |
200 | &file->f_path); | ||
201 | } | 198 | } |
202 | 199 | ||
203 | static int tomoyo_path_chmod(struct dentry *dentry, struct vfsmount *mnt, | 200 | static int tomoyo_path_chmod(struct dentry *dentry, struct vfsmount *mnt, |
204 | mode_t mode) | 201 | mode_t mode) |
205 | { | 202 | { |
206 | struct path path = { mnt, dentry }; | 203 | struct path path = { mnt, dentry }; |
207 | return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_CHMOD, &path); | 204 | return tomoyo_path_perm(TOMOYO_TYPE_CHMOD, &path); |
208 | } | 205 | } |
209 | 206 | ||
210 | static int tomoyo_path_chown(struct path *path, uid_t uid, gid_t gid) | 207 | static int tomoyo_path_chown(struct path *path, uid_t uid, gid_t gid) |
211 | { | 208 | { |
212 | int error = 0; | 209 | int error = 0; |
213 | if (uid != (uid_t) -1) | 210 | if (uid != (uid_t) -1) |
214 | error = tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_CHOWN, | 211 | error = tomoyo_path_perm(TOMOYO_TYPE_CHOWN, path); |
215 | path); | ||
216 | if (!error && gid != (gid_t) -1) | 212 | if (!error && gid != (gid_t) -1) |
217 | error = tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_CHGRP, | 213 | error = tomoyo_path_perm(TOMOYO_TYPE_CHGRP, path); |
218 | path); | ||
219 | return error; | 214 | return error; |
220 | } | 215 | } |
221 | 216 | ||
222 | static int tomoyo_path_chroot(struct path *path) | 217 | static int tomoyo_path_chroot(struct path *path) |
223 | { | 218 | { |
224 | return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_CHROOT, path); | 219 | return tomoyo_path_perm(TOMOYO_TYPE_CHROOT, path); |
225 | } | 220 | } |
226 | 221 | ||
227 | static int tomoyo_sb_mount(char *dev_name, struct path *path, | 222 | static int tomoyo_sb_mount(char *dev_name, struct path *path, |
228 | char *type, unsigned long flags, void *data) | 223 | char *type, unsigned long flags, void *data) |
229 | { | 224 | { |
230 | return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_MOUNT, path); | 225 | return tomoyo_path_perm(TOMOYO_TYPE_MOUNT, path); |
231 | } | 226 | } |
232 | 227 | ||
233 | static int tomoyo_sb_umount(struct vfsmount *mnt, int flags) | 228 | static int tomoyo_sb_umount(struct vfsmount *mnt, int flags) |
234 | { | 229 | { |
235 | struct path path = { mnt, mnt->mnt_root }; | 230 | struct path path = { mnt, mnt->mnt_root }; |
236 | return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_UMOUNT, &path); | 231 | return tomoyo_path_perm(TOMOYO_TYPE_UMOUNT, &path); |
237 | } | 232 | } |
238 | 233 | ||
239 | static int tomoyo_sb_pivotroot(struct path *old_path, struct path *new_path) | 234 | static int tomoyo_sb_pivotroot(struct path *old_path, struct path *new_path) |
240 | { | 235 | { |
241 | return tomoyo_path2_perm(tomoyo_domain(), TOMOYO_TYPE_PIVOT_ROOT, | 236 | return tomoyo_path2_perm(TOMOYO_TYPE_PIVOT_ROOT, new_path, old_path); |
242 | new_path, old_path); | ||
243 | } | 237 | } |
244 | 238 | ||
245 | /* | 239 | /* |