From patchwork Mon Aug 8 21:12:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 12939138 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26258C00140 for ; Mon, 8 Aug 2022 21:11:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 767146B0071; Mon, 8 Aug 2022 17:11:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 715EE6B0073; Mon, 8 Aug 2022 17:11:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5DD188E0001; Mon, 8 Aug 2022 17:11:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 4C8836B0071 for ; Mon, 8 Aug 2022 17:11:54 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1D149AAC21 for ; Mon, 8 Aug 2022 21:11:54 +0000 (UTC) X-FDA: 79777672548.11.548102B Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by imf30.hostedemail.com (Postfix) with ESMTP id 3EE408005E for ; Mon, 8 Aug 2022 21:11:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659993113; x=1691529113; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ZtSgYuDbaBj2/G6ilDZHPwxBLmBXYG5l1URDjs2uSy8=; b=LeNqyC+Ih+4teLDMl+2Io5N4ZBcmjbHHgXL8DdBfWqjoRg8rtML6e4EM J9I9dzUe3bpaYaPx7/utDBMQ31CjKEfzJbESt5UrFj3gVb2kr32saitxC CUy3tB5sUoWoflovAC48HRvfEZslZjQ1MdGFxZ+Zz9qKpAt1A4ZtC5CB+ S4OD8Anixf2S6z6AuhpThYctB2Wr1JwqIVrVC5llwBuQ2XhI1iVHmyujo iZN4BxJIlIEacO7c2J2sjDeeuAia/IlSQBDlrDI0bNcXHanChGNxHg2st fEybyfreCc0hGpq3dA6W5jcA/TG8WcAJ91+jdJ5Twsoi33X1+rNcOeDBg g==; X-IronPort-AV: E=McAfee;i="6400,9594,10433"; a="291473017" X-IronPort-AV: E=Sophos;i="5.93,222,1654585200"; d="scan'208";a="291473017" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Aug 2022 14:11:52 -0700 X-IronPort-AV: E=Sophos;i="5.93,222,1654585200"; d="scan'208";a="601225610" Received: from punajuuri.fi.intel.com (HELO paasikivi.fi.intel.com) ([10.237.72.43]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Aug 2022 14:11:50 -0700 Received: from punajuuri.localdomain (punajuuri.localdomain [192.168.240.130]) by paasikivi.fi.intel.com (Postfix) with ESMTP id F16BD202EA; Tue, 9 Aug 2022 00:11:47 +0300 (EEST) Received: from sailus by punajuuri.localdomain with local (Exim 4.94.2) (envelope-from ) id 1oLA2n-004QVL-Ac; Tue, 09 Aug 2022 00:12:13 +0300 From: Sakari Ailus To: "Rafael J. Wysocki" Cc: Sakari Ailus , LKML , Linux Memory Management List , linux-acpi@vger.kernel.org, lkp@lists.01.org, lkp@intel.com, kernel test robot Subject: [PATCH 1/1] ACPI: property: Fix error handling in acpi_init_properties() Date: Tue, 9 Aug 2022 00:12:13 +0300 Message-Id: <20220808211213.1055148-1-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659993113; a=rsa-sha256; cv=none; b=YXgX2s4zNB2cpnWpJ1ldrR28NnwMkR/nL8ShrLqi3pfMOlUXHA/Eykpt+kT6G/wh/3fbYk mLkUhK0dJ1LoslRHiWFtPkXvLth2q+xKPYAcBnTIwfEaVQ64tHbwnzJUQLPVCXI4SV+pSC sXBfVZcc4jXAqhD2c2MGwrQ7m0zeXPE= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=LeNqyC+I; spf=none (imf30.hostedemail.com: domain of sakari.ailus@linux.intel.com has no SPF policy when checking 134.134.136.24) smtp.mailfrom=sakari.ailus@linux.intel.com; dmarc=fail reason="No valid SPF" header.from=intel.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659993113; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=G8t+qvzoFXKn78LTu0t6Qaqlibblzn6O/NTdUbJXFm0=; b=GADK1SXspIuL1OtPHTu7m0cZVyI4fQfJVSQpYIn+SZfr9Q0c+qOT4sISMGd7KELjhTPo9z RSJ3lSBU38s8w3rDpGuQZTRlX9llp1Z1Z2lsZ+RofQju5+NfYhmQETTMq8UlkTRV76iSWY +zSR0g7ResSlKEXHRZMHq1wA6zCwAIU= X-Rspamd-Queue-Id: 3EE408005E Authentication-Results: imf30.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=LeNqyC+I; spf=none (imf30.hostedemail.com: domain of sakari.ailus@linux.intel.com has no SPF policy when checking 134.134.136.24) smtp.mailfrom=sakari.ailus@linux.intel.com; dmarc=fail reason="No valid SPF" header.from=intel.com (policy=none) X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: fy6w9kihacsx954xg1bydc777xago97c X-HE-Tag: 1659993113-517880 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: buf.pointer, memory for storing _DSD data and nodes, was released if either parsing properties or, as recently added, attaching data node tags failed. Alas, properties were still left pointing to this memory if parsing properties were successful but attaching data node tags failed. Fix this by separating error handling for the two, and leaving properties intact if data nodes cannot be tagged for a reason or another. Reported-by: kernel test robot Fixes: 1d52f10917a7 ("ACPI: property: Tie data nodes to acpi handles") Signed-off-by: Sakari Ailus --- Hi Rafael, This should fix the immediate problem. It needs to be figured out why data node tagging doesn't work sometimes but that can wait. drivers/acpi/property.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 9711482014a6..201a5a9b2671 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -566,13 +566,13 @@ void acpi_init_properties(struct acpi_device *adev) &adev->data, acpi_fwnode_handle(adev))) adev->data.pointer = buf.pointer; - if (!adev->data.pointer || - !acpi_tie_nondev_subnodes(&adev->data)) { - acpi_untie_nondev_subnodes(&adev->data); + if (!adev->data.pointer) { acpi_handle_debug(adev->handle, "Invalid _DSD data, skipping\n"); ACPI_FREE(buf.pointer); + } else { + if (!acpi_tie_nondev_subnodes(&adev->data)) + acpi_untie_nondev_subnodes(&adev->data); } - out: if (acpi_of && !adev->flags.of_compatible_ok) acpi_handle_info(adev->handle,