xen/privcmd: Corrected error handling path
authorSouptick Joarder <jrdr.linux@gmail.com>
Sun, 12 Jul 2020 03:39:53 +0000 (09:09 +0530)
committerJuergen Gross <jgross@suse.com>
Mon, 3 Aug 2020 05:41:25 +0000 (07:41 +0200)
commite398fb4bdf522abdeb8ddb61235bbf66065fc105
tree08b42848e791b9d665f7928eae9c347c8034dc98
parentbcf876870b95592b52519ed4aafcf9d95999bc9c
xen/privcmd: Corrected error handling path

Previously, if lock_pages() end up partially mapping pages, it used
to return -ERRNO due to which unlock_pages() have to go through
each pages[i] till *nr_pages* to validate them. This can be avoided
by passing correct number of partially mapped pages & -ERRNO separately,
while returning from lock_pages() due to error.

With this fix unlock_pages() doesn't need to validate pages[i] till
*nr_pages* for error scenario and few condition checks can be ignored.

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Paul Durrant <paul@xen.org>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Paul Durrant <xadimgnik@gmail.com>
Link: https://lore.kernel.org/r/1594525195-28345-2-git-send-email-jrdr.linux@gmail.com
Signed-off-by: Juergen Gross <jgross@suse.com>
drivers/xen/privcmd.c