• Jens Axboe's avatar
    [PATCH] bio clone memory corruption · cdae7207
    Jens Axboe authored
    Doing some raid testing threw a bug in the scsi mid layer, because the
    segment counts wasn't correct.  Initially I worried that we still had
    problems in this area, but it turns out that is due to the raid usage of
    bio clones.  Currently you have to hold on to the original bio as well,
    since the clone only maintains a pointer to the bio_vec inside the
    original bio.  If the original bio is freed first, the clone will have
    garbage in its bio->bi_io_vec as soon as that memory is scribbled.
    
    I think the best fix is to maintain flexibility and duplicate the io_vec
    inside the clone as well. Attached patch does this.
    Signed-off-by: default avatarJens Axboe <axboe@suse.de>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    cdae7207
bio.c 23.1 KB