From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-Id: <20120205220949.920575388@pcw.home.local> Date: Sun, 05 Feb 2012 23:10:00 +0100 From: Willy Tarreau To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dan Rosenberg , Russell King , Greg KH Subject: [PATCH 11/91] ARM: 6891/1: prevent heap corruption in OABI semtimedop In-Reply-To: <0635750f5f06ed2ca212b91fcb5c4483@local> Sender: linux-kernel-owner@vger.kernel.org List-ID: 2.6.27-longterm review patch. If anyone has any objections, please let us know. ------------------ commit 0f22072ab50cac7983f9660d33974b45184da4f9 upstream. When CONFIG_OABI_COMPAT is set, the wrapper for semtimedop does not bound the nsops argument. A sufficiently large value will cause an integer overflow in allocation size, followed by copying too much data into the allocated buffer. Fix this by restricting nsops to SEMOPM. Untested. Signed-off-by: Dan Rosenberg Signed-off-by: Russell King Signed-off-by: Greg Kroah-Hartman --- arch/arm/kernel/sys_oabi-compat.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) Index: longterm-2.6.27/arch/arm/kernel/sys_oabi-compat.c =================================================================== --- longterm-2.6.27.orig/arch/arm/kernel/sys_oabi-compat.c 2012-02-05 22:34:34.686915228 +0100 +++ longterm-2.6.27/arch/arm/kernel/sys_oabi-compat.c 2012-02-05 22:34:36.482915240 +0100 @@ -319,7 +319,7 @@ long err; int i; - if (nsops < 1) + if (nsops < 1 || nsops > SEMOPM) return -EINVAL; sops = kmalloc(sizeof(*sops) * nsops, GFP_KERNEL); if (!sops)