diff options
author | James Morris <jmorris@namei.org> | 2008-12-04 01:16:36 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2008-12-04 01:16:36 -0500 |
commit | ec98ce480ada787f2cfbd696980ff3564415505b (patch) | |
tree | 1a4d644b38f9f1e4b4e086fde0b195df4a92cf84 /net/sunrpc | |
parent | 3496f92beb9aa99ef21fccc154a36c7698e9c538 (diff) | |
parent | feaf3848a813a106f163013af6fcf6c4bfec92d9 (diff) |
Merge branch 'master' into next
Conflicts:
fs/nfsd/nfs4recover.c
Manually fixed above to use new creds API functions, e.g.
nfs4_save_creds().
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/auth_generic.c | 20 | ||||
-rw-r--r-- | net/sunrpc/svcsock.c | 9 |
2 files changed, 25 insertions, 4 deletions
diff --git a/net/sunrpc/auth_generic.c b/net/sunrpc/auth_generic.c index 744b79fdcb19..4028502f0528 100644 --- a/net/sunrpc/auth_generic.c +++ b/net/sunrpc/auth_generic.c | |||
@@ -133,13 +133,29 @@ static int | |||
133 | generic_match(struct auth_cred *acred, struct rpc_cred *cred, int flags) | 133 | generic_match(struct auth_cred *acred, struct rpc_cred *cred, int flags) |
134 | { | 134 | { |
135 | struct generic_cred *gcred = container_of(cred, struct generic_cred, gc_base); | 135 | struct generic_cred *gcred = container_of(cred, struct generic_cred, gc_base); |
136 | int i; | ||
136 | 137 | ||
137 | if (gcred->acred.uid != acred->uid || | 138 | if (gcred->acred.uid != acred->uid || |
138 | gcred->acred.gid != acred->gid || | 139 | gcred->acred.gid != acred->gid || |
139 | gcred->acred.group_info != acred->group_info || | ||
140 | gcred->acred.machine_cred != acred->machine_cred) | 140 | gcred->acred.machine_cred != acred->machine_cred) |
141 | return 0; | 141 | goto out_nomatch; |
142 | |||
143 | /* Optimisation in the case where pointers are identical... */ | ||
144 | if (gcred->acred.group_info == acred->group_info) | ||
145 | goto out_match; | ||
146 | |||
147 | /* Slow path... */ | ||
148 | if (gcred->acred.group_info->ngroups != acred->group_info->ngroups) | ||
149 | goto out_nomatch; | ||
150 | for (i = 0; i < gcred->acred.group_info->ngroups; i++) { | ||
151 | if (GROUP_AT(gcred->acred.group_info, i) != | ||
152 | GROUP_AT(acred->group_info, i)) | ||
153 | goto out_nomatch; | ||
154 | } | ||
155 | out_match: | ||
142 | return 1; | 156 | return 1; |
157 | out_nomatch: | ||
158 | return 0; | ||
143 | } | 159 | } |
144 | 160 | ||
145 | void __init rpc_init_generic_auth(void) | 161 | void __init rpc_init_generic_auth(void) |
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 95293f549e9c..a1951dcc5776 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -1183,7 +1183,11 @@ int svc_addsock(struct svc_serv *serv, | |||
1183 | else if (so->state > SS_UNCONNECTED) | 1183 | else if (so->state > SS_UNCONNECTED) |
1184 | err = -EISCONN; | 1184 | err = -EISCONN; |
1185 | else { | 1185 | else { |
1186 | svsk = svc_setup_socket(serv, so, &err, SVC_SOCK_DEFAULTS); | 1186 | if (!try_module_get(THIS_MODULE)) |
1187 | err = -ENOENT; | ||
1188 | else | ||
1189 | svsk = svc_setup_socket(serv, so, &err, | ||
1190 | SVC_SOCK_DEFAULTS); | ||
1187 | if (svsk) { | 1191 | if (svsk) { |
1188 | struct sockaddr_storage addr; | 1192 | struct sockaddr_storage addr; |
1189 | struct sockaddr *sin = (struct sockaddr *)&addr; | 1193 | struct sockaddr *sin = (struct sockaddr *)&addr; |
@@ -1196,7 +1200,8 @@ int svc_addsock(struct svc_serv *serv, | |||
1196 | spin_unlock_bh(&serv->sv_lock); | 1200 | spin_unlock_bh(&serv->sv_lock); |
1197 | svc_xprt_received(&svsk->sk_xprt); | 1201 | svc_xprt_received(&svsk->sk_xprt); |
1198 | err = 0; | 1202 | err = 0; |
1199 | } | 1203 | } else |
1204 | module_put(THIS_MODULE); | ||
1200 | } | 1205 | } |
1201 | if (err) { | 1206 | if (err) { |
1202 | sockfd_put(so); | 1207 | sockfd_put(so); |