From: "Eric W. Biederman" <[email protected]>

When reading kuids from the wire map them into the initial user
namespace, and validate the mapping succeded.

When reading kgids from the wire map them into the initial user
namespace, and validate the mapping succeded.

Cc: "J. Bruce Fields" <[email protected]>
Cc: Trond Myklebust <[email protected]>
Signed-off-by: "Eric W. Biederman" <[email protected]>
---
 net/sunrpc/svcauth_unix.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index bdea0a1..a1852e1 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -821,8 +821,10 @@ svcauth_unix_accept(struct svc_rqst *rqstp, __be32 *authp)
        argv->iov_base = (void*)((__be32*)argv->iov_base + slen);       /* skip 
machname */
        argv->iov_len -= slen*4;
 
-       cred->cr_uid = svc_getnl(argv);         /* uid */
-       cred->cr_gid = svc_getnl(argv);         /* gid */
+       cred->cr_uid = make_kuid(&init_user_ns, svc_getnl(argv)); /* uid */
+       cred->cr_gid = make_kgid(&init_user_ns, svc_getnl(argv)); /* gid */
+       if (!uid_valid(cred->cr_uid) || !gid_valid(cred->cr_gid))
+               goto badcred;
        slen = svc_getnl(argv);                 /* gids length */
        if (slen > 16 || (len -= (slen + 2)*4) < 0)
                goto badcred;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to