diff --git a/fs/namei.c b/fs/namei.c index 890d3580bf0e..d20f061cddd3 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3197,7 +3197,7 @@ static struct file *path_openat(int dfd, struct filename *pathname, if (unlikely(file->f_flags & __O_TMPFILE)) { error = do_tmpfile(dfd, pathname, nd, flags, op, file, &opened); - goto out; + goto out2; } error = path_init(dfd, pathname->name, flags | LOOKUP_PARENT, nd, &base); @@ -3235,6 +3235,7 @@ static struct file *path_openat(int dfd, struct filename *pathname, path_put(&nd->root); if (base) fput(base); +out2: if (!(opened & FILE_OPENED)) { BUG_ON(!error); put_filp(file);