diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/core/netprio_cgroup.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c index ed0c0431fcd8..f65dba3afd99 100644 --- a/net/core/netprio_cgroup.c +++ b/net/core/netprio_cgroup.c | |||
@@ -277,12 +277,6 @@ out_free_devname: | |||
277 | void net_prio_attach(struct cgroup *cgrp, struct cgroup_taskset *tset) | 277 | void net_prio_attach(struct cgroup *cgrp, struct cgroup_taskset *tset) |
278 | { | 278 | { |
279 | struct task_struct *p; | 279 | struct task_struct *p; |
280 | char *tmp = kzalloc(sizeof(char) * PATH_MAX, GFP_KERNEL); | ||
281 | |||
282 | if (!tmp) { | ||
283 | pr_warn("Unable to attach cgrp due to alloc failure!\n"); | ||
284 | return; | ||
285 | } | ||
286 | 280 | ||
287 | cgroup_taskset_for_each(p, cgrp, tset) { | 281 | cgroup_taskset_for_each(p, cgrp, tset) { |
288 | unsigned int fd; | 282 | unsigned int fd; |
@@ -296,32 +290,24 @@ void net_prio_attach(struct cgroup *cgrp, struct cgroup_taskset *tset) | |||
296 | continue; | 290 | continue; |
297 | } | 291 | } |
298 | 292 | ||
299 | rcu_read_lock(); | 293 | spin_lock(&files->file_lock); |
300 | fdt = files_fdtable(files); | 294 | fdt = files_fdtable(files); |
301 | for (fd = 0; fd < fdt->max_fds; fd++) { | 295 | for (fd = 0; fd < fdt->max_fds; fd++) { |
302 | char *path; | ||
303 | struct file *file; | 296 | struct file *file; |
304 | struct socket *sock; | 297 | struct socket *sock; |
305 | unsigned long s; | 298 | int err; |
306 | int rv, err = 0; | ||
307 | 299 | ||
308 | file = fcheck_files(files, fd); | 300 | file = fcheck_files(files, fd); |
309 | if (!file) | 301 | if (!file) |
310 | continue; | 302 | continue; |
311 | 303 | ||
312 | path = d_path(&file->f_path, tmp, PAGE_SIZE); | ||
313 | rv = sscanf(path, "socket:[%lu]", &s); | ||
314 | if (rv <= 0) | ||
315 | continue; | ||
316 | |||
317 | sock = sock_from_file(file, &err); | 304 | sock = sock_from_file(file, &err); |
318 | if (!err) | 305 | if (sock) |
319 | sock_update_netprioidx(sock->sk, p); | 306 | sock_update_netprioidx(sock->sk, p); |
320 | } | 307 | } |
321 | rcu_read_unlock(); | 308 | spin_unlock(&files->file_lock); |
322 | task_unlock(p); | 309 | task_unlock(p); |
323 | } | 310 | } |
324 | kfree(tmp); | ||
325 | } | 311 | } |
326 | 312 | ||
327 | static struct cftype ss_files[] = { | 313 | static struct cftype ss_files[] = { |