* Input must be in format '<event_fd> <control_fd> <args>'.
* Interpretation of args is defined by control file implementation.
*/
-static int cgroup_write_event_control(struct cgroup_subsys_state *css,
+static int cgroup_write_event_control(struct cgroup_subsys_state *dummy_css,
struct cftype *cft, const char *buffer)
{
- struct cgroup *cgrp = css->cgroup;
+ struct cgroup *cgrp = dummy_css->cgroup;
struct cgroup_event *event;
struct cgroup *cgrp_cfile;
unsigned int efd, cfd;
event = kzalloc(sizeof(*event), GFP_KERNEL);
if (!event)
return -ENOMEM;
- event->css = css;
+
INIT_LIST_HEAD(&event->list);
init_poll_funcptr(&event->pt, cgroup_event_ptable_queue_proc);
init_waitqueue_func_entry(&event->wait, cgroup_event_wake);
goto out_put_cfile;
}
+ if (!event->cft->ss) {
+ ret = -EBADF;
+ goto out_put_cfile;
+ }
+
+ /* determine the css of @cfile and associate @event with it */
+ rcu_read_lock();
+
+ ret = -EINVAL;
+ event->css = cgroup_css(cgrp, event->cft->ss->subsys_id);
+ if (event->css)
+ ret = 0;
+
+ rcu_read_unlock();
+ if (ret)
+ goto out_put_cfile;
+
/*
* The file to be monitored must be in the same cgroup as
* cgroup.event_control is.
goto out_put_cfile;
}
- ret = event->cft->register_event(css, event->cft,
+ ret = event->cft->register_event(event->css, event->cft,
event->eventfd, buffer);
if (ret)
goto out_put_cfile;