st: fix race in st_scsi_execute_end
commitd4da9e6f97a19945901c923e3f8123d40d3524da
authorPetr Uzel <petr.uzel@suse.cz>
Fri, 21 Oct 2011 11:31:09 +0000 (21 13:31 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sat, 26 Nov 2011 17:10:32 +0000 (26 09:10 -0800)
tree4c329239099ce2345f524cb54cf013b30bfbac87
parent350f6cb41bfba103222b6de79deb642f4efd2a33
st: fix race in st_scsi_execute_end

commit c68bf8eeaa57c852e74adcf597237be149eef830 upstream.

The call to complete() in st_scsi_execute_end() wakes up sleeping thread
in write_behind_check(), which frees the st_request, thus invalidating
the pointer to the associated bio structure, which is then passed to the
blk_rq_unmap_user(). Fix by storing pointer to bio structure into
temporary local variable.

This bug is present since at least linux-2.6.32.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Reported-by: Juergen Groß <juergen.gross@ts.fujitsu.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Acked-by: Kai Mäkisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/scsi/st.c