ipc, kernel: use Linux headers
[firefly-linux-kernel-4.4.55.git] / ipc / msg.c
index 245db1140ad66a2be47744f02ef0d80deea5006f..d608e6dde91948c769521b02333747f075b5649f 100644 (file)
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -39,7 +39,7 @@
 #include <linux/ipc_namespace.h>
 
 #include <asm/current.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "util.h"
 
 /*
@@ -306,15 +306,14 @@ static inline int msg_security(struct kern_ipc_perm *ipcp, int msgflg)
 SYSCALL_DEFINE2(msgget, key_t, key, int, msgflg)
 {
        struct ipc_namespace *ns;
-       struct ipc_ops msg_ops;
+       static const struct ipc_ops msg_ops = {
+               .getnew = newque,
+               .associate = msg_security,
+       };
        struct ipc_params msg_params;
 
        ns = current->nsproxy->ipc_ns;
 
-       msg_ops.getnew = newque;
-       msg_ops.associate = msg_security;
-       msg_ops.more_checks = NULL;
-
        msg_params.key = key;
        msg_params.flg = msgflg;
 
@@ -901,6 +900,8 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, int msgfl
                return -EINVAL;
 
        if (msgflg & MSG_COPY) {
+               if ((msgflg & MSG_EXCEPT) || !(msgflg & IPC_NOWAIT))
+                       return -EINVAL;
                copy = prepare_copy(buf, min_t(size_t, bufsz, ns->msg_ctlmax));
                if (IS_ERR(copy))
                        return PTR_ERR(copy);