xen/privcmd: Correctly return success from IOCTL_PRIVCMD_MMAPBATCH
authorMats Petersson <mats.petersson@citrix.com>
Fri, 16 Nov 2012 18:36:49 +0000 (18:36 +0000)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 21 Nov 2012 02:25:36 +0000 (21:25 -0500)
commit68fa965dd923177eafad49b7a0045fc610917341
tree7b717a7dc86097704ca8946c3dcdd74390761367
parentab277bbf662ef17ffb7fd8dd7a462a34e326e492
xen/privcmd: Correctly return success from IOCTL_PRIVCMD_MMAPBATCH

This is a regression introduced by ceb90fa0 (xen/privcmd: add
PRIVCMD_MMAPBATCH_V2 ioctl).  It broke xentrace as it used
xc_map_foreign() instead of xc_map_foreign_bulk().

Most code-paths prefer the MMAPBATCH_V2, so this wasn't very obvious
that it broke. The return value is set early on to -EINVAL, and if all
goes well, the "set top bits of the MFN's" never gets called, so the
return value is still EINVAL when the function gets to the end, causing
the caller to think it went wrong (which it didn't!)

Now also including Andres "move the ret = -EINVAL into the error handling
path, as this avoids other similar errors in future.

Signed-off-by: Mats Petersson <mats.petersson@citrix.com>
Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/xen/privcmd.c