Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2190168iof; Tue, 7 Jun 2022 22:40:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycqlJn+uN7ChKicC2t7o7+eq2XrLcdfdiG3aBnLTelIjBp+N/JForlXukDG0LUQ5cShd+A X-Received: by 2002:a17:90a:930b:b0:1d5:684b:8e13 with SMTP id p11-20020a17090a930b00b001d5684b8e13mr35819562pjo.153.1654666811825; Tue, 07 Jun 2022 22:40:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654666811; cv=none; d=google.com; s=arc-20160816; b=WjY0rjxol6t1Hy5cLc5GO/Iju1dE2Zl5FmMF0g7GRTnbmNHaCLufjxfZNI/rZ4wavK m9qI7xjV9zVT5nmABgy6RgFYkHjMdfveNcDfqcdVRRjJy9WHOB4PtJswYj5VVAsOy7Gt pX0Ercs38/kUVpy3zmr44oj+T0uzVkVz67ZNfUXjJ1ddMS06FgKydJ9Ayy4ZynRLH/b6 DCqUfkOekhugK+R/BQ9n+qXcMxDn3Awe7YyvzMrZMcrNPYfq9ZSiTzZ1K0MNBHwrbl/y mCmUqoxL+WlqV3umjeiV57xL58X491XJ5S9/C8HHnlzXGVx+Ya1PY/KdqTzSBi1yHQIy SfUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6r37njVV+Q9aKjGPXryb7ynr5aQd87MT6S1Zv8r9uZ4=; b=q8ZYkzXmC1KtzYzifNQYvc+IbedGIwoxc2B9o4AEUAPW416j+v1J9MuMit8BqJg+j+ 1Q7cBGgdMGhgCjT1qJYXm2ao4N2o1hNh7qtEFV6x9+597HjfhfMiieChUqKmCLYlL6jv QO4QRoPqBAcZNrGrU2R1jxrNmr8QWG0BcoQlsvp75t5OR1D7DKp7ohGpxcNc9AXISqOB uYcP6LQ8hnNcdrZ1YDMtqYi3tE3k0ZmfbrS3PntdFhpUOYrkyZR+OubcLCo9Kqn/Yla4 I92ZskMgsC2jmEg1T98/kKsi6NcYHrhRWvD9/kzF/3r4jgHPuukYDS+ehbuNxF6edfDh Fjow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N40sMEUQ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h191-20020a6383c8000000b003fe35d7beb5si1121569pge.211.2022.06.07.22.40.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:40:11 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N40sMEUQ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7E2C2433999; Tue, 7 Jun 2022 22:06:21 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351150AbiFGSPw (ORCPT + 99 others); Tue, 7 Jun 2022 14:15:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349153AbiFGRzn (ORCPT ); Tue, 7 Jun 2022 13:55:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE82E146416; Tue, 7 Jun 2022 10:40:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 64CF56146F; Tue, 7 Jun 2022 17:35:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AB68C385A5; Tue, 7 Jun 2022 17:34:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654623299; bh=54fPIN8G1JovSP05z2k3xNR+dvWsXyhzfXkHCXyejmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N40sMEUQm/Lv0JGi8Ie07s9FUFffkrCcwqD+1FlG7gscSzVCD2oSahz+1dduQmdKT Ri/nXvO4CwAqY4skivGNMlXUXLVLvPL5dgJnUbrW4mV8X0hLImICUrLpbZF+sy4mF5 OAsQftg1onk48CqGc6+tBPDRscOIuSPEHiBHv0zg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sakari Ailus , Andy Shevchenko , "Rafael J. Wysocki" Subject: [PATCH 5.10 366/452] ACPI: property: Release subnode properties with data nodes Date: Tue, 7 Jun 2022 19:03:43 +0200 Message-Id: <20220607164919.469141778@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164908.521895282@linuxfoundation.org> References: <20220607164908.521895282@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sakari Ailus commit 3bd561e1572ee02a50cd1a5be339abf1a5b78d56 upstream. struct acpi_device_properties describes one source of properties present on either struct acpi_device or struct acpi_data_node. When properties are parsed, both are populated but when released, only those properties that are associated with the device node are freed. Fix this by also releasing memory of the data node properties. Fixes: 5f5e4890d57a ("ACPI / property: Allow multiple property compatible _DSD entries") Cc: 4.20+ # 4.20+ Signed-off-by: Sakari Ailus Reviewed-by: Andy Shevchenko Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/property.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -433,6 +433,16 @@ void acpi_init_properties(struct acpi_de acpi_extract_apple_properties(adev); } +static void acpi_free_device_properties(struct list_head *list) +{ + struct acpi_device_properties *props, *tmp; + + list_for_each_entry_safe(props, tmp, list, list) { + list_del(&props->list); + kfree(props); + } +} + static void acpi_destroy_nondev_subnodes(struct list_head *list) { struct acpi_data_node *dn, *next; @@ -445,22 +455,18 @@ static void acpi_destroy_nondev_subnodes wait_for_completion(&dn->kobj_done); list_del(&dn->sibling); ACPI_FREE((void *)dn->data.pointer); + acpi_free_device_properties(&dn->data.properties); kfree(dn); } } void acpi_free_properties(struct acpi_device *adev) { - struct acpi_device_properties *props, *tmp; - acpi_destroy_nondev_subnodes(&adev->data.subnodes); ACPI_FREE((void *)adev->data.pointer); adev->data.of_compatible = NULL; adev->data.pointer = NULL; - list_for_each_entry_safe(props, tmp, &adev->data.properties, list) { - list_del(&props->list); - kfree(props); - } + acpi_free_device_properties(&adev->data.properties); } /**