/* * Procfs support for lockd * * Copyright (c) 2014 Jeff Layton */ #include #include #include #include #include #include "netns.h" #include "procfs.h" /* * We only allow strings that start with 'Y', 'y', or '1'. */ static ssize_t nlm_end_grace_write(struct file *file, const char __user *buf, size_t size, loff_t *pos) { char *data; struct lockd_net *ln = net_generic(current->nsproxy->net_ns, lockd_net_id); if (size < 1) return -EINVAL; data = simple_transaction_get(file, buf, size); if (IS_ERR(data)) return PTR_ERR(data); switch(data[0]) { case 'Y': case 'y': case '1': locks_end_grace(&ln->lockd_manager); break; default: return -EINVAL; } return size; } static ssize_t nlm_end_grace_read(struct file *file, char __user *buf, size_t size, loff_t *pos) { struct lockd_net *ln = net_generic(current->nsproxy->net_ns, lockd_net_id); char resp[3]; resp[0] = list_empty(&ln->lockd_manager.list) ? 'Y' : 'N'; resp[1] = '\n'; resp[2] = '\0'; return simple_read_from_buffer(buf, size, pos, resp, sizeof(resp)); } static const struct file_operations lockd_end_grace_operations = { .write = nlm_end_grace_write, .read = nlm_end_grace_read, .llseek = default_llseek, .release = simple_transaction_release, }; int __init lockd_create_procfs(void) { struct proc_dir_entry *entry; entry = proc_mkdir("fs/lockd", NULL); if (!entry) return -ENOMEM; entry = proc_create("nlm_end_grace", S_IRUGO|S_IWUSR, entry, &lockd_end_grace_operations); if (!entry) { remove_proc_entry("fs/lockd", NULL); return -ENOMEM; } return 0; } void __exit lockd_remove_procfs(void) { remove_proc_entry("fs/lockd/nlm_end_grace", NULL); remove_proc_entry("fs/lockd", NULL); } et/sctp/debug.c?h=nds-private-remove&id=b4cfe3971f6eab542dd7ecc398bfa1aeec889934'>treecommitdiff
class='left'>Author name='context' onchange='this.form.submit();'>
AgeCommit message (Expand)AuthorFilesLines
FilesLines
space:
mode:
authorTejun Heo <tj@kernel.org>2017-01-26 16:47:28 -0500
committerTejun Heo <tj@kernel.org>2017-01-26 16:47:28 -0500
commit07cd12945551b63ecb1a349d50a6d69d1d6feb4a (patch)
tree75f65eba7eac9277971082a2d5a4cf1370562c0c /include/acpi/actbl2.h
parent7ce7d89f48834cefece7804d38fc5d85382edf77 (diff)
cgroup: don't online subsystems before cgroup_name/path() are operational
While refactoring cgroup creation, a5bca2152036 ("cgroup: factor out cgroup_create() out of cgroup_mkdir()") incorrectly onlined subsystems before the new cgroup is associated with it kernfs_node. This is fine for cgroup proper but cgroup_name/path() depend on the associated kernfs_node and if a subsystem makes the new cgroup_subsys_state visible, which they're allowed to after onlining, it can lead to NULL dereference. The current code performs cgroup creation and subsystem onlining in cgroup_create() and cgroup_mkdir() makes the cgroup and subsystems visible afterwards. There's no reason to online the subsystems early and we can simply drop cgroup_apply_control_enable() call from cgroup_create() so that the subsystems are onlined and made visible at the same time. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru> Fixes: a5bca2152036 ("cgroup: factor out cgroup_create() out of cgroup_mkdir()") Cc: stable@vger.kernel.org # v4.6+
Diffstat (limited to 'include/acpi/actbl2.h')