From: Javier Carrasco <javier.carrasco.cruz@gmail.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Hans de Goede <hdegoede@redhat.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] usb: typec: fix unreleased fwnode_handle in typec_port_register_altmodes()
Date: Mon, 21 Oct 2024 16:06:30 +0200 [thread overview]
Message-ID: <d5733f9e-6eb5-4b03-b264-a3f9f35791f6@gmail.com> (raw)
In-Reply-To: <ZxZaRUmZS4upPvv8@kuha.fi.intel.com>
On 21/10/2024 15:42, Heikki Krogerus wrote:
> 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@vger.kernel.org
>>> Fixes: 7b458a4c5d73 ("usb: typec: Add typec_port_register_altmodes()")
>>> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
>>
>> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.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,
>
That would have to be a second patch, because it does not apply to all
affected stable kernels. I can send it separately, though.
Best regards,
Javier Carrasco
next prev parent reply other threads:[~2024-10-21 14:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-19 20:40 [PATCH] usb: typec: fix unreleased fwnode_handle in typec_port_register_altmodes() Javier Carrasco
2024-10-21 12:55 ` Heikki Krogerus
2024-10-21 13:42 ` Heikki Krogerus
2024-10-21 14:06 ` Javier Carrasco [this message]
2024-10-21 14:20 ` Heikki Krogerus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d5733f9e-6eb5-4b03-b264-a3f9f35791f6@gmail.com \
--to=javier.carrasco.cruz@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox