lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZxZaRUmZS4upPvv8@kuha.fi.intel.com>
Date: Mon, 21 Oct 2024 16:42:29 +0300
From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To: Javier Carrasco <javier.carrasco.cruz@...il.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Hans de Goede <hdegoede@...hat.com>, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH] usb: typec: fix unreleased fwnode_handle in
 typec_port_register_altmodes()

Hi,

On Mon, Oct 21, 2024 at 03:55:43PM +0300, Heikki Krogerus wrote:
> On Sat, Oct 19, 2024 at 10:40:19PM +0200, Javier Carrasco wrote:
> > The 'altmodes_node' fwnode_handle is never released after it is no
> > longer required, which leaks the resource.
> > 
> > Add the required call to fwnode_handle_put() when 'altmodes_node' is no
> > longer required.
> > 
> > Cc: stable@...r.kernel.org
> > Fixes: 7b458a4c5d73 ("usb: typec: Add typec_port_register_altmodes()")
> > Signed-off-by: Javier Carrasco <javier.carrasco.cruz@...il.com>
> 
> Reviewed-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
> 
> > ---
> >  drivers/usb/typec/class.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> > index d61b4c74648d..1eb240604cf6 100644
> > --- a/drivers/usb/typec/class.c
> > +++ b/drivers/usb/typec/class.c
> > @@ -2341,6 +2341,7 @@ void typec_port_register_altmodes(struct typec_port *port,
> >  		altmodes[index] = alt;
> >  		index++;
> >  	}
> > +	fwnode_handle_put(altmodes_node);
> >  }
> >  EXPORT_SYMBOL_GPL(typec_port_register_altmodes);

Sorry to go back to this, but I guess we should actually use those
scope based helpers with fwnodes in this case. So instead of a
dedicated fwnode_handle_put() call like that, just introduce
altmodes_node like this:

        ...
        struct fwnode_handle *altmodes_node __free(fwnode_handle) =
                device_get_named_child_node(&port->dev, "altmodes");

        if (IS_ERR(altmodes_node))
                return;

        fwnode_for_each_child_node(altmodes_node, child) {
        ...

thanks,

-- 
heikki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ