[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111221154057.GI23916@ZenIV.linux.org.uk>
Date: Wed, 21 Dec 2011 15:40:57 +0000
From: Al Viro <viro@...IV.linux.org.uk>
To: Neil Horman <nhorman@...driver.com>
Cc: netdev@...r.kernel.org, Thomas Graf <tgraf@...radead.org>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH 3/4] net: use cgroup_attach method to migrate socket
priotiy and classid
On Wed, Dec 21, 2011 at 09:39:49AM -0500, Neil Horman wrote:
> +static void cgrp_attach(struct cgroup_subsys *ss, struct cgroup *cgrp,
> + struct cgroup *old_cgrp, struct task_struct *tsk)
> +{
> + int fd, err;
> + struct files_struct *files;
> + struct file *file;
> + struct socket *sock;
> + struct cgroup_netprio_state *old, *new;
> + pid_t task_pid;
> +
> + files = get_files_struct(tsk);
> + task_pid = task_pid_nr(tsk);
> +
> + old = cgrp_netprio_state(old_cgrp);
> + new = cgrp_netprio_state(cgrp);
> +
> + spin_lock(&files->file_lock);
> + for (fd=0; fd < files_fdtable(files)->max_fds; fd++) {
> + file = fcheck_files(files, fd);
> + if (!file)
> + continue;
> + sock = sock_from_file(file, &err);
> + if (!sock)
> + continue;
> + if (!sock->sk)
> + continue;
> + if (sock->sk->sk_cgrp_owner == task_pid)
> + sock->sk->sk_cgrp_prioidx = new->prioidx;
This looks bogus *and* racy; what about e.g. files currently in SCM_RIGHTS
datagrams?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists