[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ec56554c-b538-48b1-b878-938266d911fb@roeck-us.net>
Date: Thu, 26 Sep 2024 07:19:44 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Javier Carrasco <javier.carrasco.cruz@...il.com>
Cc: Jean Delvare <jdelvare@...e.com>,
Uwe Kleine-König <ukleinek@...nel.org>,
Chris Packham <chris.packham@...iedtelesis.co.nz>,
linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pwm@...r.kernel.org
Subject: Re: [PATCH] hwmon: (adt7475) Fix memory leak in
adt7475_fan_pwm_config()
On Thu, Sep 26, 2024 at 11:38:11AM +0200, Javier Carrasco wrote:
> The device_for_each_child_node() loop requires calls to
> fwnode_handle_put() upon early returns to decrement the refcount of
> the child node and avoid leaking memory.
>
> There are multiple early returns within that loop in
> adt7475_fan_pwm_config(), but fwnode_handle_put() is never called.
> Instead of adding the missing calls, the scoped version of the loop can
> be used to simplify the code and avoid mistakes in the future if new
> early returns are added.
>
> This issue was recently introduced and it does not affect old kernels
> that do not support the scoped variant.
>
> Fixes: 777c97ff08d0 ("hwmon: (adt7475) Add support for configuring initial PWM state")
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@...il.com>
Applied.
Thanks,
Guenter
Powered by blists - more mailing lists