Skip to content

Commit

Permalink
virtio-blk: fix request leak.
Browse files Browse the repository at this point in the history
Must drop reference taken by blk_make_request().

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: stable@kernel.org # .35.x
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Mike Snitzer authored and Linus Torvalds committed Oct 9, 2010
1 parent 6b0cd00 commit e4c4776
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/block/virtio_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str)
struct virtio_blk *vblk = disk->private_data;
struct request *req;
struct bio *bio;
int err;

bio = bio_map_kern(vblk->disk->queue, id_str, VIRTIO_BLK_ID_BYTES,
GFP_KERNEL);
Expand All @@ -215,7 +216,10 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str)
}

req->cmd_type = REQ_TYPE_SPECIAL;
return blk_execute_rq(vblk->disk->queue, vblk->disk, req, false);
err = blk_execute_rq(vblk->disk->queue, vblk->disk, req, false);
blk_put_request(req);

return err;
}

static int virtblk_locked_ioctl(struct block_device *bdev, fmode_t mode,
Expand Down

0 comments on commit e4c4776

Please sign in to comment.