From patchwork Wed Dec 17 06:22:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yong X-Patchwork-Id: 42370 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8D6AC26C90 for ; Wed, 17 Dec 2014 06:26:46 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id bs8sf5849951wib.2 for ; Tue, 16 Dec 2014 22:26:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=SkqjNZNK8mVLflKPYCgH4f9nemYw7WkPOVKuO4K1jZs=; b=mExELqrcTAZFI4dPPu734ijvWhpc3+8itYIBwNzEeZqUWc2f7GlEh6UB6ZTvBoESKV 0dOLoHAS7hpIpxz88wRBnbNnaKaJv0fqwp7eYAv8ESdVUniUZ6UQ7OIesc9jdbpHbPd7 3OlvWSZrbWK+d1rQ1HR8MLaLj4vzPeWfNJAsoqVt14tBaPaDAKGjI7lX7oRAP9ClXl3/ J8m3yF9jEYVXQWF0kmruBbkw6lMy5MsZMUmzfqk4m9aW2ZNXio2zaOHqdBe0qzKP8q/y 4duZ8lesIvZ3qguLXjYnZJhQUvOiUJrfq8ds/GkjFbHqxDRIRK9kUKROuTqytR8axgEI lr3Q== X-Gm-Message-State: ALoCoQlTihK0dsc2lE7rutTZMoZvI4Fg82ycKlDXCyoypUaeAltmSX4I5UrE+ErBUia2KWxyyak9 X-Received: by 10.152.5.2 with SMTP id o2mr6192016lao.1.1418797605851; Tue, 16 Dec 2014 22:26:45 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.6.34 with SMTP id cr2ls974277lad.30.gmail; Tue, 16 Dec 2014 22:26:45 -0800 (PST) X-Received: by 10.152.44.193 with SMTP id g1mr20584678lam.15.1418797605541; Tue, 16 Dec 2014 22:26:45 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id ss9si2814497lbb.89.2014.12.16.22.26.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Dec 2014 22:26:45 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id pv20so12235989lab.41 for ; Tue, 16 Dec 2014 22:26:45 -0800 (PST) X-Received: by 10.112.235.137 with SMTP id um9mr19977645lbc.41.1418797605445; Tue, 16 Dec 2014 22:26:45 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.142.69 with SMTP id ru5csp1261838lbb; Tue, 16 Dec 2014 22:26:44 -0800 (PST) X-Received: by 10.68.201.201 with SMTP id kc9mr344067pbc.79.1418797585417; Tue, 16 Dec 2014 22:26:25 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id jv1si4011312pbc.205.2014.12.16.22.26.24; Tue, 16 Dec 2014 22:26:25 -0800 (PST) Received-SPF: none (google.com: stable-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751673AbaLQG0U (ORCPT + 1 other); Wed, 17 Dec 2014 01:26:20 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:13652 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751672AbaLQG0P (ORCPT ); Wed, 17 Dec 2014 01:26:15 -0500 Received: from 172.24.2.119 (EHLO szxeml421-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CEC15571; Wed, 17 Dec 2014 14:26:13 +0800 (CST) Received: from linux-4hy3.site (10.107.197.200) by szxeml421-hub.china.huawei.com (10.82.67.160) with Microsoft SMTP Server id 14.3.158.1; Wed, 17 Dec 2014 14:26:02 +0800 From: Sheng Yong To: CC: , Subject: [PATCH 08/16] ARM: 7939/1: traps: fix opcode endianness when read from user memory Date: Wed, 17 Dec 2014 06:22:51 +0000 Message-ID: <1418797379-107848-9-git-send-email-shengyong1@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1418797379-107848-1-git-send-email-shengyong1@huawei.com> References: <1418797379-107848-1-git-send-email-shengyong1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.197.200] X-CFilter-Loop: Reflected Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Taras Kondratiuk commit d6cd989477e2fee29ccda257614ef7b2621d0601 upstream Currently code has an inverted logic: opcode from user memory is swapped to a proper endianness only in case of read error. While normally opcode should be swapped only if it was read correctly from user memory. Reviewed-by: Victor Kamensky Signed-off-by: Ben Dooks Signed-off-by: Taras Kondratiuk Signed-off-by: Russell King --- arch/arm/kernel/traps.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index b4fd850..fd250da 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -431,9 +431,10 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs) instr2 = __mem_to_opcode_thumb16(instr2); instr = __opcode_thumb32_compose(instr, instr2); } - } else if (get_user(instr, (u32 __user *)pc)) { + } else { + if (get_user(instr, (u32 __user *)pc)) + goto die_sig; instr = __mem_to_opcode_arm(instr); - goto die_sig; } if (call_undef_hook(regs, instr) == 0)