From patchwork Thu Mar 24 07:29:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 88140 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id B5A4C100A66 for ; Thu, 24 Mar 2011 18:30:27 +1100 (EST) Received: by ozlabs.org (Postfix) id CD4B4B6F8E; Thu, 24 Mar 2011 18:30:18 +1100 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by ozlabs.org (Postfix) with ESMTP id 72DC4B6F1E for ; Thu, 24 Mar 2011 18:30:17 +1100 (EST) Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2O7UAvf021404 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 24 Mar 2011 03:30:10 -0400 Received: from localhost (dhcp193-58.pnq.redhat.com [10.65.193.58]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2O7U8px028986; Thu, 24 Mar 2011 03:30:09 -0400 From: Amit Shah To: linuxppc-dev@ozlabs.org Subject: [PATCH] hvc_console: Don't access hvc_task if not initialised Date: Thu, 24 Mar 2011 12:59:58 +0530 Message-Id: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Cc: Rusty Russell , linux-kernel@vger.kernel.org, greg@kroah.com, Amit Shah , stable@kernel.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org hvc_open() can be called without having any backing device. This results in a call to hvc_kick() which calls wake_up_process on a NULL pointer. Ensure hvc is initialised by checking for a non-NULL hvc_task before waking up the hvc thread. This was found by an autotest run for virtio_console without having a console backend. CC: stable@kernel.org Signed-off-by: Amit Shah --- drivers/tty/hvc/hvc_console.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c index e9cba13..b2cb5cc 100644 --- a/drivers/tty/hvc/hvc_console.c +++ b/drivers/tty/hvc/hvc_console.c @@ -286,6 +286,9 @@ EXPORT_SYMBOL_GPL(hvc_instantiate); /* Wake the sleeping khvcd */ void hvc_kick(void) { + if (!hvc_task) + return; + hvc_kicked = 1; wake_up_process(hvc_task); }