[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [dm-devel] [PATCH] virtio-blk: put request that was created to retrieve the device id
- From: Ryan Harper <ryanh us ibm com>
- To: Christoph Hellwig <hch infradead org>
- Cc: kvm vger kernel org, Mike Snitzer <snitzer redhat com>, john cooper redhat com, rusty rustcorp com au, dm-devel redhat com, Ryan Harper <ryanh us ibm com>, Mikulas Patocka <mpatocka redhat com>, Tejun Heo <tj kernel org>, Vivek Goyal <vgoyal redhat com>
- Subject: Re: [dm-devel] [PATCH] virtio-blk: put request that was created to retrieve the device id
- Date: Fri, 17 Sep 2010 09:58:48 -0500
* Christoph Hellwig <hch infradead org> [2010-09-09 16:18]:
> On Thu, Sep 09, 2010 at 05:00:42PM -0400, Mike Snitzer wrote:
> > diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> > index 1260628..831e75c 100644
> > --- a/drivers/block/virtio_blk.c
> > +++ b/drivers/block/virtio_blk.c
> > @@ -199,6 +199,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);
> > @@ -212,7 +213,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);
>
> This looks correct as far as the request is concerned, but we're still
> leaking the bio.
Since __bio_map_kern() sets up bio->bi_end_io = bio_map_kern_endio
(which does a bio_put(bio)) doesn't that ensure we don't leak?
--
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
ryanh us ibm com
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]