[<prev] [next>] [day] [month] [year] [list]
Message-ID: <155373005910.7602.15928901793963598025.stgit@warthog.procyon.org.uk>
Date: Wed, 27 Mar 2019 23:40:59 +0000
From: David Howells <dhowells@...hat.com>
To: viro@...iv.linux.org.uk
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
dhowells@...hat.com
Subject: [RFC PATCH 03/68] vfs: Fix refcounting of filenames in fs_parser
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@...hat.com>
---
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);
Powered by blists - more mailing lists