Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp485693pxj; Thu, 20 May 2021 14:09:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyI7Sw4+Ye8E9GM7WfkL+w4LSPGOrgz6etFWDJg4M+BqJtb4hRKxzSccKyUa9qDzpAeSHw2 X-Received: by 2002:a02:b18f:: with SMTP id t15mr8502573jah.127.1621544948413; Thu, 20 May 2021 14:09:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621544948; cv=none; d=google.com; s=arc-20160816; b=hPDmhnFlZ/1B7gCw3mTXsKaFNjdakZPepfl8tnZ3TvT6zNNRMBxGJVzkxWw0K0SZvK ED8RlWKRaqZPQIfV+7MMq0bKyOCT2C6dCsFDDVI7bFrJdHcWkvj4tGtdBiW7VDS/BFOU rQV9Pm6WAGSjx3PMTkmyPkosE0Tr4rBKCte2k+gHLd4rk7tO1/KpPBrpIzjlENWChAlc XebmlBYS5EcuHQyjwWEnki1QPCV4Fk2D9Vmr179NZZLZyHSOQ+5ILVzZqEgwtDjtoUDA u+G7hZpePrrU93OQYOq3shY/+04RAzH8k5aEziSmWmv+Wpx7u37/g5VSGm1IrKm9xf5Y 6jvg== 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=MXDbqyRjlUHp+ssViPUCy6csZYu7V68Yi7Jp8M2HQbo=; b=RvOfdhvGcr4mVDZo5YJjdZ3G5KXtynXytCtMU03DGabVlqLSn4JI25iT4T8ED9pCN9 MC0JBVvEbZmjmPOdlqBEhhJV2e/wc9boLjkFwF0Eoa9J2sC+uGVtkypk+qA5vxLNvEso SWpYAkSu1H9aT8+k/QLiZHU3ASk/wZs+Isy9pguGvdjmPrQV1jVuwsnnIEJXUrG7iN9U foCmrRO+HwCtsRXwSlfk1+HFw1ChiWm+3KTIjMSlmmwfDo566N3A2VRjSGvyHop3r+Ai kiMBJoFa3N8ZzTUeLZpctW1+E+loIQVfu1KBcLfm/Sh/cMTVoCzO7pTlG7VsIoIXPWBs sFCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=X9uVK5gC; 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 i13si4609289ilm.45.2021.05.20.14.08.55; Thu, 20 May 2021 14:09:08 -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=X9uVK5gC; 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 S238596AbhETLBA (ORCPT + 99 others); Thu, 20 May 2021 07:01:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:44304 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237450AbhETKnM (ORCPT ); Thu, 20 May 2021 06:43:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C580D613BB; Thu, 20 May 2021 09:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504598; bh=kaakvcBm3EUSwPhuc6Q9/zGlpRcyDZIi9PKl0Y1AXHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X9uVK5gC4sB3qBUIJkvTok/YmeL6GWp3SsK/PiKjVBufHzd692Vx7ahjCbkIyMTtA uIlKaN9iWHs+BvkezFWmyTM3qw+OfxBCiVQW+5zwAopvBQvgAo1vEitBV5fc/7hEd/ fw7N/bVXSm9TVfPmm6cRyyZEwib0nDEB0ocPrxbk= 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 4.14 284/323] ACPI: scan: Fix a memory leak in an error handling path Date: Thu, 20 May 2021 11:22:56 +0200 Message-Id: <20210520092129.958784547@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 57a213466721..11f07f525b13 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -704,6 +704,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