diff options
author | David Howells <dhowells@redhat.com> | 2019-03-25 16:38:22 +0000 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2019-05-25 18:00:02 -0400 |
commit | 7cdfa44227b0d8842d46a775cebe4311150cb8f2 (patch) | |
tree | a6e3cfd0e07a2a7e355fe80a2ec0719f38b71852 /fs/fs_parser.c | |
parent | c3aabf0780a506225b53bfe2b5177dd5dfec093d (diff) | |
download | linux-7cdfa44227b0d8842d46a775cebe4311150cb8f2.tar.gz |
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@redhat.com>
Diffstat (limited to 'fs/fs_parser.c')
-rw-r--r-- | fs/fs_parser.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/fs_parser.c b/fs/fs_parser.c index 570d71043acf..3a1697c2f72f 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); |