linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btbcm: Fix refcount leak in btbcm_get_board_name
@ 2022-06-05  6:56 Miaoqian Lin
  2022-06-05  7:56 ` bluez.test.bot
  2022-06-05 12:38 ` [PATCH] " Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Miaoqian Lin @ 2022-06-05  6:56 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	Linus Walleij, linux-bluetooth, linux-kernel
  Cc: linmq006

of_find_node_by_path() returns a node pointer with refcount incremented,
we should use of_node_put() on it when not need anymore.
Add missing of_node_put() in the error path to avoid refcount leak.

Fixes: 63fac3343b99 ("Bluetooth: btbcm: Support per-board firmware variants")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/bluetooth/btbcm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c
index 76fbb046bdbe..6f05054794e8 100644
--- a/drivers/bluetooth/btbcm.c
+++ b/drivers/bluetooth/btbcm.c
@@ -495,8 +495,10 @@ static const char *btbcm_get_board_name(struct device *dev)
 	if (!root)
 		return NULL;
 
-	if (of_property_read_string_index(root, "compatible", 0, &tmp))
+	if (of_property_read_string_index(root, "compatible", 0, &tmp)) {
+		of_node_put(root);
 		return NULL;
+	}
 
 	/* get rid of any '/' in the compatible string */
 	len = strlen(tmp) + 1;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: Bluetooth: btbcm: Fix refcount leak in btbcm_get_board_name
  2022-06-05  6:56 [PATCH] Bluetooth: btbcm: Fix refcount leak in btbcm_get_board_name Miaoqian Lin
@ 2022-06-05  7:56 ` bluez.test.bot
  2022-06-05 12:38 ` [PATCH] " Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2022-06-05  7:56 UTC (permalink / raw)
  To: linux-bluetooth, linmq006

[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=647420

---Test result---

Test Summary:
CheckPatch                    PASS      1.58 seconds
GitLint                       PASS      0.95 seconds
SubjectPrefix                 PASS      0.92 seconds
BuildKernel                   PASS      32.38 seconds
BuildKernel32                 PASS      28.97 seconds
Incremental Build with patchesPASS      39.52 seconds
TestRunner: Setup             PASS      478.23 seconds
TestRunner: l2cap-tester      PASS      17.54 seconds
TestRunner: bnep-tester       PASS      6.12 seconds
TestRunner: mgmt-tester       PASS      102.36 seconds
TestRunner: rfcomm-tester     PASS      9.75 seconds
TestRunner: sco-tester        PASS      9.53 seconds
TestRunner: smp-tester        PASS      9.60 seconds
TestRunner: userchan-tester   PASS      6.45 seconds



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Bluetooth: btbcm: Fix refcount leak in btbcm_get_board_name
  2022-06-05  6:56 [PATCH] Bluetooth: btbcm: Fix refcount leak in btbcm_get_board_name Miaoqian Lin
  2022-06-05  7:56 ` bluez.test.bot
@ 2022-06-05 12:38 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2022-06-05 12:38 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	linux-bluetooth, linux-kernel

On Sun, Jun 5, 2022 at 8:56 AM Miaoqian Lin <linmq006@gmail.com> wrote:

> of_find_node_by_path() returns a node pointer with refcount incremented,
> we should use of_node_put() on it when not need anymore.
> Add missing of_node_put() in the error path to avoid refcount leak.
>
> Fixes: 63fac3343b99 ("Bluetooth: btbcm: Support per-board firmware variants")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

Oops thanks!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-05 12:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-05  6:56 [PATCH] Bluetooth: btbcm: Fix refcount leak in btbcm_get_board_name Miaoqian Lin
2022-06-05  7:56 ` bluez.test.bot
2022-06-05 12:38 ` [PATCH] " Linus Walleij

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).