fs/nfs: Fix nfs_parse_devname to not modify it's argument
authorEric W. Biederman <ebiederm@xmission.com>
Wed, 30 Jan 2019 13:58:38 +0000 (07:58 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Jan 2020 09:24:17 +0000 (10:24 +0100)
[ Upstream commit 40cc394be1aa18848b8757e03bd8ed23281f572e ]

In the rare and unsupported case of a hostname list nfs_parse_devname
will modify dev_name.  There is no need to modify dev_name as the all
that is being computed is the length of the hostname, so the computed
length can just be shorted.

Fixes: dc04589827f7 ("NFS: Use common device name parsing logic for NFSv4 and NFSv2/v3")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/super.c

index 42c31587a936c97b91ca87ae49fb750969ee3f47..4c21e572f2d9e67c82491a3d6d7ff9a0ee6f7854 100644 (file)
@@ -1928,7 +1928,7 @@ static int nfs_parse_devname(const char *dev_name,
                /* kill possible hostname list: not supported */
                comma = strchr(dev_name, ',');
                if (comma != NULL && comma < end)
-                       *comma = 0;
+                       len = comma - dev_name;
        }
 
        if (len > maxnamlen)