From patchwork Fri Dec 6 23:08:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Mostafa X-Patchwork-Id: 298416 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 698FB2C0077 for ; Sat, 7 Dec 2013 10:17:02 +1100 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1Vp4dk-0005nr-Ud; Fri, 06 Dec 2013 23:16:56 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1Vp4Vh-00012S-Uh for kernel-team@lists.ubuntu.com; Fri, 06 Dec 2013 23:08:37 +0000 Received: from c-67-160-231-162.hsd1.ca.comcast.net ([67.160.231.162] helo=fourier) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Vp4Vh-0004LO-JI; Fri, 06 Dec 2013 23:08:37 +0000 Received: from kamal by fourier with local (Exim 4.80) (envelope-from ) id 1Vp4Vf-00006G-5h; Fri, 06 Dec 2013 15:08:35 -0800 From: Kamal Mostafa To: Peter Hurley Subject: [3.8.y.z extended stable] Patch "ipc: set EFAULT as default error in load_msg()" has been added to staging queue Date: Fri, 6 Dec 2013 15:08:35 -0800 Message-Id: <1386371315-353-1-git-send-email-kamal@canonical.com> X-Mailer: git-send-email 1.8.3.2 X-Extended-Stable: 3.8 Cc: Linus Torvalds , Andrew Morton , Stanislav Kinsbursky , Kamal Mostafa , kernel-team@lists.ubuntu.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com This is a note to let you know that I have just added a patch titled ipc: set EFAULT as default error in load_msg() to the linux-3.8.y-queue branch of the 3.8.y.z extended stable tree which can be found at: http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.8.y-queue This patch is scheduled to be released in version 3.8.13.14. If you, or anyone else, feels it should not be added to this tree, please reply to this email. For more information about the 3.8.y.z tree, see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable Thanks. -Kamal ------ From cbed51d570ee39341e3d4e4f91d8439405cd32b9 Mon Sep 17 00:00:00 2001 From: Peter Hurley Date: Tue, 30 Apr 2013 19:14:42 -0700 Subject: ipc: set EFAULT as default error in load_msg() commit 2b3097a294b6daaf390010de14ca50bfccbc6fb6 upstream. Signed-off-by: Peter Hurley Acked-by: Stanislav Kinsbursky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds [ kamal: 3.8 stable prereq for 4e9b45a ipc, msg: fix message length check for negative values ] Signed-off-by: Kamal Mostafa --- ipc/msgutil.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) -- 1.8.3.2 diff --git a/ipc/msgutil.c b/ipc/msgutil.c index b79582d..d33fbb2 100644 --- a/ipc/msgutil.c +++ b/ipc/msgutil.c @@ -84,7 +84,7 @@ struct msg_msg *load_msg(const void __user *src, int len) { struct msg_msg *msg; struct msg_msgseg *seg; - int err; + int err = -EFAULT; int alen; msg = alloc_msg(len); @@ -92,19 +92,15 @@ struct msg_msg *load_msg(const void __user *src, int len) return ERR_PTR(-ENOMEM); alen = min(len, DATALEN_MSG); - if (copy_from_user(msg + 1, src, alen)) { - err = -EFAULT; + if (copy_from_user(msg + 1, src, alen)) goto out_err; - } for (seg = msg->next; seg != NULL; seg = seg->next) { len -= alen; src = (char __user *)src + alen; alen = min(len, DATALEN_SEG); - if (copy_from_user(seg + 1, src, alen)) { - err = -EFAULT; + if (copy_from_user(seg + 1, src, alen)) goto out_err; - } } err = security_msg_msg_alloc(msg);