Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull security subsystem update from James Morris: "This is mostly maintenance updates across the subsystem, with a notable update for TPM 2.0, and addition of Jarkko Sakkinen as a maintainer of that" * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (40 commits) apparmor: clarify CRYPTO dependency selinux: Use a kmem_cache for allocation struct file_security_struct selinux: ioctl_has_perm should be static selinux: use sprintf return value selinux: use kstrdup() in security_get_bools() selinux: use kmemdup in security_sid_to_context_core() selinux: remove pointless cast in selinux_inode_setsecurity() selinux: introduce security_context_str_to_sid selinux: do not check open perm on ftruncate call selinux: change CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE default KEYS: Merge the type-specific data with the payload data KEYS: Provide a script to extract a module signature KEYS: Provide a script to extract the sys cert list from a vmlinux file keys: Be more consistent in selection of union members used certs: add .gitignore to stop git nagging about x509_certificate_list KEYS: use kvfree() in add_key Smack: limited capability for changing process label TPM: remove unnecessary little endian conversion vTPM: support little endian guests char: Drop owner assignment from i2c_driver ...
This commit is contained in:
@@ -352,3 +352,47 @@ void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name,
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sysfs_remove_link_from_group);
|
||||
|
||||
/**
|
||||
* __compat_only_sysfs_link_entry_to_kobj - add a symlink to a kobject pointing
|
||||
* to a group or an attribute
|
||||
* @kobj: The kobject containing the group.
|
||||
* @target_kobj: The target kobject.
|
||||
* @target_name: The name of the target group or attribute.
|
||||
*/
|
||||
int __compat_only_sysfs_link_entry_to_kobj(struct kobject *kobj,
|
||||
struct kobject *target_kobj,
|
||||
const char *target_name)
|
||||
{
|
||||
struct kernfs_node *target;
|
||||
struct kernfs_node *entry;
|
||||
struct kernfs_node *link;
|
||||
|
||||
/*
|
||||
* We don't own @target_kobj and it may be removed at any time.
|
||||
* Synchronize using sysfs_symlink_target_lock. See sysfs_remove_dir()
|
||||
* for details.
|
||||
*/
|
||||
spin_lock(&sysfs_symlink_target_lock);
|
||||
target = target_kobj->sd;
|
||||
if (target)
|
||||
kernfs_get(target);
|
||||
spin_unlock(&sysfs_symlink_target_lock);
|
||||
if (!target)
|
||||
return -ENOENT;
|
||||
|
||||
entry = kernfs_find_and_get(target_kobj->sd, target_name);
|
||||
if (!entry) {
|
||||
kernfs_put(target);
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
link = kernfs_create_link(kobj->sd, target_name, entry);
|
||||
if (IS_ERR(link) && PTR_ERR(link) == -EEXIST)
|
||||
sysfs_warn_dup(kobj->sd, target_name);
|
||||
|
||||
kernfs_put(entry);
|
||||
kernfs_put(target);
|
||||
return IS_ERR(link) ? PTR_ERR(link) : 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__compat_only_sysfs_link_entry_to_kobj);
|
||||
|
||||
Reference in New Issue
Block a user