• Jens Axboe's avatar
    [PATCH] bio_copy_user() cleanups and fixes · 1737ddec
    Jens Axboe authored
    blk_rq_map_user() is a bit of a hack currently, since it drops back to
    kmalloc() if bio_map_user() fails.  This is unfortunate since it means we
    do no real segment or size checking (and the request segment counts contain
    crap, already found one bug in a scsi lld).  It's also pretty nasty for >
    PAGE_SIZE requests, as we attempt to do higher order page allocations.
    Even worse still, ide-cd will drop back to PIO for non-sg/bio requests. 
    All in all, very suboptimal.
    
    This patch adds bio_copy_user() which simply sets up a bio with kernel
    pages and copies data as needed for reads and writes.  It also changes
    bio_map_user() to return an error pointer like bio_copy_user(), so we can
    return something sane to the user instead of always -ENOMEM.
    Signed-off-by: default avatarJens Axboe <axboe@suse.de>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    1737ddec
ide-cd.c 101 KB