Commit 314f70fd967064c7fa0734908f5feae6ac2831a9
Committed by
Linus Torvalds
1 parent
c277e63fbe
Exists in
master
and in
4 other branches
whitespace fixes: capability syscalls
Large chunks of 5 spaces instead of tabs. Signed-off-by: Daniel Walker <dwalker@mvista.com> Cc: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 95 additions and 95 deletions Side-by-side Diff
kernel/capability.c
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | * |
6 | 6 | * Integrated into 2.1.97+, Andrew G. Morgan <morgan@kernel.org> |
7 | 7 | * 30 May 2002: Cleanup, Robert M. Love <rml@tech9.net> |
8 | - */ | |
8 | + */ | |
9 | 9 | |
10 | 10 | #include <linux/capability.h> |
11 | 11 | #include <linux/mm.h> |
12 | 12 | |
13 | 13 | |
14 | 14 | |
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | 18 | |
19 | 19 | |
20 | 20 | |
21 | 21 | |
... | ... | @@ -37,49 +37,49 @@ |
37 | 37 | */ |
38 | 38 | asmlinkage long sys_capget(cap_user_header_t header, cap_user_data_t dataptr) |
39 | 39 | { |
40 | - int ret = 0; | |
41 | - pid_t pid; | |
42 | - __u32 version; | |
43 | - struct task_struct *target; | |
44 | - struct __user_cap_data_struct data; | |
40 | + int ret = 0; | |
41 | + pid_t pid; | |
42 | + __u32 version; | |
43 | + struct task_struct *target; | |
44 | + struct __user_cap_data_struct data; | |
45 | 45 | |
46 | - if (get_user(version, &header->version)) | |
47 | - return -EFAULT; | |
46 | + if (get_user(version, &header->version)) | |
47 | + return -EFAULT; | |
48 | 48 | |
49 | - if (version != _LINUX_CAPABILITY_VERSION) { | |
50 | - if (put_user(_LINUX_CAPABILITY_VERSION, &header->version)) | |
51 | - return -EFAULT; | |
52 | - return -EINVAL; | |
53 | - } | |
49 | + if (version != _LINUX_CAPABILITY_VERSION) { | |
50 | + if (put_user(_LINUX_CAPABILITY_VERSION, &header->version)) | |
51 | + return -EFAULT; | |
52 | + return -EINVAL; | |
53 | + } | |
54 | 54 | |
55 | - if (get_user(pid, &header->pid)) | |
56 | - return -EFAULT; | |
55 | + if (get_user(pid, &header->pid)) | |
56 | + return -EFAULT; | |
57 | 57 | |
58 | - if (pid < 0) | |
59 | - return -EINVAL; | |
58 | + if (pid < 0) | |
59 | + return -EINVAL; | |
60 | 60 | |
61 | - spin_lock(&task_capability_lock); | |
62 | - read_lock(&tasklist_lock); | |
61 | + spin_lock(&task_capability_lock); | |
62 | + read_lock(&tasklist_lock); | |
63 | 63 | |
64 | - if (pid && pid != current->pid) { | |
65 | - target = find_task_by_pid(pid); | |
66 | - if (!target) { | |
67 | - ret = -ESRCH; | |
68 | - goto out; | |
69 | - } | |
70 | - } else | |
71 | - target = current; | |
64 | + if (pid && pid != current->pid) { | |
65 | + target = find_task_by_pid(pid); | |
66 | + if (!target) { | |
67 | + ret = -ESRCH; | |
68 | + goto out; | |
69 | + } | |
70 | + } else | |
71 | + target = current; | |
72 | 72 | |
73 | - ret = security_capget(target, &data.effective, &data.inheritable, &data.permitted); | |
73 | + ret = security_capget(target, &data.effective, &data.inheritable, &data.permitted); | |
74 | 74 | |
75 | 75 | out: |
76 | - read_unlock(&tasklist_lock); | |
77 | - spin_unlock(&task_capability_lock); | |
76 | + read_unlock(&tasklist_lock); | |
77 | + spin_unlock(&task_capability_lock); | |
78 | 78 | |
79 | - if (!ret && copy_to_user(dataptr, &data, sizeof data)) | |
80 | - return -EFAULT; | |
79 | + if (!ret && copy_to_user(dataptr, &data, sizeof data)) | |
80 | + return -EFAULT; | |
81 | 81 | |
82 | - return ret; | |
82 | + return ret; | |
83 | 83 | } |
84 | 84 | |
85 | 85 | /* |
... | ... | @@ -112,7 +112,7 @@ |
112 | 112 | } while_each_pid_task(pgrp, PIDTYPE_PGID, g); |
113 | 113 | |
114 | 114 | if (!found) |
115 | - ret = 0; | |
115 | + ret = 0; | |
116 | 116 | return ret; |
117 | 117 | } |
118 | 118 | |
119 | 119 | |
120 | 120 | |
121 | 121 | |
122 | 122 | |
123 | 123 | |
124 | 124 | |
125 | 125 | |
126 | 126 | |
127 | 127 | |
128 | 128 | |
129 | 129 | |
130 | 130 | |
... | ... | @@ -166,68 +166,68 @@ |
166 | 166 | */ |
167 | 167 | asmlinkage long sys_capset(cap_user_header_t header, const cap_user_data_t data) |
168 | 168 | { |
169 | - kernel_cap_t inheritable, permitted, effective; | |
170 | - __u32 version; | |
171 | - struct task_struct *target; | |
172 | - int ret; | |
173 | - pid_t pid; | |
169 | + kernel_cap_t inheritable, permitted, effective; | |
170 | + __u32 version; | |
171 | + struct task_struct *target; | |
172 | + int ret; | |
173 | + pid_t pid; | |
174 | 174 | |
175 | - if (get_user(version, &header->version)) | |
176 | - return -EFAULT; | |
175 | + if (get_user(version, &header->version)) | |
176 | + return -EFAULT; | |
177 | 177 | |
178 | - if (version != _LINUX_CAPABILITY_VERSION) { | |
179 | - if (put_user(_LINUX_CAPABILITY_VERSION, &header->version)) | |
180 | - return -EFAULT; | |
181 | - return -EINVAL; | |
182 | - } | |
178 | + if (version != _LINUX_CAPABILITY_VERSION) { | |
179 | + if (put_user(_LINUX_CAPABILITY_VERSION, &header->version)) | |
180 | + return -EFAULT; | |
181 | + return -EINVAL; | |
182 | + } | |
183 | 183 | |
184 | - if (get_user(pid, &header->pid)) | |
185 | - return -EFAULT; | |
184 | + if (get_user(pid, &header->pid)) | |
185 | + return -EFAULT; | |
186 | 186 | |
187 | - if (pid && pid != current->pid && !capable(CAP_SETPCAP)) | |
188 | - return -EPERM; | |
187 | + if (pid && pid != current->pid && !capable(CAP_SETPCAP)) | |
188 | + return -EPERM; | |
189 | 189 | |
190 | - if (copy_from_user(&effective, &data->effective, sizeof(effective)) || | |
191 | - copy_from_user(&inheritable, &data->inheritable, sizeof(inheritable)) || | |
192 | - copy_from_user(&permitted, &data->permitted, sizeof(permitted))) | |
193 | - return -EFAULT; | |
190 | + if (copy_from_user(&effective, &data->effective, sizeof(effective)) || | |
191 | + copy_from_user(&inheritable, &data->inheritable, sizeof(inheritable)) || | |
192 | + copy_from_user(&permitted, &data->permitted, sizeof(permitted))) | |
193 | + return -EFAULT; | |
194 | 194 | |
195 | - spin_lock(&task_capability_lock); | |
196 | - read_lock(&tasklist_lock); | |
195 | + spin_lock(&task_capability_lock); | |
196 | + read_lock(&tasklist_lock); | |
197 | 197 | |
198 | - if (pid > 0 && pid != current->pid) { | |
199 | - target = find_task_by_pid(pid); | |
200 | - if (!target) { | |
201 | - ret = -ESRCH; | |
202 | - goto out; | |
203 | - } | |
204 | - } else | |
205 | - target = current; | |
198 | + if (pid > 0 && pid != current->pid) { | |
199 | + target = find_task_by_pid(pid); | |
200 | + if (!target) { | |
201 | + ret = -ESRCH; | |
202 | + goto out; | |
203 | + } | |
204 | + } else | |
205 | + target = current; | |
206 | 206 | |
207 | - ret = 0; | |
207 | + ret = 0; | |
208 | 208 | |
209 | - /* having verified that the proposed changes are legal, | |
210 | - we now put them into effect. */ | |
211 | - if (pid < 0) { | |
212 | - if (pid == -1) /* all procs other than current and init */ | |
213 | - ret = cap_set_all(&effective, &inheritable, &permitted); | |
209 | + /* having verified that the proposed changes are legal, | |
210 | + we now put them into effect. */ | |
211 | + if (pid < 0) { | |
212 | + if (pid == -1) /* all procs other than current and init */ | |
213 | + ret = cap_set_all(&effective, &inheritable, &permitted); | |
214 | 214 | |
215 | - else /* all procs in process group */ | |
216 | - ret = cap_set_pg(-pid, &effective, &inheritable, | |
217 | - &permitted); | |
218 | - } else { | |
219 | - ret = security_capset_check(target, &effective, &inheritable, | |
220 | - &permitted); | |
221 | - if (!ret) | |
222 | - security_capset_set(target, &effective, &inheritable, | |
223 | - &permitted); | |
224 | - } | |
215 | + else /* all procs in process group */ | |
216 | + ret = cap_set_pg(-pid, &effective, &inheritable, | |
217 | + &permitted); | |
218 | + } else { | |
219 | + ret = security_capset_check(target, &effective, &inheritable, | |
220 | + &permitted); | |
221 | + if (!ret) | |
222 | + security_capset_set(target, &effective, &inheritable, | |
223 | + &permitted); | |
224 | + } | |
225 | 225 | |
226 | 226 | out: |
227 | - read_unlock(&tasklist_lock); | |
228 | - spin_unlock(&task_capability_lock); | |
227 | + read_unlock(&tasklist_lock); | |
228 | + spin_unlock(&task_capability_lock); | |
229 | 229 | |
230 | - return ret; | |
230 | + return ret; | |
231 | 231 | } |
232 | 232 | |
233 | 233 | int __capable(struct task_struct *t, int cap) |