From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B07F3AB285; Sat, 30 May 2026 18:41:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780166515; cv=none; b=Jkmo7eKCiuQ4/cvmZjWJMso6RegHWj65Ph615Ml+XUtxvAs1QX9uGiUXDRH/lbMDI/YOWar1O8xRsD0Aq+7QcOr8T28odOmeGE7/59BdPm4/1CZBH2p0A9YdYXtCoc/Tf7Us0u6EVL5ASr+xx3wD2ie7Dpml61fEVaIaS5hJDmc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780166515; c=relaxed/simple; bh=Ya1Gh3cgotlvweZkJskJoCS7Gw6oEkHVfZJFv1W/liI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bXLwlrqehrZFTUCMXctH0ChbTcDSHpCWePuZz6OL2jyYqbNZyJ2+jYSZEokEujqKAgPXMIop/7X4uooJp98zwMDpyA92WqjVMdOMRo/EoUZVFy2U4r4ExArHEDGNG1C6elbfV/Hr4ZN3w+OV77dfw1W0+8nNnvojs/4J7URR4pc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=G6e87bab; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="G6e87bab" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3BD81F00898; Sat, 30 May 2026 18:41:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780166509; bh=TK0ecHOxCGOJmACgCvEN4uUEybaW2or7DyKrrHAXV+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=G6e87bablRZ5wN1h82Fm8nwePqlxQ6QPWQINlq79oA0e3suca5OLr5YJgwYH57HY4 fWE0DuRrbdT1ollTOJLJqC+My2VlyfuFu3hV6R/fHrtospW8ptZa9BxFBcrVwQ4GSx +6rNPEJxLyrjFBqdeUGPXq7olq0AGKVMf6CjcwzM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Abdun Nihaal , Lee Jones , Sasha Levin Subject: [PATCH 5.10 393/589] mfd: mc13xxx-core: Fix memory leak in mc13xxx_add_subdevice_pdata() Date: Sat, 30 May 2026 18:04:34 +0200 Message-ID: <20260530160235.121536766@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160224.570625122@linuxfoundation.org> References: <20260530160224.570625122@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Abdun Nihaal [ Upstream commit a5a65a7fb2f7796bbe492cd6be59c92cb64377d1 ] The memory allocated for cell.name using kmemdup() is not freed when mfd_add_devices() fails. Fix that by using devm_kmemdup(). Fixes: 8e00593557c3 ("mfd: Add mc13892 support to mc13xxx") Signed-off-by: Abdun Nihaal Link: https://patch.msgid.link/20260120102622.66921-1-nihaal@cse.iitm.ac.in Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/mfd/mc13xxx-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c index e281a9202f110..a2b016a9eeae6 100644 --- a/drivers/mfd/mc13xxx-core.c +++ b/drivers/mfd/mc13xxx-core.c @@ -377,7 +377,7 @@ static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx, if (snprintf(buf, sizeof(buf), format, name) > sizeof(buf)) return -E2BIG; - cell.name = kmemdup(buf, strlen(buf) + 1, GFP_KERNEL); + cell.name = devm_kmemdup(mc13xxx->dev, buf, strlen(buf) + 1, GFP_KERNEL); if (!cell.name) return -ENOMEM; -- 2.53.0