From patchwork Mon Jan 5 01:20:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Rui" X-Patchwork-Id: 5564531 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-pm@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 90A5BBF6C3 for ; Mon, 5 Jan 2015 01:20:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 783EC20165 for ; Mon, 5 Jan 2015 01:20:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A01C520166 for ; Mon, 5 Jan 2015 01:20:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752868AbbAEBUv (ORCPT ); Sun, 4 Jan 2015 20:20:51 -0500 Received: from mga09.intel.com ([134.134.136.24]:5088 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751773AbbAEBUv (ORCPT ); Sun, 4 Jan 2015 20:20:51 -0500 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 04 Jan 2015 17:18:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,691,1406617200"; d="scan'208,223";a="507379144" Received: from unknown (HELO [10.255.21.68]) ([10.255.21.68]) by orsmga003.jf.intel.com with ESMTP; 04 Jan 2015 17:15:16 -0800 Message-ID: <1420420847.32092.1.camel@rzhang1-toshiba> Subject: [PATCH] int340x_thermal/processor_thermal_device: return failure when there is no ACPI device object From: Zhang Rui To: Linux PM list Cc: Srinivas Pandruvada , "Chen, Yu C" , "Zhang, Rui" Date: Mon, 05 Jan 2015 09:20:47 +0800 X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 From cd4c9293694090b02d305f2e3364618752e07693 Mon Sep 17 00:00:00 2001 From: Zhang Rui Date: Sun, 4 Jan 2015 16:35:59 +0800 Subject: [PATCH] int340x_thermal/processor_thermal_device: return failure when there is no ACPI device object processor_thermal_device driver needs ACPI support to work. Thus, the driver probing should fail when there is no ACPI device object asscociated. This fixes a NULL pointer dereference when the driver is loaded with INT340X feature disabled in BIOS. Reported-by: Chen Yu Signed-off-by: Zhang Rui Tested-by: Chen Yu --- drivers/thermal/int340x_thermal/processor_thermal_device.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/thermal/int340x_thermal/processor_thermal_device.c b/drivers/thermal/int340x_thermal/processor_thermal_device.c index 31bb553..0fe5dbb 100644 --- a/drivers/thermal/int340x_thermal/processor_thermal_device.c +++ b/drivers/thermal/int340x_thermal/processor_thermal_device.c @@ -130,6 +130,8 @@ static int proc_thermal_add(struct device *dev, int ret; adev = ACPI_COMPANION(dev); + if (!adev) + return -ENODEV; status = acpi_evaluate_object(adev->handle, "PPCC", NULL, &buf); if (ACPI_FAILURE(status))