From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935076AbdBQUnj (ORCPT ); Fri, 17 Feb 2017 15:43:39 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:36113 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934089AbdBQUnh (ORCPT ); Fri, 17 Feb 2017 15:43:37 -0500 From: Jan Dakinevich To: Greg Kroah-Hartman , Jiri Slaby , Jan Dakinevich , Peter Hurley , Dan Carpenter , Arnd Bergmann , Amit Shah , virtualization@lists.linux-foundation.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] tty: hvc: don't allocate a buffer for console print on stack Date: Fri, 17 Feb 2017 23:42:45 +0300 Message-Id: <1487364165-21882-1-git-send-email-jan.dakinevich@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The buffer is used by virtio console driver as DMA buffer. Since v4.9 (if VMAP_STACK is enabled) we shouldn't use the stack for DMA. Signed-off-by: Jan Dakinevich --- drivers/tty/hvc/hvc_console.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c index 9b5c0fb..1ce6aaf 100644 --- a/drivers/tty/hvc/hvc_console.c +++ b/drivers/tty/hvc/hvc_console.c @@ -143,10 +143,15 @@ static struct hvc_struct *hvc_get_by_index(int index) static void hvc_console_print(struct console *co, const char *b, unsigned count) { - char c[N_OUTBUF] __ALIGNED__; unsigned i = 0, n = 0; int r, donecr = 0, index = co->index; + /* + * Access to the buffer is serialized by console_sem in caller code from + * kernel/printk/printk.c + */ + static char c[N_OUTBUF] __ALIGNED__; + /* Console access attempt outside of acceptable console range. */ if (index >= MAX_NR_HVC_CONSOLES) return; -- 1.9.1