diff options
| author | Petr Uzel <petr.uzel@suse.cz> | 2011-10-21 13:31:09 +0200 |
|---|---|---|
| committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-08-17 15:35:50 -0400 |
| commit | 97547b895b4485f7097ceefbbfd42806c8c03496 (patch) | |
| tree | 2e984184c3f649cfd7c8b3f66cc359fb2178b1de | |
| parent | d3f610aeedcdfda9967c612b52be2b2815f76156 (diff) | |
| download | linux-97547b895b4485f7097ceefbbfd42806c8c03496.tar.gz linux-97547b895b4485f7097ceefbbfd42806c8c03496.tar.bz2 linux-97547b895b4485f7097ceefbbfd42806c8c03496.zip | |
[SCSI] 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: Paul Gortmaker <paul.gortmaker@windriver.com>
| -rw-r--r-- | drivers/scsi/st.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 3ea1a713ef25..516ca15721ad 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -462,14 +462,16 @@ static void st_scsi_execute_end(struct request *req, int uptodate) { struct st_request *SRpnt = req->end_io_data; struct scsi_tape *STp = SRpnt->stp; + struct bio *tmp; STp->buffer->cmdstat.midlevel_result = SRpnt->result = req->errors; STp->buffer->cmdstat.residual = req->resid_len; + tmp = SRpnt->bio; if (SRpnt->waiting) complete(SRpnt->waiting); - blk_rq_unmap_user(SRpnt->bio); + blk_rq_unmap_user(tmp); __blk_put_request(req->q, req); } |
