[lkml]   [2011]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[214/262] [SCSI] st: fix race in st_scsi_execute_end
    3.0-stable review patch.  If anyone has any objections, please let me know.


    From: Petr Uzel <>

    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 <>
    Reported-by: Juergen Groß <>
    Reviewed-by: Jan Kara <>
    Acked-by: Kai Mäkisara <>
    Signed-off-by: James Bottomley <>
    Signed-off-by: Greg Kroah-Hartman <>

    drivers/scsi/st.c | 4 +++-
    1 file changed, 3 insertions(+), 1 deletion(-)

    --- a/drivers/scsi/st.c
    +++ b/drivers/scsi/st.c
    @@ -462,14 +462,16 @@ static void st_scsi_execute_end(struct r
    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)

    - blk_rq_unmap_user(SRpnt->bio);
    + blk_rq_unmap_user(tmp);
    __blk_put_request(req->q, req);

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2011-11-10 05:55    [W:0.035 / U:15.184 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site