From: Lachlan McIlroy <lachlan@sgi.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs-dev <xfs-dev@sgi.com>, xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH] Fix use-after-free with buffers
Date: Tue, 02 Sep 2008 16:02:47 +1000 [thread overview]
Message-ID: <48BCD707.206@sgi.com> (raw)
In-Reply-To: <20080820125033.GA29680@infradead.org>
Christoph Hellwig wrote:
> On Wed, Aug 20, 2008 at 03:21:48PM +1000, Lachlan McIlroy wrote:
>> XB_TRACE(bp, "rele", bp->b_relse);
>>
>> + ASSERT(atomic_read(&bp->b_hold) > 0);
>> +
>> if (unlikely(!hash)) {
>> ASSERT(!bp->b_relse);
>> if (atomic_dec_and_test(&bp->b_hold))
>> @@ -838,7 +840,6 @@ xfs_buf_rele(
>> return;
>> }
>>
>> - ASSERT(atomic_read(&bp->b_hold) > 0);
>
> Makes sense, but how is this related to the other bits of the
> patch? All but log and iozero buffers should always be hashed.
Okay, not specifically related. I'll split it out of this change.
>
>> @@ -732,6 +732,7 @@ xfs_buf_item_init(
>> bip->bli_item.li_ops = &xfs_buf_item_ops;
>> bip->bli_item.li_mountp = mp;
>> bip->bli_buf = bp;
>> + xfs_buf_hold(bp);
>
> These refcount changes look good to me.
>
>> +void
>> +xfs_buf_item_free(
>> + xfs_buf_log_item_t *bip)
>> +{
>> +#ifdef XFS_TRANS_DEBUG
>> + kmem_free(bip->bli_orig);
>> + bip->bli_orig = NULL;
>> + kmem_free(bip->bli_logged);
>> + bip->bli_logged = NULL;
>> +#endif /* XFS_TRANS_DEBUG */
>> +
>> +#ifdef XFS_BLI_TRACE
>> + ktrace_free(bip->bli_trace);
>> +#endif
>> + kmem_zone_free(xfs_buf_item_zone, bip);
>> +}
>
> Faktoring this out makes sense, although you might want to remove the
> zeroing of bip->bli_orig and bip->bli_logged while you're at it, so that
> slab poisoning can do it's work.
Okay, thanks, I'll post a V2.
prev parent reply other threads:[~2008-09-02 5:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-20 5:21 [PATCH] Fix use-after-free with buffers Lachlan McIlroy
2008-08-20 12:50 ` Christoph Hellwig
2008-09-02 6:02 ` Lachlan McIlroy [this message]
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=48BCD707.206@sgi.com \
--to=lachlan@sgi.com \
--cc=hch@infradead.org \
--cc=xfs-dev@sgi.com \
--cc=xfs@oss.sgi.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.