Skip to content

Commit

Permalink
Merge tag 'for-linus-5.18-rc4-tag' of git://git.kernel.org/pub/scm/li…
Browse files Browse the repository at this point in the history
…nux/kernel/git/xen/tip

Pull xen fixes from Juergen Gross:
 "A simple cleanup patch and a refcount fix for Xen on Arm"

* tag 'for-linus-5.18-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
  arm/xen: Fix some refcount leaks
  xen: Convert kmap() to kmap_local_page()
  • Loading branch information
torvalds committed Apr 23, 2022
2 parents 13bc32b + 533bec1 commit b51bd23
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions arch/arm/xen/enlighten.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,15 @@ int __init arch_xen_unpopulated_init(struct resource **res)

if (!nr_reg) {
pr_err("No extended regions are found\n");
of_node_put(np);
return -EINVAL;
}

regs = kcalloc(nr_reg, sizeof(*regs), GFP_KERNEL);
if (!regs)
if (!regs) {
of_node_put(np);
return -ENOMEM;
}

/*
* Create resource from extended regions provided by the hypervisor to be
Expand Down Expand Up @@ -403,8 +406,8 @@ int __init arch_xen_unpopulated_init(struct resource **res)
*res = &xen_resource;

err:
of_node_put(np);
kfree(regs);

return rc;
}
#endif
Expand All @@ -424,8 +427,10 @@ static void __init xen_dt_guest_init(void)

if (of_address_to_resource(xen_node, GRANT_TABLE_INDEX, &res)) {
pr_err("Xen grant table region is not found\n");
of_node_put(xen_node);
return;
}
of_node_put(xen_node);
xen_grant_frames = res.start;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/xen/gntalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ static void __del_gref(struct gntalloc_gref *gref)
unsigned long addr;

if (gref->notify.flags & UNMAP_NOTIFY_CLEAR_BYTE) {
uint8_t *tmp = kmap(gref->page);
uint8_t *tmp = kmap_local_page(gref->page);
tmp[gref->notify.pgoff] = 0;
kunmap(gref->page);
kunmap_local(tmp);
}
if (gref->notify.flags & UNMAP_NOTIFY_SEND_EVENT) {
notify_remote_via_evtchn(gref->notify.event);
Expand Down

0 comments on commit b51bd23

Please sign in to comment.