public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Jan Kara <jack@suse.cz>
Cc: linux-xfs@vger.kernel.org, Christoph Hellwig <hch@infradead.org>,
	"Darrick J . Wong" <darrick.wong@oracle.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] xfs: Fix leak of discard bio
Date: Wed, 2 Aug 2017 21:33:49 +1000	[thread overview]
Message-ID: <20170802113349.GR17762@dastard> (raw)
In-Reply-To: <20170802083741.4600-1-jack@suse.cz>

On Wed, Aug 02, 2017 at 10:37:41AM +0200, Jan Kara wrote:
> The bio describing discard operation is allocated by
> __blkdev_issue_discard() which returns us a reference to it. That
> reference is never released and thus we leak this bio. Drop the bio
> reference once it completes in xlog_discard_endio().
> 
> CC: stable@vger.kernel.org
> Fixes: 4560e78f40cb55bd2ea8f1ef4001c5baa88531c7
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  fs/xfs/xfs_log_cil.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> Note, this is untested. It's just something I've noticed when looking at the
> code.
> 
> diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
> index fbe72b134bef..43aa42a3a5d3 100644
> --- a/fs/xfs/xfs_log_cil.c
> +++ b/fs/xfs/xfs_log_cil.c
> @@ -539,6 +539,7 @@ xlog_discard_endio(
>  
>  	INIT_WORK(&ctx->discard_endio_work, xlog_discard_endio_work);
>  	queue_work(xfs_discard_wq, &ctx->discard_endio_work);
> +	bio_put(bio);
>  }

At a quick glance, it does seem that we are leaking the bio here. It
appears to me that ext4_process_freed_data() also has the same
problem and leaks the discard_bio....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2017-08-02 11:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-02  8:37 [PATCH] xfs: Fix leak of discard bio Jan Kara
2017-08-02 11:33 ` Dave Chinner [this message]
2017-08-02 13:17   ` Jan Kara
2017-08-02 19:37 ` Darrick J. Wong
2017-08-05 13:56 ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170802113349.GR17762@dastard \
    --to=david@fromorbit.com \
    --cc=darrick.wong@oracle.com \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=linux-xfs@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox