Skip to content

Commit

Permalink
usb: aspeed-vhub: Fix refcount leak bug in ast_vhub_init_desc()
Browse files Browse the repository at this point in the history
We should call of_node_put() for the reference returned by
of_get_child_by_name() which has increased the refcount.

Fixes: 30d2617 ("usb: gadget: aspeed: allow to set usb strings in device tree")
Signed-off-by: Liang He <windhl@126.com>
Link: https://lore.kernel.org/r/20220713120528.368168-1-windhl@126.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Liang He authored and Greg Kroah-Hartman committed Jul 14, 2022
1 parent efa2beb commit 220fafb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/usb/gadget/udc/aspeed-vhub/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1059,8 +1059,10 @@ static int ast_vhub_init_desc(struct ast_vhub *vhub)
/* Initialize vhub String Descriptors. */
INIT_LIST_HEAD(&vhub->vhub_str_desc);
desc_np = of_get_child_by_name(vhub_np, "vhub-strings");
if (desc_np)
if (desc_np) {
ret = ast_vhub_of_parse_str_desc(vhub, desc_np);
of_node_put(desc_np);
}
else
ret = ast_vhub_str_alloc_add(vhub, &ast_vhub_strings);

Expand Down

0 comments on commit 220fafb

Please sign in to comment.