vfs: Distinguish between full xattr names and proper prefixes

Add an additional "name" field to struct xattr_handler.  When the name
is set, the handler matches attributes with exactly that name.  When the
prefix is set instead, the handler matches attributes with the given
prefix and with a non-empty suffix.

This patch should avoid bugs like the one fixed in commit c361016a in
the future.

Signed-off-by: Andreas Gruenbacher <[email protected]>
Reviewed-by: James Morris <[email protected]>
Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
Andreas Gruenbacher 2015-12-02 14:44:36 +01:00 • committed by Al Viro
commit 98e9cb5711
22 changed files with 47 additions and 130 deletions

View file

@ -228,9 +228,6 @@ static int squashfs_xattr_handler_get(const struct xattr_handler *handler,
struct dentry *d, const char *name,
void *buffer, size_t size)
{
if (name[0] == '\0')
return -EINVAL;
return squashfs_xattr_get(d_inode(d), handler->flags, name,
buffer, size);
}