Commit fc601477 authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust
Browse files

NFS: Address memory leaks in the NFS client mount option parser

David Howells noticed that repeating the same mount option twice during an
NFS mount request can result in orphaned memory in certain cases.

Only the client_address and mount_server.hostname strings are initialized
in the mount parsing loop, so those appear to be the only two pointers that
might be written over by repeating a mount option.  The strings in the
nfs_server section of the nfs_parsed_mount_data structure are set only once
after the options are parsed, thus these are not susceptible to being
Signed-off-by: default avatarChuck Lever <>
Signed-off-by: default avatarTrond Myklebust <>
parent 3d1c5508
......@@ -1006,12 +1006,14 @@ static int nfs_parse_mount_options(char *raw,
string = match_strdup(args);
if (string == NULL)
goto out_nomem;
mnt->client_address = string;
case Opt_mounthost:
string = match_strdup(args);
if (string == NULL)
goto out_nomem;
mnt->mount_server.hostname = string;
case Opt_mountaddr:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment