]> git.baikalelectronics.ru Git - kernel.git/commit
[SCSI] virtio_scsi: fix TMF use-after-free
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 4 May 2012 10:32:04 +0000 (12:32 +0200)
committerJames Bottomley <JBottomley@Parallels.com>
Thu, 10 May 2012 07:27:06 +0000 (08:27 +0100)
commite3daf35bd5505b5663dd6611ba1197bbd9fa9f4b
treef4e8d81b2b30cb8ab53207382c2841983954b833
parent22b9f5276aea94201960b27d79db007469c4340e
[SCSI] virtio_scsi: fix TMF use-after-free

Fix a use-after-free in the TMF path, where cmd may have been already
freed by virtscsi_complete_free when wait_for_completion restarts
executing virtscsi_tmf.  Technically a race, but in practice the command
will always be freed long before the completion waiter is awoken.

The fix is to make callers specifying a completion responsible for
freeing the command in all cases.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/virtio_scsi.c