Skip to content

Commit cb14e99

Browse files
dkobrasgregkh
authored andcommitted
sunrpc: fix refcount leak for rpc auth modules
commit f1442d6 upstream. If an auth module's accept op returns SVC_CLOSE, svc_process_common() enters a call path that does not call svc_authorise() before leaving the function, and thus leaks a reference on the auth module's refcount. Hence, make sure calls to svc_authenticate() and svc_authorise() are paired for all call paths, to make sure rpc auth modules can be unloaded. Signed-off-by: Daniel Kobras <kobras@puzzle-itc.de> Fixes: 4d712ef ("svcauth_gss: Close connection when dropping an incoming message") Link: https://lore.kernel.org/linux-nfs/3F1B347F-B809-478F-A1E9-0BE98E22B0F0@oracle.com/T/#t Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2ea2d3a commit cb14e99

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎net/sunrpc/svc.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
14081408

14091409
sendit:
14101410
if (svc_authorise(rqstp))
1411-
goto close;
1411+
goto close_xprt;
14121412
return 1; /* Caller can now send it */
14131413

14141414
release_dropit:
@@ -1420,6 +1420,8 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
14201420
return 0;
14211421

14221422
close:
1423+
svc_authorise(rqstp);
1424+
close_xprt:
14231425
if (rqstp->rq_xprt && test_bit(XPT_TEMP, &rqstp->rq_xprt->xpt_flags))
14241426
svc_close_xprt(rqstp->rq_xprt);
14251427
dprintk("svc: svc_process close\n");
@@ -1428,7 +1430,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
14281430
err_short_len:
14291431
svc_printk(rqstp, "short len %zd, dropping request\n",
14301432
argv->iov_len);
1431-
goto close;
1433+
goto close_xprt;
14321434

14331435
err_bad_rpc:
14341436
serv->sv_stats->rpcbadfmt++;

0 commit comments

Comments
 (0)