Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp81532pxj; Mon, 17 May 2021 21:33:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxC1/7x1e5xxOBLSXRYA8uH7tRcpwVQCCYRbqjh2C10CQUr0+AnKqBgdcq0nkLDTWjJiXIL X-Received: by 2002:a5d:8c84:: with SMTP id g4mr2705508ion.32.1621312405592; Mon, 17 May 2021 21:33:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621312405; cv=none; d=google.com; s=arc-20160816; b=s+hAOhXg5VCq3IGf4qdNzVdelDbWYGNwwUEXYt546QoI/lqVoB0xRwiRixzETPAJFw aL1enFCYCG907/LrBtwVeQlqXh/p5S9jsn2T/7bvhJw5uJ++3IA6Vyh6k/os6MkQPLs6 laLHn5wgtVXr0DXfmm5vsbgpHtgqk0TINfoUPNjkHkGNIXDnvaoUn+GtaDQj1KzBm14C J02MK3CfxQdn8DT4cKCvJwt15URpR9Rnix+ZMl3wn5lzHwEmz9xMIPgwKU0vroweVCHL naxfiej+uuf03rzblJXqT2OxEu3XTAqaYRkmOxnAlB+9LK7vCQ+1OyiBgEyj9lCIgKoI +kJg== 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=lRuPszp3/jeR5xEhxUoiC0YfXkZzImMSNBKZcGATfQk=; b=pmuXlY8VshIW2d70rZHeV0LGCtZy9+tCDnFnft1QB02CKKQ0svFeyqPWREL1oj5ztH 29h7A5kpyKWdKm6CzDdKF50eHhrm6AVpcFSMwLA0kKq1HF8SJP7AnMqONZRYTmgKxcu8 CPwrJY2fq5N+ZRZKqcmSXAXwNaod+l4bDD8T3iQWQvEmloJMPGX45PU9fvcOOD+dFZRN 8bGb0WTAoJKTBFHY2Rb3XQyI9OzkwXRXXq+lMAyu0cqGTCiC84PgM1ICaXBmbjZpGvQF KP9mvsSd9riwzlZY60r6EtPgqtfwgHDVf5uqpAl4Fl39uC3b7xp/aB1s2byvVOlglLPP xdUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="D/eRQoLj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x20si19646887jao.3.2021.05.17.21.33.12; Mon, 17 May 2021 21:33:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="D/eRQoLj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239437AbhEQOma (ORCPT + 99 others); Mon, 17 May 2021 10:42:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:58370 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239772AbhEQOgJ (ORCPT ); Mon, 17 May 2021 10:36:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1124C61353; Mon, 17 May 2021 14:17:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261040; bh=Kr/BQLYjzFPgptyuJAvonnS/ZVz8l7t50Hi94lFYigQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D/eRQoLj7wAuqZ+ZrwJAqW9CT86+dFND8fAhNyKNdp1b4Mjgp9kljdY8yTFfHNbjO wcgf2emhe3Add79o3+45zycFY7Lrx0sWstUzA50zCJLJn7qvaWfxIT2qoixsntcPNJ 1rL40CIfwmqmx3oKS1xFM96dHpI+4DHqPhWMkK/4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Andy Shevchenko , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.12 295/363] ACPI: scan: Fix a memory leak in an error handling path Date: Mon, 17 May 2021 16:02:41 +0200 Message-Id: <20210517140312.571593160@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET [ Upstream commit 0c8bd174f0fc131bc9dfab35cd8784f59045da87 ] If 'acpi_device_set_name()' fails, we must free 'acpi_device_bus_id->bus_id' or there is a (potential) memory leak. Fixes: eb50aaf960e3 ("ACPI: scan: Use unique number for instance_no") Signed-off-by: Christophe JAILLET Reviewed-by: Andy Shevchenko Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/scan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 6efe7edd7b1e..345777bf7af9 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -701,6 +701,7 @@ int acpi_device_add(struct acpi_device *device, result = acpi_device_set_name(device, acpi_device_bus_id); if (result) { + kfree_const(acpi_device_bus_id->bus_id); kfree(acpi_device_bus_id); goto err_unlock; } -- 2.30.2