* [PATCH net] wifi: brcmfmac: release 'root' node in all execution paths
@ 2024-10-30 17:34 Javier Carrasco
2024-10-31 14:18 ` Kalle Valo
2024-11-11 12:09 ` Kalle Valo
0 siblings, 2 replies; 4+ messages in thread
From: Javier Carrasco @ 2024-10-30 17:34 UTC (permalink / raw)
To: Arend van Spriel, Kalle Valo, Linus Walleij,
Russell King (Oracle), Hector Martin, Alvin Šipraga
Cc: linux-wireless, brcm80211, brcm80211-dev-list.pdl, linux-kernel,
stable, Javier Carrasco
The fixed patch introduced an additional condition to enter the scope
where the 'root' device_node is released (!settings->board_type,
currently 'err'), which avoid decrementing the refcount with a call to
of_node_put() if that second condition is not satisfied.
Move the call to of_node_put() to the point where 'root' is no longer
required to avoid leaking the resource if err is not zero.
Cc: stable@vger.kernel.org
Fixes: 7682de8b3351 ("wifi: brcmfmac: of: Fetch Apple properties")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
Note that a call to of_node_put() on a NULL device_node has no effect,
which simplifies this patch as there is no need to refactor the or
add more conditions.
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
index fe4f65756105..af930e34c21f 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
@@ -110,9 +110,8 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
}
strreplace(board_type, '/', '-');
settings->board_type = board_type;
-
- of_node_put(root);
}
+ of_node_put(root);
if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac"))
return;
---
base-commit: c05c62850a8f035a267151dd86ea3daf887e28b8
change-id: 20241030-brcmfmac-of-cleanup-000fe98821df
Best regards,
--
Javier Carrasco <javier.carrasco.cruz@gmail.com>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] wifi: brcmfmac: release 'root' node in all execution paths
2024-10-30 17:34 [PATCH net] wifi: brcmfmac: release 'root' node in all execution paths Javier Carrasco
@ 2024-10-31 14:18 ` Kalle Valo
2024-10-31 14:46 ` Javier Carrasco
2024-11-11 12:09 ` Kalle Valo
1 sibling, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2024-10-31 14:18 UTC (permalink / raw)
To: Javier Carrasco
Cc: Arend van Spriel, Linus Walleij, Russell King (Oracle),
Hector Martin, Alvin Šipraga, linux-wireless, brcm80211,
brcm80211-dev-list.pdl, linux-kernel, stable, Javier Carrasco
Javier Carrasco <javier.carrasco.cruz@gmail.com> wrote:
> The fixed patch introduced an additional condition to enter the scope
> where the 'root' device_node is released (!settings->board_type,
> currently 'err'), which avoid decrementing the refcount with a call to
> of_node_put() if that second condition is not satisfied.
>
> Move the call to of_node_put() to the point where 'root' is no longer
> required to avoid leaking the resource if err is not zero.
>
> Cc: stable@vger.kernel.org
> Fixes: 7682de8b3351 ("wifi: brcmfmac: of: Fetch Apple properties")
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Wireless patches go to wireless trees, not net. But no need to resend because
of this. And I think wireless-next is approriate for this fix.
--
https://patchwork.kernel.org/project/linux-wireless/patch/20241030-brcmfmac-of-cleanup-v1-1-0b90eefb4279@gmail.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] wifi: brcmfmac: release 'root' node in all execution paths
2024-10-31 14:18 ` Kalle Valo
@ 2024-10-31 14:46 ` Javier Carrasco
0 siblings, 0 replies; 4+ messages in thread
From: Javier Carrasco @ 2024-10-31 14:46 UTC (permalink / raw)
To: Kalle Valo
Cc: Arend van Spriel, Linus Walleij, Russell King (Oracle),
Hector Martin, Alvin Šipraga, linux-wireless, brcm80211,
brcm80211-dev-list.pdl, linux-kernel, stable
On 31/10/2024 15:18, Kalle Valo wrote:
> Javier Carrasco <javier.carrasco.cruz@gmail.com> wrote:
>
>> The fixed patch introduced an additional condition to enter the scope
>> where the 'root' device_node is released (!settings->board_type,
>> currently 'err'), which avoid decrementing the refcount with a call to
>> of_node_put() if that second condition is not satisfied.
>>
>> Move the call to of_node_put() to the point where 'root' is no longer
>> required to avoid leaking the resource if err is not zero.
>>
>> Cc: stable@vger.kernel.org
>> Fixes: 7682de8b3351 ("wifi: brcmfmac: of: Fetch Apple properties")
>> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
>
> Wireless patches go to wireless trees, not net. But no need to resend because
> of this. And I think wireless-next is approriate for this fix.
>
Sorry, the second link from your signature explains very well what I
should have done. I will keep that in mind for the next patch(es) to
wireless.
Thank you and best regards,
Javier Carrasco
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] wifi: brcmfmac: release 'root' node in all execution paths
2024-10-30 17:34 [PATCH net] wifi: brcmfmac: release 'root' node in all execution paths Javier Carrasco
2024-10-31 14:18 ` Kalle Valo
@ 2024-11-11 12:09 ` Kalle Valo
1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2024-11-11 12:09 UTC (permalink / raw)
To: Javier Carrasco
Cc: Arend van Spriel, Linus Walleij, Russell King (Oracle),
Hector Martin, Alvin Šipraga, linux-wireless, brcm80211,
brcm80211-dev-list.pdl, linux-kernel, stable, Javier Carrasco
Javier Carrasco <javier.carrasco.cruz@gmail.com> wrote:
> The fixed patch introduced an additional condition to enter the scope
> where the 'root' device_node is released (!settings->board_type,
> currently 'err'), which avoid decrementing the refcount with a call to
> of_node_put() if that second condition is not satisfied.
>
> Move the call to of_node_put() to the point where 'root' is no longer
> required to avoid leaking the resource if err is not zero.
>
> Cc: stable@vger.kernel.org
> Fixes: 7682de8b3351 ("wifi: brcmfmac: of: Fetch Apple properties")
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Patch applied to wireless-next.git, thanks.
2e19a3b590eb wifi: brcmfmac: release 'root' node in all execution paths
--
https://patchwork.kernel.org/project/linux-wireless/patch/20241030-brcmfmac-of-cleanup-v1-1-0b90eefb4279@gmail.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-11-11 12:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-30 17:34 [PATCH net] wifi: brcmfmac: release 'root' node in all execution paths Javier Carrasco
2024-10-31 14:18 ` Kalle Valo
2024-10-31 14:46 ` Javier Carrasco
2024-11-11 12:09 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).