From patchwork Thu Sep 27 23:48:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 1516081 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 8E213DFFAD for ; Thu, 27 Sep 2012 23:49:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756153Ab2I0XtI (ORCPT ); Thu, 27 Sep 2012 19:49:08 -0400 Received: from mail-ie0-f174.google.com ([209.85.223.174]:53868 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754952Ab2I0XtH (ORCPT ); Thu, 27 Sep 2012 19:49:07 -0400 Received: by ieak13 with SMTP id k13so5983989iea.19 for ; Thu, 27 Sep 2012 16:49:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:x-x-sender:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version:content-type; bh=FEdDnRgycarHbZXAY/IosKKZiaDeV/g4EpbFzYlVBhY=; b=KSUAu2CBUuZmIOnNDOzfDsK2rsVkST+3+zn2TKHH7vkedyvVTDV8Rwkk4z/LIAEGDl 4AWUDnYWhhsfg7WB6OeIXnJ8dnntZco8lMXw/LNsulBdiXqdDpRONbStaa7N+RpigZzn ZiirqRvrGzb5KTjOA0tR8PYZwRM9JEsFgzAvf/bBP/QKqv2hTRAQCc5zecBndLdibN0X vZ0tvjpnP9Oh4QuM/ChhRW8EwXrBMgaLdsY9l6suYitTNhNu6VcyOhU20IUPi8plgTu7 oclzKWKa3lb8o4S+kEIiF3VrYTsywup+ldCPAmzEY79DjWrYbPt3yHsURiPGVFg0FRCc IwlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:x-x-sender:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version:content-type:x-gm-message-state; bh=FEdDnRgycarHbZXAY/IosKKZiaDeV/g4EpbFzYlVBhY=; b=E0UHV/TZgCIcTkG1OYxPQuYeAI1tQh3YBaCzaG0MGMFdO7sks+XtuUlE0Qwvw1UrTt FxLR+aVHq8/u0KoeF4ssYrIcx8ZkgHi5vVEFn4Jm42ZsCrtsz/1RgVo12oRLT5aqeNtW KwMLdkpwVwmMKNqY1t4VRDT8o2hskabw4114lmDSbnSldM4jss1UuDaAeytC8gfydY2Y /Y9BZb68zTKehow2s8/PhasH5kjVlPToSXYa6JrOmv8JZWlB+eQ9Lk5TINdJf88bijmL gOuW6S0Oe6n/7H4ChSePtSUfuLQHXwQwqx/HtsIUSfXrihGQE4IRu7Kw8w1mDL8iUuYT YSXw== Received: by 10.50.217.227 with SMTP id pb3mr67398igc.28.1348789746901; Thu, 27 Sep 2012 16:49:06 -0700 (PDT) Received: by 10.50.217.227 with SMTP id pb3mr67380igc.28.1348789746581; Thu, 27 Sep 2012 16:49:06 -0700 (PDT) Received: from [2620:0:1000:fd2e:224:d7ff:fee2:b75c] ([2620:0:1000:fd2e:224:d7ff:fee2:b75c]) by mx.google.com with ESMTPS id i2sm13955917igl.8.2012.09.27.16.49.03 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 16:49:04 -0700 (PDT) Date: Thu, 27 Sep 2012 16:48:28 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: lenb@kernel.org, rui.zhang@intel.com cc: Durgadoss R , Sedat Dilek , linux-acpi@vger.kernel.org, dan.carpenter@oracle.com, linux-next@vger.kernel.org Subject: Re: [PATCHv2] Thermal: Fix synchronization issues in thermal_sys.c In-Reply-To: Message-ID: References: <1348727888-11196-1-git-send-email-durgadoss.r@intel.com> User-Agent: Alpine 2.00 (LSU 1167 2008-08-23) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQnhDAtt8P20atoSUJdxsDOapWSWijzpSW6wQwjGLzxVb9/bbx9PR/GIHgQVMYPatfko4JGNdTnC2k1zyTv8tdIK2DX+QqDj5YxwCqjx5hag/U83n1EuLETmBLyNeC/bMqqYK/vbhJSvRsQrFUbjFcS2SLOuoA2KNMXyN1E/hUmfChMuJES837V84dR31gqWd4DhpviDzBsVMJBGs/tAfwJPjWXs1Q== Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Thu, 27 Sep 2012, Sedat Dilek wrote: > >> > >> The v2 patch does *not* fix the issue here! > >> > >> [1] https://patchwork.kernel.org/patch/1511961/ > >> > > > > I have re-tested with Linux-Next (next-20120927) plus thermal-next [1] > > pulled in and see still the same call-trace! Same here on mmotm, yes. > > > > Hugh or Dan can you confirm this works for you or not? > > Thanks in advance. > > > > [1] http://git.kernel.org/?p=linux/kernel/git/rzhang/linux.git;a=shortlog;h=refs/heads/next > > [2] http://git.kernel.org/?p=linux/kernel/git/rzhang/linux.git;a=commitdiff;h=404b134156bd9d9bc506c0974a1254806e13db2c > > > > With the attached fixup/followup patch, I can boot into my system! > But, as said yesterday... working within X, Firefox is a pain in the a**. Indeed, this works for me too, thanks. Let's get your addition out of the attachment and fold it into a v3. Mind if we change "synchronization issues" to "oops and unlocking"? [PATCHv3] Thermal: Fix oops and unlocking in thermal_sys.c This patch fixes the following mutex and NULL pointer problems in thermal_sys.c: * mutex_unlock fix in update_temperature function * mutex_unlock fix in bind_cdev function * Correct early return to continue in bind_cdev function * NULL check fix in bind_cdev function * NULL check fix in bind_tz function Reported-by: Dan Carpenter Reported-by: Sedat Dilek Reported-by: Hugh Dickins Signed-off-by: Durgadoss R Signed-off-by: Sedat Dilek Signed-off-by: Hugh Dickins --- v3: * Sedat restored necessary NULL check in bind_cdev and his signoff. * Hugh added two more comments above, his signoff, and Dan's 'Reported-by'. drivers/thermal/thermal_sys.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- mmotm/drivers/thermal/thermal_sys.c 2012-09-26 10:15:28.652071362 -0700 +++ linux/drivers/thermal/thermal_sys.c 2012-09-27 16:19:14.427515890 -0700 @@ -252,8 +252,8 @@ static void bind_cdev(struct thermal_coo } tzp = pos->tzp; - if (!tzp->tbp) - return; + if (!tzp || !tzp->tbp) + continue; for (i = 0; i < tzp->num_tbps; i++) { if (tzp->tbp[i].cdev || !tzp->tbp[i].match) @@ -289,7 +289,7 @@ static void bind_tz(struct thermal_zone_ goto exit; } - if (!tzp->tbp) + if (!tzp || !tzp->tbp) goto exit; list_for_each_entry(pos, &thermal_cdev_list, node) { @@ -387,12 +387,13 @@ static void update_temperature(struct th ret = tz->ops->get_temp(tz, &temp); if (ret) { pr_warn("failed to read out thermal zone %d\n", tz->id); - return; + goto exit; } tz->last_temperature = tz->temperature; tz->temperature = temp; +exit: mutex_unlock(&tz->lock); }