diff options
author | jhb <jhb@FreeBSD.org> | 2006-10-10 22:46:22 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2006-10-10 22:46:22 +0000 |
commit | 2447c3b93080214c535333d4ba23546a7f7bd3aa (patch) | |
tree | d5f39be8567f7052ae1e7394a9a8eddd3cebb86e /sys/compat | |
parent | af5122eb88a97d060559b07cb31c7c1ec6231d71 (diff) | |
download | FreeBSD-src-2447c3b93080214c535333d4ba23546a7f7bd3aa.zip FreeBSD-src-2447c3b93080214c535333d4ba23546a7f7bd3aa.tar.gz |
Only try to copyin a msqid for the IPC_SET command to msgctl(). Other
commands (such as IPC_RMID) were bogusly failing with EFAULT.
Tested by: jkim
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/linux/linux_ipc.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/compat/linux/linux_ipc.c b/sys/compat/linux/linux_ipc.c index 1413c47..6cc27d1 100644 --- a/sys/compat/linux/linux_ipc.c +++ b/sys/compat/linux/linux_ipc.c @@ -628,13 +628,14 @@ linux_msgctl(struct thread *td, struct linux_msgctl_args *args) struct l_msqid_ds linux_msqid; struct msqid_ds bsd_msqid; - error = linux_msqid_pullup(args->cmd & LINUX_IPC_64, - &linux_msqid, PTRIN(args->buf)); - if (error != 0) - return (error); bsd_cmd = args->cmd & ~LINUX_IPC_64; - if (bsd_cmd == LINUX_IPC_SET) + if (bsd_cmd == LINUX_IPC_SET) { + error = linux_msqid_pullup(args->cmd & LINUX_IPC_64, + &linux_msqid, PTRIN(args->buf)); + if (error) + return (error); linux_to_bsd_msqid_ds(&linux_msqid, &bsd_msqid); + } error = kern_msgctl(td, args->msqid, bsd_cmd, &bsd_msqid); if (error != 0) |