Skip to content

Commit f28347c

Browse files
jbeulichjgross1
authored andcommitted
Xen/gntdev: don't ignore kernel unmapping error
While working on XSA-361 and its follow-ups, I failed to spot another place where the kernel mapping part of an operation was not treated the same as the user space part. Detect and propagate errors and add a 2nd pr_debug(). Signed-off-by: Jan Beulich <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Juergen Gross <[email protected]>
1 parent 4403f80 commit f28347c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/xen/gntdev.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,14 @@ static int __unmap_grant_pages(struct gntdev_grant_map *map, int offset,
381381
map->unmap_ops[offset+i].handle,
382382
map->unmap_ops[offset+i].status);
383383
map->unmap_ops[offset+i].handle = INVALID_GRANT_HANDLE;
384+
if (use_ptemod) {
385+
if (map->kunmap_ops[offset+i].status)
386+
err = -EINVAL;
387+
pr_debug("kunmap handle=%u st=%d\n",
388+
map->kunmap_ops[offset+i].handle,
389+
map->kunmap_ops[offset+i].status);
390+
map->kunmap_ops[offset+i].handle = INVALID_GRANT_HANDLE;
391+
}
384392
}
385393
return err;
386394
}

0 commit comments

Comments
 (0)