Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 340495
b: refs/heads/master
c: 6a328d8
h: refs/heads/master
i:
  340493: ebfbdc5
  340491: 1d0780a
  340487: 61486ad
  340479: 9548235
v: v3
  • Loading branch information
Daniel Wagner authored and David S. Miller committed Oct 26, 2012
1 parent 591adec commit 3c58288
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fd9a08a7b83074e34c13c6340f673f7a51f53489
refs/heads/master: 6a328d8c6f03501657ad580f6f98bf9a42583ff7
3 changes: 0 additions & 3 deletions trunk/drivers/net/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
#include <net/netns/generic.h>
#include <net/rtnetlink.h>
#include <net/sock.h>
#include <net/cls_cgroup.h>

#include <asm/uaccess.h>

Expand Down Expand Up @@ -587,8 +586,6 @@ static struct sk_buff *tun_alloc_skb(struct tun_struct *tun,
struct sk_buff *skb;
int err;

sock_update_classid(sk, current);

/* Under a page? Don't bother with paged skb. */
if (prepad + len < PAGE_SIZE || !linear)
linear = len;
Expand Down
24 changes: 24 additions & 0 deletions trunk/net/sched/cls_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/skbuff.h>
#include <linux/cgroup.h>
#include <linux/rcupdate.h>
#include <linux/fdtable.h>
#include <net/rtnetlink.h>
#include <net/pkt_cls.h>
#include <net/sock.h>
Expand Down Expand Up @@ -53,6 +54,28 @@ static void cgrp_destroy(struct cgroup *cgrp)
kfree(cgrp_cls_state(cgrp));
}

static int update_classid(const void *v, struct file *file, unsigned n)
{
int err;
struct socket *sock = sock_from_file(file, &err);
if (sock)
sock->sk->sk_classid = (u32)(unsigned long)v;
return 0;
}

static void cgrp_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)
{
struct task_struct *p;
void *v;

cgroup_taskset_for_each(p, cgrp, tset) {
task_lock(p);
v = (void *)(unsigned long)task_cls_classid(p);
iterate_fd(p->files, 0, update_classid, v);
task_unlock(p);
}
}

static u64 read_classid(struct cgroup *cgrp, struct cftype *cft)
{
return cgrp_cls_state(cgrp)->classid;
Expand All @@ -77,6 +100,7 @@ struct cgroup_subsys net_cls_subsys = {
.name = "net_cls",
.create = cgrp_create,
.destroy = cgrp_destroy,
.attach = cgrp_attach,
.subsys_id = net_cls_subsys_id,
.base_cftypes = ss_files,
.module = THIS_MODULE,
Expand Down
8 changes: 0 additions & 8 deletions trunk/net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,6 @@ static inline int __sock_sendmsg_nosec(struct kiocb *iocb, struct socket *sock,
{
struct sock_iocb *si = kiocb_to_siocb(iocb);

sock_update_classid(sock->sk, current);

si->sock = sock;
si->scm = NULL;
si->msg = msg;
Expand Down Expand Up @@ -784,8 +782,6 @@ static inline int __sock_recvmsg_nosec(struct kiocb *iocb, struct socket *sock,
{
struct sock_iocb *si = kiocb_to_siocb(iocb);

sock_update_classid(sock->sk, current);

si->sock = sock;
si->scm = NULL;
si->msg = msg;
Expand Down Expand Up @@ -896,8 +892,6 @@ static ssize_t sock_splice_read(struct file *file, loff_t *ppos,
if (unlikely(!sock->ops->splice_read))
return -EINVAL;

sock_update_classid(sock->sk, current);

return sock->ops->splice_read(sock, ppos, pipe, len, flags);
}

Expand Down Expand Up @@ -3437,8 +3431,6 @@ EXPORT_SYMBOL(kernel_setsockopt);
int kernel_sendpage(struct socket *sock, struct page *page, int offset,
size_t size, int flags)
{
sock_update_classid(sock->sk, current);

if (sock->ops->sendpage)
return sock->ops->sendpage(sock, page, offset, size, flags);

Expand Down

0 comments on commit 3c58288

Please sign in to comment.