usb: aspeed-vhub: Fix refcount leak bug in ast_vhub_init_desc()
Subsystems (2)
PATCH 1/1 usb: aspeed-vhub: Fix refcount leak bug in ast_vhub_init_desc()
We should call of_node_put() for the reference returned by of_get_child_by_name() which has increased the refcount.
Fixes 30d2617fd7ed ("usb: gadget: aspeed: allow to set usb strings in device tree")
Signed-off-by Liang He <[email protected]>
--- drivers/usb/gadget/udc/aspeed-vhub/hub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/gadget/udc/aspeed-vhub/hub.c +3 -1
@@ -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);
Signature · 1 line
2.25.1
Quoted 6 lines · Liang He
We should call
of_node_put()for the reference returned byof_get_child_by_name()which has increased the refcount.Fixes 30d2617fd7ed ("usb: gadget: aspeed: allow to set usb strings indevice tree")
Signed-off-by Liang He <[email protected]>
Reviewed-by Andrew Jeffery <[email protected]>