Skip to content

Commit b51bd23

Browse files
committed
Merge tag 'for-linus-5.18-rc4-tag' of git://git.kernel.org/pub/scm/linux/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()
2 parents 13bc32b + 533bec1 commit b51bd23

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

arch/arm/xen/enlighten.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,15 @@ int __init arch_xen_unpopulated_init(struct resource **res)
337337

338338
if (!nr_reg) {
339339
pr_err("No extended regions are found\n");
340+
of_node_put(np);
340341
return -EINVAL;
341342
}
342343

343344
regs = kcalloc(nr_reg, sizeof(*regs), GFP_KERNEL);
344-
if (!regs)
345+
if (!regs) {
346+
of_node_put(np);
345347
return -ENOMEM;
348+
}
346349

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

405408
err:
409+
of_node_put(np);
406410
kfree(regs);
407-
408411
return rc;
409412
}
410413
#endif
@@ -424,8 +427,10 @@ static void __init xen_dt_guest_init(void)
424427

425428
if (of_address_to_resource(xen_node, GRANT_TABLE_INDEX, &res)) {
426429
pr_err("Xen grant table region is not found\n");
430+
of_node_put(xen_node);
427431
return;
428432
}
433+
of_node_put(xen_node);
429434
xen_grant_frames = res.start;
430435
}
431436

drivers/xen/gntalloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,9 @@ static void __del_gref(struct gntalloc_gref *gref)
178178
unsigned long addr;
179179

180180
if (gref->notify.flags & UNMAP_NOTIFY_CLEAR_BYTE) {
181-
uint8_t *tmp = kmap(gref->page);
181+
uint8_t *tmp = kmap_local_page(gref->page);
182182
tmp[gref->notify.pgoff] = 0;
183-
kunmap(gref->page);
183+
kunmap_local(tmp);
184184
}
185185
if (gref->notify.flags & UNMAP_NOTIFY_SEND_EVENT) {
186186
notify_remote_via_evtchn(gref->notify.event);

0 commit comments

Comments
 (0)