vhost/scsi: Fix incorrect early vhost_scsi_handle_vq failures
authorNicholas Bellinger <nab@linux-iscsi.org>
Fri, 30 Jan 2015 01:21:13 +0000 (17:21 -0800)
committerNicholas Bellinger <nab@linux-iscsi.org>
Wed, 4 Feb 2015 18:55:35 +0000 (10:55 -0800)
commitde1419e42088e99f8f839710c42aec759e45de77
tree4ac43a279beeb7504ef2b4216a549fafe67d1b19
parent79c14141a487211d1bb7840d3f607766f6115dd2
vhost/scsi: Fix incorrect early vhost_scsi_handle_vq failures

This patch fixes vhost_scsi_handle_vq() failure cases that result in BUG_ON()
getting triggered when vhost_scsi_free_cmd() is called, and ->tvc_se_cmd has
not been initialized by target_submit_cmd_map_sgls().

It changes tcm_vhost_release_cmd() to use tcm_vhost_cmd->tvc_nexus for obtaining
se_session pointer reference.  Also, avoid calling put_page() on NULL sg->page
entries in vhost_scsi_map_to_sgl() failure path.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/vhost/scsi.c