Commit 80d188a643b0f550a2aaedf7bf4dd1abd86cfc45

Authored by NeilBrown
Committed by Linus Torvalds
1 parent 0ba7536d5d

[PATCH] knfsd: make sure svc_process call the correct pg_authenticate for multi-service port

If an RPC socket is serving multiple programs, then the pg_authenticate of
the first program in the list is called, instead of pg_authenticate for the
program to be run.

This does not cause a problem with any programs in the current kernel, but
could confuse future code.

Also set pg_authenticate for nfsd_acl_program incase it ever gets used.

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 2 changed files with 8 additions and 5 deletions Side-by-side Diff

... ... @@ -427,6 +427,7 @@
427 427 .pg_name = "nfsd",
428 428 .pg_class = "nfsd",
429 429 .pg_stats = &nfsd_acl_svcstats,
  430 + .pg_authenticate = &svc_set_client,
430 431 };
431 432  
432 433 static struct svc_stat nfsd_acl_svcstats = {
... ... @@ -313,6 +313,11 @@
313 313 rqstp->rq_proc = proc = ntohl(svc_getu32(argv)); /* procedure number */
314 314  
315 315 progp = serv->sv_program;
  316 +
  317 + for (progp = serv->sv_program; progp; progp = progp->pg_next)
  318 + if (prog == progp->pg_prog)
  319 + break;
  320 +
316 321 /*
317 322 * Decode auth data, and add verifier to reply buffer.
318 323 * We do this before anything else in order to get a decent
... ... @@ -320,7 +325,7 @@
320 325 */
321 326 auth_res = svc_authenticate(rqstp, &auth_stat);
322 327 /* Also give the program a chance to reject this call: */
323   - if (auth_res == SVC_OK) {
  328 + if (auth_res == SVC_OK && progp) {
324 329 auth_stat = rpc_autherr_badcred;
325 330 auth_res = progp->pg_authenticate(rqstp);
326 331 }
... ... @@ -340,10 +345,7 @@
340 345 case SVC_COMPLETE:
341 346 goto sendit;
342 347 }
343   -
344   - for (progp = serv->sv_program; progp; progp = progp->pg_next)
345   - if (prog == progp->pg_prog)
346   - break;
  348 +
347 349 if (progp == NULL)
348 350 goto err_bad_prog;
349 351