From: Andrew Morton Date: Tue, 26 Mar 2013 23:24:02 +0000 (+1100) Subject: revert "ipc: don't allocate a copy larger than max" X-Git-Tag: next-20130404~3^2~508 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=598b63ccb90b29a49078564d4753bc613d37711d;p=karo-tx-linux.git revert "ipc: don't allocate a copy larger than max" Revert 88b9e456b164. Dave has confirmed that this was causing oopses during trinity testing. Cc: Peter Hurley Cc: Stanislav Kinsbursky Reported-by: Dave Jones Cc: Signed-off-by: Andrew Morton --- diff --git a/ipc/msg.c b/ipc/msg.c index fede1d06ef30..4eaf3fd5c9cd 100644 --- 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, ©_number); + copy = prepare_copy(buf, bufsz, msgflg, &msgtyp, ©_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)) {