aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfsd/export.c2
-rw-r--r--fs/nfsd/nfsctl.c4
-rw-r--r--include/linux/sunrpc/svcauth.h4
-rw-r--r--net/sunrpc/svcauth_unix.c18
4 files changed, 15 insertions, 13 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 067e2e612e2d..c0fcb7ab7f6d 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -1593,7 +1593,7 @@ exp_addclient(struct nfsctl_client *ncp)
1593 /* Insert client into hashtable. */ 1593 /* Insert client into hashtable. */
1594 for (i = 0; i < ncp->cl_naddr; i++) { 1594 for (i = 0; i < ncp->cl_naddr; i++) {
1595 ipv6_addr_set_v4mapped(ncp->cl_addrlist[i].s_addr, &addr6); 1595 ipv6_addr_set_v4mapped(ncp->cl_addrlist[i].s_addr, &addr6);
1596 auth_unix_add_addr(&addr6, dom); 1596 auth_unix_add_addr(&init_net, &addr6, dom);
1597 } 1597 }
1598 auth_unix_forget_old(dom); 1598 auth_unix_forget_old(dom);
1599 auth_domain_put(dom); 1599 auth_domain_put(dom);
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 7b2fa1d25af7..b6e192d25633 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -416,7 +416,7 @@ static ssize_t write_getfs(struct file *file, char *buf, size_t size)
416 416
417 ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6); 417 ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6);
418 418
419 clp = auth_unix_lookup(&in6); 419 clp = auth_unix_lookup(&init_net, &in6);
420 if (!clp) 420 if (!clp)
421 err = -EPERM; 421 err = -EPERM;
422 else { 422 else {
@@ -479,7 +479,7 @@ static ssize_t write_getfd(struct file *file, char *buf, size_t size)
479 479
480 ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6); 480 ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6);
481 481
482 clp = auth_unix_lookup(&in6); 482 clp = auth_unix_lookup(&init_net, &in6);
483 if (!clp) 483 if (!clp)
484 err = -EPERM; 484 err = -EPERM;
485 else { 485 else {
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index 18bce95255a4..25d333c1b571 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -126,10 +126,10 @@ extern void svc_auth_unregister(rpc_authflavor_t flavor);
126 126
127extern struct auth_domain *unix_domain_find(char *name); 127extern struct auth_domain *unix_domain_find(char *name);
128extern void auth_domain_put(struct auth_domain *item); 128extern void auth_domain_put(struct auth_domain *item);
129extern int auth_unix_add_addr(struct in6_addr *addr, struct auth_domain *dom); 129extern int auth_unix_add_addr(struct net *net, struct in6_addr *addr, struct auth_domain *dom);
130extern struct auth_domain *auth_domain_lookup(char *name, struct auth_domain *new); 130extern struct auth_domain *auth_domain_lookup(char *name, struct auth_domain *new);
131extern struct auth_domain *auth_domain_find(char *name); 131extern struct auth_domain *auth_domain_find(char *name);
132extern struct auth_domain *auth_unix_lookup(struct in6_addr *addr); 132extern struct auth_domain *auth_unix_lookup(struct net *net, struct in6_addr *addr);
133extern int auth_unix_forget_old(struct auth_domain *dom); 133extern int auth_unix_forget_old(struct auth_domain *dom);
134extern void svcauth_unix_purge(void); 134extern void svcauth_unix_purge(void);
135extern void svcauth_unix_info_release(struct svc_xprt *xpt); 135extern void svcauth_unix_info_release(struct svc_xprt *xpt);
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index f4751805ecfe..2a76c7cf603e 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -327,7 +327,8 @@ static struct ip_map *__ip_map_lookup(struct cache_detail *cd, char *class,
327 return NULL; 327 return NULL;
328} 328}
329 329
330static inline struct ip_map *ip_map_lookup(char *class, struct in6_addr *addr) 330static inline struct ip_map *ip_map_lookup(struct net *net, char *class,
331 struct in6_addr *addr)
331{ 332{
332 return __ip_map_lookup(&ip_map_cache, class, addr); 333 return __ip_map_lookup(&ip_map_cache, class, addr);
333} 334}
@@ -360,12 +361,13 @@ static int __ip_map_update(struct cache_detail *cd, struct ip_map *ipm,
360 return 0; 361 return 0;
361} 362}
362 363
363static inline int ip_map_update(struct ip_map *ipm, struct unix_domain *udom, time_t expiry) 364static inline int ip_map_update(struct net *net, struct ip_map *ipm,
365 struct unix_domain *udom, time_t expiry)
364{ 366{
365 return __ip_map_update(&ip_map_cache, ipm, udom, expiry); 367 return __ip_map_update(&ip_map_cache, ipm, udom, expiry);
366} 368}
367 369
368int auth_unix_add_addr(struct in6_addr *addr, struct auth_domain *dom) 370int auth_unix_add_addr(struct net *net, struct in6_addr *addr, struct auth_domain *dom)
369{ 371{
370 struct unix_domain *udom; 372 struct unix_domain *udom;
371 struct ip_map *ipmp; 373 struct ip_map *ipmp;
@@ -373,10 +375,10 @@ int auth_unix_add_addr(struct in6_addr *addr, struct auth_domain *dom)
373 if (dom->flavour != &svcauth_unix) 375 if (dom->flavour != &svcauth_unix)
374 return -EINVAL; 376 return -EINVAL;
375 udom = container_of(dom, struct unix_domain, h); 377 udom = container_of(dom, struct unix_domain, h);
376 ipmp = ip_map_lookup("nfsd", addr); 378 ipmp = ip_map_lookup(net, "nfsd", addr);
377 379
378 if (ipmp) 380 if (ipmp)
379 return ip_map_update(ipmp, udom, NEVER); 381 return ip_map_update(net, ipmp, udom, NEVER);
380 else 382 else
381 return -ENOMEM; 383 return -ENOMEM;
382} 384}
@@ -394,12 +396,12 @@ int auth_unix_forget_old(struct auth_domain *dom)
394} 396}
395EXPORT_SYMBOL_GPL(auth_unix_forget_old); 397EXPORT_SYMBOL_GPL(auth_unix_forget_old);
396 398
397struct auth_domain *auth_unix_lookup(struct in6_addr *addr) 399struct auth_domain *auth_unix_lookup(struct net *net, struct in6_addr *addr)
398{ 400{
399 struct ip_map *ipm; 401 struct ip_map *ipm;
400 struct auth_domain *rv; 402 struct auth_domain *rv;
401 403
402 ipm = ip_map_lookup("nfsd", addr); 404 ipm = ip_map_lookup(net, "nfsd", addr);
403 405
404 if (!ipm) 406 if (!ipm)
405 return NULL; 407 return NULL;
@@ -725,7 +727,7 @@ svcauth_unix_set_client(struct svc_rqst *rqstp)
725 727
726 ipm = ip_map_cached_get(xprt); 728 ipm = ip_map_cached_get(xprt);
727 if (ipm == NULL) 729 if (ipm == NULL)
728 ipm = ip_map_lookup(rqstp->rq_server->sv_program->pg_class, 730 ipm = ip_map_lookup(&init_net, rqstp->rq_server->sv_program->pg_class,
729 &sin6->sin6_addr); 731 &sin6->sin6_addr);
730 732
731 if (ipm == NULL) 733 if (ipm == NULL)