Re: [PATCH] fs: System memory leak when running HTX with T10 DIF enabled
From: Christoph Hellwig
Date: Wed Jun 28 2017 - 14:31:51 EST
On Wed, Jun 28, 2017 at 01:10:31PM -0400, Keith Busch wrote:
> On Wed, Jun 28, 2017 at 11:32:51AM -0500, wenxiong@xxxxxxxxxxxxxxxxxx wrote:
> > diff --git a/fs/block_dev.c b/fs/block_dev.c
> > index 519599d..e871444 100644
> > --- a/fs/block_dev.c
> > +++ b/fs/block_dev.c
> > @@ -264,6 +264,10 @@ static void blkdev_bio_end_io_simple(struct bio *bio)
> >
> > if (unlikely(bio.bi_error))
> > return bio.bi_error;
> > +
> > + if (bio_integrity(&bio))
> > + bio_integrity_free(&bio);
> > +
> > return ret;
> > }
>
> We don't want to leak the integrity payload in case of bi_error either.
And we should just call __bio_free. Which btw every user of bio_init
probably needs.