All of lore.kernel.org
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Zhang Zhen <zhenzhang.zhang@huawei.com>
Cc: Christoph Hellwig <hch@infradead.org>, linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: avoid unneeded lookup when xattr name is invalid
Date: Mon, 12 May 2014 10:00:44 -0400	[thread overview]
Message-ID: <20140512140044.GC31376@thunk.org> (raw)
In-Reply-To: <5347967B.5090401@huawei.com>

On Fri, Apr 11, 2014 at 03:15:07PM +0800, Zhang Zhen wrote:
> In ext4_xattr_set_handle() we have checked the xattr name's length. So we should
> also check it in ext4_xattr_get() to avoid unneeded lookup caused by invalid name.
> 
> Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>

Applied, although I dropped this bit:

> In addition, we deleted the check of NULL in ext4_xattr_set_handle(), because in all
> the callers of the ext4_xattr_set_handle(), the name can't be NULL.

Verifying this is non-trivial, since there are many non-local
users of this function, and in order to make sure this is true you
need to verify (at least) the callers of the callers.  I could be
convinced to turn this into a BUG_ON(!name), or "if
(unlikely(!name))", but leaving the check in is a good idea, since
even if it is true today, it's not necessarily guarantted to be true N
years in the future.

					- Ted

      reply	other threads:[~2014-05-12 14:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1397199813-71623-1-git-send-email-zhenzhang.zhang@huawei.com>
2014-04-11  7:15 ` [PATCH] ext4: avoid unneeded lookup when xattr name is invalid Zhang Zhen
2014-05-12 14:00   ` Theodore Ts'o [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=20140512140044.GC31376@thunk.org \
    --to=tytso@mit.edu \
    --cc=hch@infradead.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=zhenzhang.zhang@huawei.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.