Home Home > GIT Browse
diff options
authorDavid Howells <dhowells@redhat.com>2019-03-25 16:38:22 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-09-21 07:18:51 +0200
commit12434939ba58717e0259ffe7375f9aa7a5f1c0b8 (patch)
parentd4911cc1f4b663f5a19707610aa7623d9f94c78a (diff)
vfs: Fix refcounting of filenames in fs_parser
commit 7cdfa44227b0d8842d46a775cebe4311150cb8f2 upstream. 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, fs_lookup_param(). Addresses-Coverity-ID: 1443811 ("Use after free") Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/fs_parser.c b/fs/fs_parser.c
index 0d388faa25d1..460ea4206fa2 100644
--- a/fs/fs_parser.c
+++ b/fs/fs_parser.c
@@ -264,6 +264,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);