Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp659770pxj; Tue, 18 May 2021 11:13:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcj0ikiNxVQXaQoooNOSl4M2hdnZtkZhHTNcwZfkDewqaFajtCKpmCLN01N/WeW3jN1YxJ X-Received: by 2002:aa7:dbc9:: with SMTP id v9mr8543776edt.183.1621361601954; Tue, 18 May 2021 11:13:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621361601; cv=none; d=google.com; s=arc-20160816; b=ynbq4I1az1eDopHZmqlB27iV0lhKwloU3VmWLWAyw9DMEBbDWS2c+knJdok2a/ufsK 0V9MBSnif9B2A6CgMlLY3gytKzLg0I+74y4jdo1/rGlIWqwq09uhNPPL8NbTHfZcq0AY TGXmGL3c7DIRnTk1b3Apl4SIXv/jk3q0YlWRbyX5+Kz7tq8ja6j9BzGr24Gmizaq3ucd /WDuKwRQ6Y2WCPn65dFory7IqKFTACiQIkxIjvE1L/dOkeIlfSJHI+D6dWLLQLAi5Pdf oOtA4cTecyy/SHOBNrM4dz+4V4GIaLLOPXtYBoEntpbAGMQqjqrmCw+0YbCv8smGPSf+ UZow== 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=JeRBCvQRPQDvxaZyJEZBOElRw9UdvLJiBmH56tQ+8CA=; b=jJhuhMfB7A4VxhNdPrrpE5xyNAfJMTWdcn0x0zShH6XVYWMF268Z6guzJp/pAkbWSb wEbKXd6E8BVE8NK9chhpnUL9NBBQxPIZqK43XUHQBCreneq0wYqOhozQzBWAJP7WDvbn MJwOo/0NthnsLNtYc1KTi8Dh1cbBZWxW3lx5Ud2p3rrrrAHEYtG+y7fSH1pH9zj61Kjg XJCId+mDa89y0TEi1XowTAsdtXf1lIR5N1GMlH+q2TmRNFG84iSVkVZo6Pb1wSeiT6lz b+5fb7ujibTyHjekVxMrh6Oo/+JPT133bi6v1olUny9Fbz3CXqwf4QDPL2idCpSRHCkh hn8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1BHtHn7P; 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 o7si18345870ejm.741.2021.05.18.11.12.59; Tue, 18 May 2021 11:13:21 -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=1BHtHn7P; 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 S1345068AbhEQQM3 (ORCPT + 99 others); Mon, 17 May 2021 12:12:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:35078 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243418AbhEQPsK (ORCPT ); Mon, 17 May 2021 11:48:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CE1A86195A; Mon, 17 May 2021 14:44:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262690; bh=vjRzk8bYKbakThoVaMc//KZ4NHSVmY1DMv1cBk4aWCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1BHtHn7PfvJ+MJnkSjCUcPrVCH2zJ+fyo0fFck0LDMeNN2sGs/VG7YnHpcSRxePug 4awH5m70hkGWWoeSdZw6V6emSpwJxD2zAO4Dald2RC8XBYNeFx+wWUKbEAK1bAitzI wzqHDK4FH7Fk0bgED3dxyFWwlSdj1czoAt//3tMc= 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.10 229/289] ACPI: scan: Fix a memory leak in an error handling path Date: Mon, 17 May 2021 16:02:34 +0200 Message-Id: <20210517140312.872162859@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 b47f14ac75ae..de0533bd4e08 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -705,6 +705,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