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: 596453 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE79EC00140 for ; Mon, 8 Aug 2022 21:12:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236912AbiHHVMH (ORCPT ); Mon, 8 Aug 2022 17:12:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236304AbiHHVMF (ORCPT ); Mon, 8 Aug 2022 17:12:05 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9099917AB0; Mon, 8 Aug 2022 14:12:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659993124; x=1691529124; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ZtSgYuDbaBj2/G6ilDZHPwxBLmBXYG5l1URDjs2uSy8=; b=kFMPbR5TriyGjb3UWxUu5t/nDq33BTLkr0BKWbU34uFCFUqz6pEBGtuz r0MtPcLD1mtY7HW3EzqEzrQXlJTefRPK4gm1sf7g6QaU1G1yA6SiDy+6+ k+VHGKQgWuPXXQovByTOKsyGF2eCf6CEARealBfIxWa+v0JZF3ZR1FbdO aTOXwEnyhW+sw7UCHziDJd4dpgapkxLefd+bU8/RUc5zHPclf4dwk2D61 xYEdLqIQwWswRZW+MvKOR4bM0t+3nqbR20oTGdf9w8SG+jb60mSidB64C 5OQBskGD7+kji/UFLEjn460dr9P3uinxaknap6T8OV11fkpzM40QExQ+v A==; X-IronPort-AV: E=McAfee;i="6400,9594,10433"; a="352420977" X-IronPort-AV: E=Sophos;i="5.93,222,1654585200"; d="scan'208";a="352420977" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Aug 2022 14:11:51 -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 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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,