提交 2d297480 编写于 作者: D Dan Carpenter 提交者: Borislav Petkov

x86, microcode, AMD: Fix use after free in free_cache()

list_for_each_entry_reverse() dereferences the iterator, but we already
freed it. I don't see a reason that this has to be done in reverse order
so change it to use list_for_each_entry_safe().
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NBorislav Petkov <borislav.petkov@amd.com>
上级 2efb05e8
......@@ -150,9 +150,9 @@ static void update_cache(struct ucode_patch *new_patch)
static void free_cache(void)
{
struct ucode_patch *p;
struct ucode_patch *p, *tmp;
list_for_each_entry_reverse(p, &pcache, plist) {
list_for_each_entry_safe(p, tmp, &pcache, plist) {
__list_del(p->plist.prev, p->plist.next);
kfree(p->data);
kfree(p);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册