Skip to content

Commit beca774

Browse files
committed
9p: fix fid refcount leak in v9fs_vfs_atomic_open_dotl
We need to release directory fid if we fail halfway through open This fixes fid leaking with xfstests generic 531 Link: https://lkml.kernel.org/r/20220612085330.1451496-2-asmadeus@codewreck.org Fixes: 6636b6d ("9p: add refcount to p9_fid struct") Cc: stable@vger.kernel.org Reported-by: Tyler Hicks <tyhicks@linux.microsoft.com> Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com> Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com> Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
1 parent b13bacc commit beca774

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

fs/9p/vfs_inode_dotl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
274274
if (IS_ERR(ofid)) {
275275
err = PTR_ERR(ofid);
276276
p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
277+
p9_client_clunk(dfid);
277278
goto out;
278279
}
279280

@@ -285,13 +286,15 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
285286
if (err) {
286287
p9_debug(P9_DEBUG_VFS, "Failed to get acl values in creat %d\n",
287288
err);
289+
p9_client_clunk(dfid);
288290
goto error;
289291
}
290292
err = p9_client_create_dotl(ofid, name, v9fs_open_to_dotl_flags(flags),
291293
mode, gid, &qid);
292294
if (err < 0) {
293295
p9_debug(P9_DEBUG_VFS, "p9_client_open_dotl failed in creat %d\n",
294296
err);
297+
p9_client_clunk(dfid);
295298
goto error;
296299
}
297300
v9fs_invalidate_inode_attr(dir);

0 commit comments

Comments
 (0)