firmware: fix one UAF issue

There could be the use after free issue in dmi_sysfs_register_handle.
During handling specializations process, the entry->child could be
free if the error occurs. However, it will be kobject_put after free.
So, we set the entry->child to NULL to avoid above case.

Reported-by: loydlv <loydlv@tencent.com>
Signed-off-by: Xinghui Li <korantli@tencent.com>
This commit is contained in:
Xinghui Li 2023-01-11 15:47:37 +08:00 committed by Jianping Liu
parent 84daaf3511
commit 5c899e5403
1 changed files with 1 additions and 0 deletions

View File

@ -470,6 +470,7 @@ out_del:
kobject_del(entry->child);
out_free:
kfree(entry->child);
entry->child = NULL;
return ret;
}