/* determine the security context within which we access the cache from within the kernel  */
int cachefiles_get_security_ID(struct cachefiles_cache *cache)
/* determine the security context within which we access the cache from within the kernel  */
int cachefiles_get_security_ID(struct cachefiles_cache *cache)
{
	struct cred *new;
	int ret;
	_enter("{%s}", cache->secctx);
	new = prepare_kernel_cred(current);
	if (!new) {
		ret = -ENOMEM;
		goto error;
	}
	if (cache->secctx) {
		ret = set_security_override_from_ctx(new, cache->secctx);
		if (ret < 0) {
			put_cred(new);
			printk(KERN_ERR "CacheFiles:"
			       " Security denies permission to nominate"
			       " security context: error %d\n",
			       ret);
			goto error;
		}
	}
	cache->cache_cred = new;
	ret = 0;
error:
	_leave(" = %d", ret);
	return ret;
}