]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
NFSv4.2: fix reference count leaks in _nfs42_proc_copy_notify()
authorXin Xiong <xiongx18@fudan.edu.cn>
Tue, 25 Jan 2022 13:10:45 +0000 (21:10 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 27 Apr 2022 09:59:24 +0000 (11:59 +0200)
commit976f2ae7bc6fb48484224246f168fbece31d3b9f
tree56057aa74e34344be25220ce288213ed496debbd
parent5caadfcf90d68255b606ab82f6aa9eafba4cab4e
NFSv4.2: fix reference count leaks in _nfs42_proc_copy_notify()

BugLink: https://bugs.launchpad.net/bugs/1969107
[ Upstream commit b7f114edd54326f730a754547e7cfb197b5bc132 ]

[You don't often get email from xiongx18@fudan.edu.cn. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]

The reference counting issue happens in two error paths in the
function _nfs42_proc_copy_notify(). In both error paths, the function
simply returns the error code and forgets to balance the refcount of
object `ctx`, bumped by get_nfs_open_context() earlier, which may
cause refcount leaks.

Fix it by balancing refcount of the `ctx` object before the function
returns in both error paths.

Signed-off-by: Xin Xiong <xiongx18@fudan.edu.cn>
Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit b37f482ba9f0e6382c188e3fccf6c4b2fdc938eb)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
fs/nfs/nfs42proc.c