From patchwork Tue Mar 10 16:54:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stas Sergeev X-Patchwork-Id: 5979421 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 30E7BBF440 for ; Tue, 10 Mar 2015 16:57:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 41D0820225 for ; Tue, 10 Mar 2015 16:57:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CB1462022A for ; Tue, 10 Mar 2015 16:57:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YVNQs-0000dx-CF; Tue, 10 Mar 2015 16:55:02 +0000 Received: from smtp5.mail.ru ([94.100.179.24]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YVNQk-0000Gb-4i for linux-arm-kernel@lists.infradead.org; Tue, 10 Mar 2015 16:54:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=list.ru; s=mail; h=Content-Transfer-Encoding:Content-Type:Subject:CC:To:MIME-Version:From:Date:Message-ID; bh=ZuioesWywnz3CxWh1LNph36U6G4u1bU5q8+F/mbCDA0=; b=J9n2HfkZMwd4RVSb/Rl+agpqLBvljASWd0hIUsfbD6opi+pxWuQW15lU7ACG/ZBxjunY1NAfYyt/R6GiQdtTbQudwjbxVqVw+Re3MjJuL7RSTq26AlRS+alrb/9uxrf0Y5AFZvn3MTGgy7dmZg3mXPFR0CZ8eIT7r3RPCE6HClY=; Received: from [31.28.31.88] (port=44451 helo=[192.168.0.237]) by smtp5.mail.ru with esmtpa (envelope-from ) id 1YVNQG-00079c-VK; Tue, 10 Mar 2015 19:54:30 +0300 Message-ID: <54FF21BE.2040506@list.ru> Date: Tue, 10 Mar 2015 19:54:22 +0300 From: Stas Sergeev User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Andrew Morton Subject: [PATCH] n_tty: use kmalloc() instead of vmalloc() to avoid crash on armada-xp X-Mras: Ok X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150310_095454_862967_14C553EE X-CRM114-Status: GOOD ( 16.77 ) X-Spam-Score: -0.1 (/) Cc: Linux kernel , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hello, the patch below is needed for a successful boot on armada-xp. -=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=- This fixes the following crash at boot: Unhandled fault: external abort on non-linefetch (0x808) at 0xf00ca018 Internal error: : 808 [#1] SMP ARM CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.0.0-rc1 #3 Hardware name: Marvell Armada 370/XP (Device Tree) task: ed41e800 ti: ed43e000 task.ti: ed43e000 PC is at _set_bit+0x28/0x50 LR is at n_tty_set_termios+0x328/0x358 pc : [] lr : [] psr: 40000113 sp : ed43fd00 ip : 00000000 fp : 00000000 r10: 00000002 r9 : 00000000 r8 : ec930200 r7 : 00000000 r6 : f00ca018 r5 : f00ca000 r4 : ed69cc00 r3 : 00002000 r2 : 00002000 r1 : f00ca018 r0 : 00000000 Flags: nZcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 10c5387d Table: 0000406a DAC: 00000015 Process swapper/0 (pid: 1, stack limit = 0xed43e220) The offending instruction in _set_bit() is "strex r0, r2, [r1]" For some reason the exclusive access instructions do not like the vmalloc() space... While there may be another fix to make them fine about vmalloc() space, it still looks like a good idea to use kmalloc() for allocating a small (sub-page) struct. Signed-off-by: Stas Sergeev --- drivers/tty/n_tty.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) room */ @@ -1892,7 +1891,7 @@ static void n_tty_close(struct tty_struct *tty) if (tty->link) n_tty_packet_mode_flush(tty); - vfree(ldata); + kfree(ldata); tty->disc_data = NULL; } @@ -1911,7 +1910,7 @@ static int n_tty_open(struct tty_struct *tty) struct n_tty_data *ldata; /* Currently a malloc failure here can panic */ - ldata = vmalloc(sizeof(*ldata)); + ldata = kmalloc(sizeof(*ldata), GFP_KERNEL); if (!ldata) goto err; diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index cf6e0f2..e03622e 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -50,7 +50,6 @@ #include #include #include -#include /* number of characters left in xmit buffer before select has we have