]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
pNFS/NFSv4: Fix a layout segment leak in pnfs_layout_process()
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Thu, 21 Jan 2021 21:34:37 +0000 (16:34 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Feb 2021 22:23:26 +0000 (23:23 +0100)
[ Upstream commit 814b84971388cd5fb182f2e914265b3827758455 ]

If the server returns a new stateid that does not match the one in our
cache, then pnfs_layout_process() will leak the layout segments returned
by pnfs_mark_layout_stateid_invalid().

Fixes: 9888d837f3cf ("pNFS: Force a retry of LAYOUTGET if the stateid doesn't match our cache")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/pnfs.c

index 46ca5592b8b0ddf739655b070f75b36666c25fa5..4b165aa5a25615a2bb6c41717eabaa8b3d81b3af 100644 (file)
@@ -2320,6 +2320,7 @@ out_forget:
        spin_unlock(&ino->i_lock);
        lseg->pls_layout = lo;
        NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg);
+       pnfs_free_lseg_list(&free_me);
        return ERR_PTR(-EAGAIN);
 }