Skip to content

Commit 5f74695

Browse files
jbeulichksacilotto
authored andcommitted
xen-scsiback: don't "handle" error by BUG()
BugLink: https://bugs.launchpad.net/bugs/1918168 commit 7c77474 upstream. In particular -ENOMEM may come back here, from set_foreign_p2m_mapping(). Don't make problems worse, the more that handling elsewhere (together with map's status fields now indicating whether a mapping wasn't even attempted, and hence has to be considered failed) doesn't require this odd way of dealing with errors. This is part of XSA-362. Signed-off-by: Jan Beulich <jbeulich@suse.com> Cc: stable@vger.kernel.org Reviewed-by: Juergen Gross <jgross@suse.com> Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
1 parent 9c4718b commit 5f74695

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/xen/xen-scsiback.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,12 +422,12 @@ static int scsiback_gnttab_data_map_batch(struct gnttab_map_grant_ref *map,
422422
return 0;
423423

424424
err = gnttab_map_refs(map, NULL, pg, cnt);
425-
BUG_ON(err);
426425
for (i = 0; i < cnt; i++) {
427426
if (unlikely(map[i].status != GNTST_okay)) {
428427
pr_err("invalid buffer -- could not remap it\n");
429428
map[i].handle = SCSIBACK_INVALID_HANDLE;
430-
err = -ENOMEM;
429+
if (!err)
430+
err = -ENOMEM;
431431
} else {
432432
get_page(pg[i]);
433433
}

0 commit comments

Comments
 (0)