diff options
author | Xiyu Yang <[email protected]> | 2020-05-25 22:15:41 +0800 |
---|---|---|
committer | J. Bruce Fields <[email protected]> | 2020-05-28 18:15:00 -0400 |
commit | a4abc6b12eb1f7a533c2e7484cfa555454ff0977 (patch) | |
tree | 42dba531e3f504011b4e57b4e23cbf20c7a7a24c | |
parent | 24c5efe41c29ee3e55bcf5a1c9f61ca8709622e8 (diff) |
nfsd: Fix svc_xprt refcnt leak when setup callback client failed
nfsd4_process_cb_update() invokes svc_xprt_get(), which increases the
refcount of the "c->cn_xprt".
The reference counting issue happens in one exception handling path of
nfsd4_process_cb_update(). When setup callback client failed, the
function forgets to decrease the refcnt increased by svc_xprt_get(),
causing a refcnt leak.
Fix this issue by calling svc_xprt_put() when setup callback client
failed.
Signed-off-by: Xiyu Yang <[email protected]>
Signed-off-by: Xin Tan <[email protected]>
Signed-off-by: J. Bruce Fields <[email protected]>
-rw-r--r-- | fs/nfsd/nfs4callback.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 966ca75418c8..7fbe9840a03e 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c @@ -1306,6 +1306,8 @@ static void nfsd4_process_cb_update(struct nfsd4_callback *cb) err = setup_callback_client(clp, &conn, ses); if (err) { nfsd4_mark_cb_down(clp, err); + if (c) + svc_xprt_put(c->cn_xprt); return; } } |