diff options
Diffstat (limited to 'ipc/compat.c')
-rw-r--r-- | ipc/compat.c | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/ipc/compat.c b/ipc/compat.c index b5ef4f7946dc..9b3c85f8a538 100644 --- a/ipc/compat.c +++ b/ipc/compat.c | |||
@@ -171,32 +171,32 @@ static inline int __put_compat_ipc64_perm(struct ipc64_perm *p64, | |||
171 | } | 171 | } |
172 | 172 | ||
173 | static inline int __put_compat_ipc_perm(struct ipc64_perm *p, | 173 | static inline int __put_compat_ipc_perm(struct ipc64_perm *p, |
174 | struct compat_ipc_perm __user *up) | 174 | struct compat_ipc_perm __user *uip) |
175 | { | 175 | { |
176 | int err; | 176 | int err; |
177 | __compat_uid_t u; | 177 | __compat_uid_t u; |
178 | __compat_gid_t g; | 178 | __compat_gid_t g; |
179 | 179 | ||
180 | err = __put_user(p->key, &up->key); | 180 | err = __put_user(p->key, &uip->key); |
181 | SET_UID(u, p->uid); | 181 | SET_UID(u, p->uid); |
182 | err |= __put_user(u, &up->uid); | 182 | err |= __put_user(u, &uip->uid); |
183 | SET_GID(g, p->gid); | 183 | SET_GID(g, p->gid); |
184 | err |= __put_user(g, &up->gid); | 184 | err |= __put_user(g, &uip->gid); |
185 | SET_UID(u, p->cuid); | 185 | SET_UID(u, p->cuid); |
186 | err |= __put_user(u, &up->cuid); | 186 | err |= __put_user(u, &uip->cuid); |
187 | SET_GID(g, p->cgid); | 187 | SET_GID(g, p->cgid); |
188 | err |= __put_user(g, &up->cgid); | 188 | err |= __put_user(g, &uip->cgid); |
189 | err |= __put_user(p->mode, &up->mode); | 189 | err |= __put_user(p->mode, &uip->mode); |
190 | err |= __put_user(p->seq, &up->seq); | 190 | err |= __put_user(p->seq, &uip->seq); |
191 | return err; | 191 | return err; |
192 | } | 192 | } |
193 | 193 | ||
194 | static inline int get_compat_semid64_ds(struct semid64_ds *s64, | 194 | static inline int get_compat_semid64_ds(struct semid64_ds *sem64, |
195 | struct compat_semid64_ds __user *up64) | 195 | struct compat_semid64_ds __user *up64) |
196 | { | 196 | { |
197 | if (!access_ok(VERIFY_READ, up64, sizeof(*up64))) | 197 | if (!access_ok(VERIFY_READ, up64, sizeof(*up64))) |
198 | return -EFAULT; | 198 | return -EFAULT; |
199 | return __get_compat_ipc64_perm(&s64->sem_perm, &up64->sem_perm); | 199 | return __get_compat_ipc64_perm(&sem64->sem_perm, &up64->sem_perm); |
200 | } | 200 | } |
201 | 201 | ||
202 | static inline int get_compat_semid_ds(struct semid64_ds *s, | 202 | static inline int get_compat_semid_ds(struct semid64_ds *s, |
@@ -207,17 +207,17 @@ static inline int get_compat_semid_ds(struct semid64_ds *s, | |||
207 | return __get_compat_ipc_perm(&s->sem_perm, &up->sem_perm); | 207 | return __get_compat_ipc_perm(&s->sem_perm, &up->sem_perm); |
208 | } | 208 | } |
209 | 209 | ||
210 | static inline int put_compat_semid64_ds(struct semid64_ds *s64, | 210 | static inline int put_compat_semid64_ds(struct semid64_ds *sem64, |
211 | struct compat_semid64_ds __user *up64) | 211 | struct compat_semid64_ds __user *up64) |
212 | { | 212 | { |
213 | int err; | 213 | int err; |
214 | 214 | ||
215 | if (!access_ok(VERIFY_WRITE, up64, sizeof(*up64))) | 215 | if (!access_ok(VERIFY_WRITE, up64, sizeof(*up64))) |
216 | return -EFAULT; | 216 | return -EFAULT; |
217 | err = __put_compat_ipc64_perm(&s64->sem_perm, &up64->sem_perm); | 217 | err = __put_compat_ipc64_perm(&sem64->sem_perm, &up64->sem_perm); |
218 | err |= __put_user(s64->sem_otime, &up64->sem_otime); | 218 | err |= __put_user(sem64->sem_otime, &up64->sem_otime); |
219 | err |= __put_user(s64->sem_ctime, &up64->sem_ctime); | 219 | err |= __put_user(sem64->sem_ctime, &up64->sem_ctime); |
220 | err |= __put_user(s64->sem_nsems, &up64->sem_nsems); | 220 | err |= __put_user(sem64->sem_nsems, &up64->sem_nsems); |
221 | return err; | 221 | return err; |
222 | } | 222 | } |
223 | 223 | ||
@@ -239,11 +239,11 @@ static long do_compat_semctl(int first, int second, int third, u32 pad) | |||
239 | { | 239 | { |
240 | unsigned long fourth; | 240 | unsigned long fourth; |
241 | int err, err2; | 241 | int err, err2; |
242 | struct semid64_ds s64; | 242 | struct semid64_ds sem64; |
243 | struct semid64_ds __user *up64; | 243 | struct semid64_ds __user *up64; |
244 | int version = compat_ipc_parse_version(&third); | 244 | int version = compat_ipc_parse_version(&third); |
245 | 245 | ||
246 | memset(&s64, 0, sizeof(s64)); | 246 | memset(&sem64, 0, sizeof(sem64)); |
247 | 247 | ||
248 | if ((third & (~IPC_64)) == SETVAL) | 248 | if ((third & (~IPC_64)) == SETVAL) |
249 | #ifdef __BIG_ENDIAN | 249 | #ifdef __BIG_ENDIAN |
@@ -269,29 +269,29 @@ static long do_compat_semctl(int first, int second, int third, u32 pad) | |||
269 | 269 | ||
270 | case IPC_STAT: | 270 | case IPC_STAT: |
271 | case SEM_STAT: | 271 | case SEM_STAT: |
272 | up64 = compat_alloc_user_space(sizeof(s64)); | 272 | up64 = compat_alloc_user_space(sizeof(sem64)); |
273 | fourth = (unsigned long)up64; | 273 | fourth = (unsigned long)up64; |
274 | err = sys_semctl(first, second, third, fourth); | 274 | err = sys_semctl(first, second, third, fourth); |
275 | if (err < 0) | 275 | if (err < 0) |
276 | break; | 276 | break; |
277 | if (copy_from_user(&s64, up64, sizeof(s64))) | 277 | if (copy_from_user(&sem64, up64, sizeof(sem64))) |
278 | err2 = -EFAULT; | 278 | err2 = -EFAULT; |
279 | else if (version == IPC_64) | 279 | else if (version == IPC_64) |
280 | err2 = put_compat_semid64_ds(&s64, compat_ptr(pad)); | 280 | err2 = put_compat_semid64_ds(&sem64, compat_ptr(pad)); |
281 | else | 281 | else |
282 | err2 = put_compat_semid_ds(&s64, compat_ptr(pad)); | 282 | err2 = put_compat_semid_ds(&sem64, compat_ptr(pad)); |
283 | if (err2) | 283 | if (err2) |
284 | err = -EFAULT; | 284 | err = -EFAULT; |
285 | break; | 285 | break; |
286 | 286 | ||
287 | case IPC_SET: | 287 | case IPC_SET: |
288 | if (version == IPC_64) | 288 | if (version == IPC_64) |
289 | err = get_compat_semid64_ds(&s64, compat_ptr(pad)); | 289 | err = get_compat_semid64_ds(&sem64, compat_ptr(pad)); |
290 | else | 290 | else |
291 | err = get_compat_semid_ds(&s64, compat_ptr(pad)); | 291 | err = get_compat_semid_ds(&sem64, compat_ptr(pad)); |
292 | 292 | ||
293 | up64 = compat_alloc_user_space(sizeof(s64)); | 293 | up64 = compat_alloc_user_space(sizeof(sem64)); |
294 | if (copy_to_user(up64, &s64, sizeof(s64))) | 294 | if (copy_to_user(up64, &sem64, sizeof(sem64))) |
295 | err = -EFAULT; | 295 | err = -EFAULT; |
296 | if (err) | 296 | if (err) |
297 | break; | 297 | break; |
@@ -561,12 +561,12 @@ COMPAT_SYSCALL_DEFINE3(shmat, int, shmid, compat_uptr_t, shmaddr, int, shmflg) | |||
561 | return (long)ret; | 561 | return (long)ret; |
562 | } | 562 | } |
563 | 563 | ||
564 | static inline int get_compat_shmid64_ds(struct shmid64_ds *s64, | 564 | static inline int get_compat_shmid64_ds(struct shmid64_ds *sem64, |
565 | struct compat_shmid64_ds __user *up64) | 565 | struct compat_shmid64_ds __user *up64) |
566 | { | 566 | { |
567 | if (!access_ok(VERIFY_READ, up64, sizeof(*up64))) | 567 | if (!access_ok(VERIFY_READ, up64, sizeof(*up64))) |
568 | return -EFAULT; | 568 | return -EFAULT; |
569 | return __get_compat_ipc64_perm(&s64->shm_perm, &up64->shm_perm); | 569 | return __get_compat_ipc64_perm(&sem64->shm_perm, &up64->shm_perm); |
570 | } | 570 | } |
571 | 571 | ||
572 | static inline int get_compat_shmid_ds(struct shmid64_ds *s, | 572 | static inline int get_compat_shmid_ds(struct shmid64_ds *s, |
@@ -577,21 +577,21 @@ static inline int get_compat_shmid_ds(struct shmid64_ds *s, | |||
577 | return __get_compat_ipc_perm(&s->shm_perm, &up->shm_perm); | 577 | return __get_compat_ipc_perm(&s->shm_perm, &up->shm_perm); |
578 | } | 578 | } |
579 | 579 | ||
580 | static inline int put_compat_shmid64_ds(struct shmid64_ds *s64, | 580 | static inline int put_compat_shmid64_ds(struct shmid64_ds *sem64, |
581 | struct compat_shmid64_ds __user *up64) | 581 | struct compat_shmid64_ds __user *up64) |
582 | { | 582 | { |
583 | int err; | 583 | int err; |
584 | 584 | ||
585 | if (!access_ok(VERIFY_WRITE, up64, sizeof(*up64))) | 585 | if (!access_ok(VERIFY_WRITE, up64, sizeof(*up64))) |
586 | return -EFAULT; | 586 | return -EFAULT; |
587 | err = __put_compat_ipc64_perm(&s64->shm_perm, &up64->shm_perm); | 587 | err = __put_compat_ipc64_perm(&sem64->shm_perm, &up64->shm_perm); |
588 | err |= __put_user(s64->shm_atime, &up64->shm_atime); | 588 | err |= __put_user(sem64->shm_atime, &up64->shm_atime); |
589 | err |= __put_user(s64->shm_dtime, &up64->shm_dtime); | 589 | err |= __put_user(sem64->shm_dtime, &up64->shm_dtime); |
590 | err |= __put_user(s64->shm_ctime, &up64->shm_ctime); | 590 | err |= __put_user(sem64->shm_ctime, &up64->shm_ctime); |
591 | err |= __put_user(s64->shm_segsz, &up64->shm_segsz); | 591 | err |= __put_user(sem64->shm_segsz, &up64->shm_segsz); |
592 | err |= __put_user(s64->shm_nattch, &up64->shm_nattch); | 592 | err |= __put_user(sem64->shm_nattch, &up64->shm_nattch); |
593 | err |= __put_user(s64->shm_cpid, &up64->shm_cpid); | 593 | err |= __put_user(sem64->shm_cpid, &up64->shm_cpid); |
594 | err |= __put_user(s64->shm_lpid, &up64->shm_lpid); | 594 | err |= __put_user(sem64->shm_lpid, &up64->shm_lpid); |
595 | return err; | 595 | return err; |
596 | } | 596 | } |
597 | 597 | ||
@@ -668,12 +668,12 @@ static inline int put_compat_shm_info(struct shm_info __user *ip, | |||
668 | COMPAT_SYSCALL_DEFINE3(shmctl, int, first, int, second, void __user *, uptr) | 668 | COMPAT_SYSCALL_DEFINE3(shmctl, int, first, int, second, void __user *, uptr) |
669 | { | 669 | { |
670 | void __user *p; | 670 | void __user *p; |
671 | struct shmid64_ds s64; | 671 | struct shmid64_ds sem64; |
672 | struct shminfo64 smi; | 672 | struct shminfo64 smi; |
673 | int err, err2; | 673 | int err, err2; |
674 | int version = compat_ipc_parse_version(&second); | 674 | int version = compat_ipc_parse_version(&second); |
675 | 675 | ||
676 | memset(&s64, 0, sizeof(s64)); | 676 | memset(&sem64, 0, sizeof(sem64)); |
677 | 677 | ||
678 | switch (second & (~IPC_64)) { | 678 | switch (second & (~IPC_64)) { |
679 | case IPC_RMID: | 679 | case IPC_RMID: |
@@ -700,14 +700,14 @@ COMPAT_SYSCALL_DEFINE3(shmctl, int, first, int, second, void __user *, uptr) | |||
700 | 700 | ||
701 | case IPC_SET: | 701 | case IPC_SET: |
702 | if (version == IPC_64) | 702 | if (version == IPC_64) |
703 | err = get_compat_shmid64_ds(&s64, uptr); | 703 | err = get_compat_shmid64_ds(&sem64, uptr); |
704 | else | 704 | else |
705 | err = get_compat_shmid_ds(&s64, uptr); | 705 | err = get_compat_shmid_ds(&sem64, uptr); |
706 | 706 | ||
707 | if (err) | 707 | if (err) |
708 | break; | 708 | break; |
709 | p = compat_alloc_user_space(sizeof(s64)); | 709 | p = compat_alloc_user_space(sizeof(sem64)); |
710 | if (copy_to_user(p, &s64, sizeof(s64))) | 710 | if (copy_to_user(p, &sem64, sizeof(sem64))) |
711 | err = -EFAULT; | 711 | err = -EFAULT; |
712 | else | 712 | else |
713 | err = sys_shmctl(first, second, p); | 713 | err = sys_shmctl(first, second, p); |
@@ -715,16 +715,16 @@ COMPAT_SYSCALL_DEFINE3(shmctl, int, first, int, second, void __user *, uptr) | |||
715 | 715 | ||
716 | case IPC_STAT: | 716 | case IPC_STAT: |
717 | case SHM_STAT: | 717 | case SHM_STAT: |
718 | p = compat_alloc_user_space(sizeof(s64)); | 718 | p = compat_alloc_user_space(sizeof(sem64)); |
719 | err = sys_shmctl(first, second, p); | 719 | err = sys_shmctl(first, second, p); |
720 | if (err < 0) | 720 | if (err < 0) |
721 | break; | 721 | break; |
722 | if (copy_from_user(&s64, p, sizeof(s64))) | 722 | if (copy_from_user(&sem64, p, sizeof(sem64))) |
723 | err2 = -EFAULT; | 723 | err2 = -EFAULT; |
724 | else if (version == IPC_64) | 724 | else if (version == IPC_64) |
725 | err2 = put_compat_shmid64_ds(&s64, uptr); | 725 | err2 = put_compat_shmid64_ds(&sem64, uptr); |
726 | else | 726 | else |
727 | err2 = put_compat_shmid_ds(&s64, uptr); | 727 | err2 = put_compat_shmid_ds(&sem64, uptr); |
728 | if (err2) | 728 | if (err2) |
729 | err = -EFAULT; | 729 | err = -EFAULT; |
730 | break; | 730 | break; |