From: Trond Myklebust Date: Thu, 21 Jan 2021 21:34:37 +0000 (-0500) Subject: pNFS/NFSv4: Fix a layout segment leak in pnfs_layout_process() X-Git-Tag: rel_imx_5.10.35_2.0.0-somdevices.0~363^2~1963 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=dba0d4b1508bdd981dca1cc5611e172c527787ba;p=linux.git pNFS/NFSv4: Fix a layout segment leak in pnfs_layout_process() [ 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 Signed-off-by: Sasha Levin --- diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 471bfa273dad..426877f72441 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -2418,6 +2418,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); }