[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] Error ignored in xc_map_foreign_pages
>>> On 13.02.14 at 03:53, Mukesh Rathor <mukesh.rathor@xxxxxxxxxx> wrote: > It appears that xc_map_foreign_pages() handles return incorrectly : > > res = xc_map_foreign_bulk(xch, dom, prot, arr, err, num); > if (res) { > for (i = 0; i < num; i++) { > if (err[i]) { > errno = -err[i]; > munmap(res, num * PAGE_SIZE); > res = NULL; > break; > } > } > } > > The add to_physmap batch'd interface actually will store errors > in the err array, and return 0 unless EFAULT or something like that. > See xenmem_add_to_physmap_batch(). The case I'm looking at, xentrace > calls here to map page which fails, but the return is 0 as the error is > succesfully copied by xen. But the error is missed above since res is 0. > xentrace does something again, and that causes xen crash. > > It appears the fix could be just removing the check for res above... > > res = xc_map_foreign_bulk(xch, dom, prot, arr, err, num); > for (i = 0; i < num; i++) { > if (err[i]) { > ..... Definitely not. "res" is "void *", so it being NULL indicates there was no mapping established at all. Only if it's non-NULL it makes sense to inspect err[] (and call munmap(res, ...)). Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |