From patchwork Tue Nov 10 09:02:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 58977 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAA9340q030841 for ; Tue, 10 Nov 2009 09:03:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751698AbZKJJC5 (ORCPT ); Tue, 10 Nov 2009 04:02:57 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753222AbZKJJC5 (ORCPT ); Tue, 10 Nov 2009 04:02:57 -0500 Received: from mail-ew0-f207.google.com ([209.85.219.207]:45487 "EHLO mail-ew0-f207.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751698AbZKJJCy (ORCPT ); Tue, 10 Nov 2009 04:02:54 -0500 Received: by ewy3 with SMTP id 3so4001530ewy.37 for ; Tue, 10 Nov 2009 01:02:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:x-x-sender:to:cc :subject:message-id:user-agent:mime-version:content-type; bh=b9w8ze4jIR9rPbQvgIhk6n5Y7dSBELzjCJ2BST2oQbE=; b=hkYGGCmTuxzK3GQIvMZaXA6yhzMAQEXc/ni+kzNs/0PwDgHjk0eo5BQCI85VsHPYJ9 1aThXo0JbEOJDsXzqwC9Ub4XjjtcKhwKFJ3k/zAXqsiZJVVEoaqa9PGqxflX7Yqk4CdD 43szWX7g+uZN2W/vh0fOwfLUw3Y4XXmCTvnuk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:x-x-sender:to:cc:subject:message-id:user-agent :mime-version:content-type; b=jjn53IT9dLfZyJ5K8C8yTulf4iLMUCkwE3aSdNuHSQGke856npD/BqX+up/Fq4eios sugJcR0457jzJL1DqvV0I919kM100Yb0nsFepMonKebxMDpZABgai9Ocj0OvTl1gFWUH 4olk2pBEK7owuWhBP9wsTLSwIUFSu6Sj3Et5U= Received: by 10.213.24.25 with SMTP id t25mr10238188ebb.98.1257843778872; Tue, 10 Nov 2009 01:02:58 -0800 (PST) Received: from bicker.local ([41.222.20.196]) by mx.google.com with ESMTPS id 7sm1238533eyb.24.2009.11.10.01.02.54 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 10 Nov 2009 01:02:58 -0800 (PST) Date: Tue, 10 Nov 2009 11:02:49 +0200 (SAST) From: Dan Carpenter X-X-Sender: dcarpenter@bicker To: linux-acpi@vger.kernel.org cc: lenb@kernel.org Subject: [patch] prevent possible NULL dereference. Message-ID: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org --- orig/drivers/acpi/acpica/exmutex.c 2009-11-07 09:46:53.000000000 +0200 +++ devel/drivers/acpi/acpica/exmutex.c 2009-11-07 09:48:16.000000000 +0200 @@ -375,6 +375,15 @@ return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED); } + /* Must have a valid thread ID */ + + if (!walk_state->thread) { + ACPI_ERROR((AE_INFO, + "Cannot release Mutex [%4.4s], null thread info", + acpi_ut_get_node_name(obj_desc->mutex.node))); + return_ACPI_STATUS(AE_AML_INTERNAL); + } + /* * The Mutex is owned, but this thread must be the owner. * Special case for Global Lock, any thread can release @@ -392,15 +401,6 @@ return_ACPI_STATUS(AE_AML_NOT_OWNER); } - /* Must have a valid thread ID */ - - if (!walk_state->thread) { - ACPI_ERROR((AE_INFO, - "Cannot release Mutex [%4.4s], null thread info", - acpi_ut_get_node_name(obj_desc->mutex.node))); - return_ACPI_STATUS(AE_AML_INTERNAL); - } - /* * The sync level of the mutex must be equal to the current sync level. In * other words, the current level means that at least one mutex at that