Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753162AbbFDK46 (ORCPT ); Thu, 4 Jun 2015 06:56:58 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:58354 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753387AbbFDK4k (ORCPT ); Thu, 4 Jun 2015 06:56:40 -0400 From: Markos Chandras To: CC: Markos Chandras , , "David S. Miller" , Alexei Starovoitov , Daniel Borkmann , "Hannes Frederic Sowa" , Subject: [PATCH 3/6] MIPS: net: BPF: Fix stack pointer allocation Date: Thu, 4 Jun 2015 11:56:13 +0100 Message-ID: <1433415376-20952-4-git-send-email-markos.chandras@imgtec.com> X-Mailer: git-send-email 2.4.2 In-Reply-To: <1433415376-20952-1-git-send-email-markos.chandras@imgtec.com> References: <1433415376-20952-1-git-send-email-markos.chandras@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.154.48] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1430 Lines: 41 Fix stack pointer offset which could potentially corrupt argument registers in the previous frame. The calculated offset reflects the size of all the registers we need to preserve so there is no need for this erroneous subtraction. Cc: netdev@vger.kernel.org Cc: "David S. Miller" Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: Hannes Frederic Sowa Cc: linux-kernel@vger.kernel.org Signed-off-by: Markos Chandras --- arch/mips/net/bpf_jit.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c index 56e0e8e9674d..84cd09ba230a 100644 --- a/arch/mips/net/bpf_jit.c +++ b/arch/mips/net/bpf_jit.c @@ -676,11 +676,7 @@ static unsigned int get_stack_depth(struct jit_ctx *ctx) sp_off += config_enabled(CONFIG_64BIT) ? (ARGS_USED_BY_JIT + 1) * SZREG : SZREG; - /* - * Subtract the bytes for the last registers since we only care about - * the location on the stack pointer. - */ - return sp_off - SZREG; + return sp_off; } static void build_prologue(struct jit_ctx *ctx) -- 2.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/