diff --git a/block/blk-map.c b/block/blk-map.c index 4849fa36161eb697b47b08efa27af085b58bed3c..0f4b4b88181178b0344127df63af79f7d95da915 100644 --- a/block/blk-map.c +++ b/block/blk-map.c @@ -217,6 +217,12 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq, return PTR_ERR(bio); if (bio->bi_size != len) { + /* + * Grab an extra reference to this bio, as bio_unmap_user() + * expects to be able to drop it twice as it happens on the + * normal IO completion path + */ + bio_get(bio); bio_endio(bio, 0); bio_unmap_user(bio); return -EINVAL;