]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
revert "ipc: don't allocate a copy larger than max"
authorAndrew Morton <akpm@linux-foundation.org>
Tue, 26 Mar 2013 23:24:02 +0000 (10:24 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 4 Apr 2013 05:53:01 +0000 (16:53 +1100)
Revert 88b9e456b164.  Dave has confirmed that this was causing oopses
during trinity testing.

Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: Stanislav Kinsbursky <skinsbursky@parallels.com>
Reported-by: Dave Jones <davej@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
ipc/msg.c

index fede1d06ef305cc59386bb4490c7e2e020b9f25d..4eaf3fd5c9cda47c3b2b29fe3fe0711e3b312104 100644 (file)
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -820,17 +820,15 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp,
        struct msg_msg *copy = NULL;
        unsigned long copy_number = 0;
 
-       ns = current->nsproxy->ipc_ns;
-
        if (msqid < 0 || (long) bufsz < 0)
                return -EINVAL;
        if (msgflg & MSG_COPY) {
-               copy = prepare_copy(buf, min_t(size_t, bufsz, ns->msg_ctlmax),
-                                   msgflg, &msgtyp, &copy_number);
+               copy = prepare_copy(buf, bufsz, msgflg, &msgtyp, &copy_number);
                if (IS_ERR(copy))
                        return PTR_ERR(copy);
        }
        mode = convert_mode(&msgtyp, msgflg);
+       ns = current->nsproxy->ipc_ns;
 
        msq = msg_lock_check(ns, msqid);
        if (IS_ERR(msq)) {