From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Wagner Subject: [PATCH v3 3/6] cgroup: Update classid for fd pass in SCM_RIGHTS datagramm Date: Tue, 14 Aug 2012 15:02:20 +0200 Message-ID: <1344949343-26090-5-git-send-email-wagi@monom.org> References: <1344949343-26090-1-git-send-email-wagi@monom.org> Cc: Daniel Wagner , "David S. Miller" , Al Viro , David Howells , Eric Dumazet , John Fastabend , Neil Horman , Tim Chen To: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Return-path: In-Reply-To: <1344949343-26090-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org> Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: netdev.vger.kernel.org From: Daniel Wagner A socket fd passed in a SCM_RIGHTS datagram was not getting updated with the new tasks cgrp classid. This leaves IO on the socket tagged with the old tasks classid. To fix this add a check in the scm recvmsg path to update the sock cgrp classid with the new tasks value. Signed-off-by: Daniel Wagner Cc: "David S. Miller" Cc: Al Viro Cc: David Howells Cc: Eric Dumazet Cc: John Fastabend Cc: Neil Horman Cc: Tim Chen Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org --- net/core/scm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/core/scm.c b/net/core/scm.c index 8f6ccfd..221080f 100644 --- a/net/core/scm.c +++ b/net/core/scm.c @@ -35,7 +35,7 @@ #include #include #include - +#include /* * Only allow a user to send credentials, that they could set with @@ -249,6 +249,7 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm) struct file **fp = scm->fp->fp; int __user *cmfptr; int err = 0, i; + __u32 classid = task_cls_classid(current); if (MSG_CMSG_COMPAT & msg->msg_flags) { scm_detach_fds_compat(msg, scm); @@ -265,6 +266,7 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm) for (i=0, cmfptr=(__force int __user *)CMSG_DATA(cm); isk->sk_classid = classid; } if (i > 0) -- 1.7.12.rc1.16.g05a20c8