]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
vhost-scsi: Take configfs group dependency during VHOST_SCSI_SET_ENDPOINT
authorNicholas Bellinger <nab@linux-iscsi.org>
Wed, 8 Oct 2014 06:19:20 +0000 (06:19 +0000)
committerJiri Slaby <jslaby@suse.cz>
Sat, 6 Dec 2014 14:18:23 +0000 (15:18 +0100)
commit32d48b3cc855df95001e80b1dc07adc2079d26fd
tree285ff8ebbc3a4678c08550d91f5f81b149ec1277
parent982b1001490f09f2a8810775a6c237d6b8e626f2
vhost-scsi: Take configfs group dependency during VHOST_SCSI_SET_ENDPOINT

commit ab8edab132829b26dd13db6caca3c242cce35dc1 upstream.

This patch addresses a bug where individual vhost-scsi configfs endpoint
groups can be removed from below while active exports to QEMU userspace
still exist, resulting in an OOPs.

It adds a configfs_depend_item() in vhost_scsi_set_endpoint() to obtain
an explicit dependency on se_tpg->tpg_group in order to prevent individual
vhost-scsi WWPN endpoints from being released via normal configfs methods
while an QEMU ioctl reference still exists.

Also, add matching configfs_undepend_item() in vhost_scsi_clear_endpoint()
to release the dependency, once QEMU's reference to the individual group
at /sys/kernel/config/target/vhost/$WWPN/$TPGT is released.

(Fix up vhost_scsi_clear_endpoint() error path - DanC)

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/vhost/scsi.c