提交 da5c718e 编写于 作者: P Phil Elwell 提交者: Zheng Zengkai

Protect __release_resource against resources without parents

raspberrypi inclusion
category: feature
bugzilla: 50432

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

Without this patch, removing a device tree overlay can crash here.
Signed-off-by: NPhil Elwell <phil@raspberrypi.org>
Signed-off-by: NFang Yafen <yafen@iscas.ac.cn>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 fb8adf33
......@@ -214,6 +214,12 @@ static int __release_resource(struct resource *old, bool release_child)
{
struct resource *tmp, **p, *chd;
if (!old->parent) {
WARN(old->sibling, "sibling but no parent");
if (old->sibling)
return -EINVAL;
return 0;
}
p = &old->parent->child;
for (;;) {
tmp = *p;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册