[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161109164854.GA27562@infradead.org>
Date: Wed, 9 Nov 2016 08:48:54 -0800
From: Christoph Hellwig <hch@...radead.org>
To: David Graziano <david.graziano@...kwellcollins.com>
Cc: golbi@....uni.torun.pl, michal.wronski@...il.com,
linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org, sds@...ho.nsa.gov,
seth.forshee@...onical.com, ebiederm@...ssion.com,
agruenba@...hat.com
Subject: Re: [PATCH 1/1 V2] mqueue: Implment generic xattr support
> +/*
> + * Callback for security_inode_init_security() for acquiring xattrs.
> + */
> +static int mqueue_initxattrs(struct inode *inode,
> + const struct xattr *xattr_array,
> + void *fs_info)
> +{
> + struct mqueue_inode_info *info = MQUEUE_I(inode);
> + const struct xattr *xattr;
> + struct simple_xattr *new_xattr;
> + size_t len;
> +
> + for (xattr = xattr_array; xattr->name != NULL; xattr++) {
> + new_xattr = simple_xattr_alloc(xattr->value, xattr->value_len);
> + if (!new_xattr)
> + return -ENOMEM;
> + len = strlen(xattr->name) + 1;
> + new_xattr->name = kmalloc(XATTR_SECURITY_PREFIX_LEN + len,
> + GFP_KERNEL);
> + if (!new_xattr->name) {
> + kfree(new_xattr);
> + return -ENOMEM;
> + }
> +
> + memcpy(new_xattr->name, XATTR_SECURITY_PREFIX,
> + XATTR_SECURITY_PREFIX_LEN);
> + memcpy(new_xattr->name + XATTR_SECURITY_PREFIX_LEN,
> + xattr->name, len);
> +
> + simple_xattr_list_add(&info->xattrs, new_xattr);
> + }
> +
> + return 0;
> +}
This is a 1:1 copy of the shmem code, we rally should consolidate it
into a single place first, as people will want it for whatever virtual
fs they care about sooner or later.
Powered by blists - more mailing lists