archive mirror
 help / color / mirror / Atom feed
From: David Howells <>
Subject: [PATCH] vfs: Fix refcounting of filenames in fs_parser
Date: Mon, 18 Mar 2019 16:57:09 +0000	[thread overview]
Message-ID: <> (raw)

Fix an overput in which filename_lookup() unconditionally drops a ref to
the filename it was given, but this isn't taken account of in the caller,

Addresses-Coverity-ID: 1443811 ("Use after free")
Signed-off-by: David Howells <>

 fs/fs_parser.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/fs_parser.c b/fs/fs_parser.c
index 842e8f749db6..be86703ec371 100644
--- a/fs/fs_parser.c
+++ b/fs/fs_parser.c
@@ -268,6 +268,7 @@ int fs_lookup_param(struct fs_context *fc,
 		return invalf(fc, "%s: not usable as path", param->key);
+	f->refcnt++; /* filename_lookup() drops our ref. */
 	ret = filename_lookup(param->dirfd, f, flags, _path, NULL);
 	if (ret < 0) {
 		errorf(fc, "%s: Lookup failure for '%s'", param->key, f->name);

                 reply	other threads:[~2019-03-18 16:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).