提交 a7eca066 编写于 作者: L Liang He 提交者: Zheng Zengkai

usb: aspeed-vhub: Fix refcount leak bug in ast_vhub_init_desc()

stable inclusion
from stable-v5.10.137
commit e6db5780c2bf6e23be7b315809ef349b4b4f2213
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I60PLB

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=e6db5780c2bf6e23be7b315809ef349b4b4f2213

--------------------------------

[ Upstream commit 220fafb4 ]

We should call of_node_put() for the reference returned by
of_get_child_by_name() which has increased the refcount.

Fixes: 30d2617f ("usb: gadget: aspeed: allow to set usb strings in device tree")
Signed-off-by: NLiang He <windhl@126.com>
Link: https://lore.kernel.org/r/20220713120528.368168-1-windhl@126.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 96db4706
...@@ -1033,8 +1033,10 @@ static int ast_vhub_init_desc(struct ast_vhub *vhub) ...@@ -1033,8 +1033,10 @@ static int ast_vhub_init_desc(struct ast_vhub *vhub)
/* Initialize vhub String Descriptors. */ /* Initialize vhub String Descriptors. */
INIT_LIST_HEAD(&vhub->vhub_str_desc); INIT_LIST_HEAD(&vhub->vhub_str_desc);
desc_np = of_get_child_by_name(vhub_np, "vhub-strings"); 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); ret = ast_vhub_of_parse_str_desc(vhub, desc_np);
of_node_put(desc_np);
}
else else
ret = ast_vhub_str_alloc_add(vhub, &ast_vhub_strings); ret = ast_vhub_str_alloc_add(vhub, &ast_vhub_strings);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册