Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp935606lqb; Wed, 29 May 2024 15:35:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUclGg2/q6WymGGBLbPHi01fz4nJT2EAEVpmte47RacaA5ByIk0VnGaRlg/3VNrjzWJOtcnMtgjjnUeYRxBLZYarQ/YmzIMeqFKsuqtkA== X-Google-Smtp-Source: AGHT+IFWGUPuEQotyMxyAJfRJ3s+Awm5y1t50Q71jpWHanm30aOMMNX355BCx/Pfhn3fFaUW/l0d X-Received: by 2002:a50:8dc6:0:b0:572:cfa4:3ccb with SMTP id 4fb4d7f45d1cf-57a177925bdmr185805a12.8.1717022122065; Wed, 29 May 2024 15:35:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717022122; cv=pass; d=google.com; s=arc-20160816; b=zcrctp5IKzVoHQJc4F3i3X2VOCynEWL3Lsfzz3lQYqG3lDVpdeZWkJP9e8aUj+cYpi DiiAy/24RqffWaMbJixeDgvWNSMW0QA6fD9F7FIERWLBvL9vb3/kw/6Dtp0+9aq4t5OB T3MeuukAIbVymtjWdKmitL59GnJ5XF/TBXjZ1jmZfwIMC5R4vjS0KuS419ygukVVBwNP Wd3msz4DADAKkMrhSoTycoqHSKS01aWG8eB2t1I7bK4nNAcA2U94Sj0vGLf+y4JziiA1 BIDm3JQPaBdvYwmC33hd1k3/cJm2r9w0XJx7zlHda4zYiARp+Mh+ENR80X0mAe+1LbEx 9rxg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=8PKXIGJClXO6XAR8p5BSrXpvC9eow4Z4B6WrKMzRXUQ=; fh=SXXgd7uWK8nMqNnkpoOKKBiswhn1tMO3tJzJE+OV+Xg=; b=P3YrsvN6dHdZliiECjX1q0J+bQ4760+DxV1V6q7QX4vHr2cyLmwt+1zSaHhSmQb7cg UhcH/uug2suOf8dXp9OM5kQJ8GCX/RfUSYmWnQeibmrGzizugIcuGaZfhaLaHSLvLYVj /Ky/NN2xaJuG87adg2V7Ak1wPYrwloGr6vHb4yptxzFzW3VAM+ypotAizoyx/E6IlVvj uf3eMmRbOzhx6Iiy5FrmsfLNL8j8M9PDQQZwocuVfXgy9tvGK2Km81O+2jmx7v2wlxZ/ 2/gQOLp2fC92W/3fDua0pPIi5x8dabPGvMMC5w6VuBGKtf9MrPmtNdPLXVxejWTctsMg Ei2g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HgrlXmL7; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-194752-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194752-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57852495c73si6661173a12.449.2024.05.29.15.35.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 15:35:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194752-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HgrlXmL7; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-194752-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194752-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C76BC1F22D8D for ; Wed, 29 May 2024 22:35:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A40A178360; Wed, 29 May 2024 22:35:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HgrlXmL7" Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13032169ADC; Wed, 29 May 2024 22:35:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717022113; cv=none; b=tMobQCyhZAXvDNERpbgeNvQ16m7IIkZZRqj4rkeofJLUTtsX+FbUnPaRQ+vvBaY3cEHWrr5c3JGHYatLITE8F24xqWAeCkvuZQfxfNa5x/fJYAgR5RFBc2fbUvoHWmtRqv/NSl765EFYb3lhyqGrZYV0nabyXvOGOu6lsIhDQH4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717022113; c=relaxed/simple; bh=B5hvaFVG7YU+FAqWqO6NYlaM4U8myrItdnQs/64YBLc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GuixQpSLOJLR/eswXnPt1OMbhWSsCudK+pSPGkV6dab5x4ReZst6mYX/TV813954ucYpiIRa64ED2rkpEi2Iy0Nb1YUIQYAE9XGG6fLqUbV9vMiE2gut3Tohx1yDWqIRbAdOwiexTTRF3O516xwkJMAmbPl+Xe+NFH9BsKA9jYE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HgrlXmL7; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1f082d92864so2393515ad.1; Wed, 29 May 2024 15:35:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717022111; x=1717626911; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=8PKXIGJClXO6XAR8p5BSrXpvC9eow4Z4B6WrKMzRXUQ=; b=HgrlXmL77IBlbDM/qXOsRRXDifT5th8zkdU0X7UkJt56h5QsK7VGSzl7+14pskiTg4 RMWHfVl4NLd5jytSz4lOOxITutoq57cJ+0N7F73uFvEHr5QXMUuDLDHzpA/HGJkf220D ux1F/u2q/DipatWEfWG+AlmtVOVlathmz3ob15Bp8L248bJpV5spSklmeCIszA0byBab jIt310APGIT6+Cpyt9nlmvQUZ36GpdcD5UJtcxuKsgzKDSiDUdgbc2q9NKaKPHVFl8kh it/2OfKAGqPgQPClGYfxqW+sKOYZ3n1P/lQevKDoFscj8XCnY2WkytI5SUzllrsynHxi JeMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717022111; x=1717626911; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8PKXIGJClXO6XAR8p5BSrXpvC9eow4Z4B6WrKMzRXUQ=; b=ZCcP2i89bEgtg9cq8UTtQWHts3lxPzukv2dSa2iiybLN/va2Lx3Mx0n+GKS2mijDqs FzwyjKgS+3YdfyFRRyic1vTLaarha1fr+jk10TfTmkc8ETJtk+ENDX472+oC4d646JKv 8VX+tqFlkKcJFcU9pVbf95qSaOUXqOLICMI22lbqJ4312a7L6ck9VjpADmTqp34BuCkR xPAbTrGebS5yZjNLjZSIItPbQ0dyyQFMwpYWD4wsjOx6W/ZWnFvWOWVxirYgVnt0l2Ks LB5c1xvwYqKt7qXYVpELdgSz4ABe+RMU/xYTv2clRnrfxsfu7uDDti3/4bkWtwgAmcFA Ck3g== X-Forwarded-Encrypted: i=1; AJvYcCVWtP4uY6RFDyX+h7yIjNe+YuULSNr7XYqlbH/a4YMuO7FuvcLlgnsmJXJEilF0eJMJwOhlFB0R5rOS9CEAv3auAh8aAa97B1Mdl2IHMWuqFIHQT0IbjxanBddxjt35e0qQ7gWbqcMXPS/HnNWxXTLp/sp/xyyq4cofq/LxF7+GCusIPqla7tbg4qbq86J37ewpYEKFZ6aJI8OcBjsh X-Gm-Message-State: AOJu0YxMLMytyPAT8iOStetIPyh2qrTJf+xHfrbzZ/4AbOlTba0GnMas bC9HljLbtQaL34fCAmmzC1/KCAwD/w/LwiLWDza7azNNYbwX2DvSkaa8Lg== X-Received: by 2002:a17:902:c94b:b0:1f4:89e2:b47b with SMTP id d9443c01a7336-1f61992ee59mr4102995ad.50.1717022111255; Wed, 29 May 2024 15:35:11 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f44c75783asm105081475ad.23.2024.05.29.15.35.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 15:35:10 -0700 (PDT) Sender: Guenter Roeck Date: Wed, 29 May 2024 15:35:09 -0700 From: Guenter Roeck To: Javier Carrasco Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Jean Delvare , Antoniu Miclaus , Jonathan Cameron , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2 1/3] hwmon: (ltc2992) Fix memory leak in ltc2992_parse_dt() Message-ID: References: <20240523-fwnode_for_each_available_child_node_scoped-v2-0-701f3a03f2fb@gmail.com> <20240523-fwnode_for_each_available_child_node_scoped-v2-1-701f3a03f2fb@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240523-fwnode_for_each_available_child_node_scoped-v2-1-701f3a03f2fb@gmail.com> On Thu, May 23, 2024 at 05:47:14PM +0200, Javier Carrasco wrote: > A new error path was added to the fwnode_for_each_available_node() loop > in ltc2992_parse_dt(), which leads to an early return that requires a > call to fwnode_handle_put() to avoid a memory leak in that case. > > Add the missing fwnode_handle_put() in the error path from a zero value > shunt resistor. > > Cc: stable@vger.kernel.org > Fixes: 10b029020487 ("hwmon: (ltc2992) Avoid division by zero") > Signed-off-by: Javier Carrasco Applied. Thanks, Guenter > --- > drivers/hwmon/ltc2992.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/hwmon/ltc2992.c b/drivers/hwmon/ltc2992.c > index 229aed15d5ca..d4a93223cd3b 100644 > --- a/drivers/hwmon/ltc2992.c > +++ b/drivers/hwmon/ltc2992.c > @@ -876,9 +876,11 @@ static int ltc2992_parse_dt(struct ltc2992_state *st) > > ret = fwnode_property_read_u32(child, "shunt-resistor-micro-ohms", &val); > if (!ret) { > - if (!val) > + if (!val) { > + fwnode_handle_put(child); > return dev_err_probe(&st->client->dev, -EINVAL, > "shunt resistor value cannot be zero\n"); > + } > st->r_sense_uohm[addr] = val; > } > }