Skip to contentSkip to conversation

fs/nfs: Fix nfs_parse_devname to not modify it's argument

PATCH In review Eric W. Biederman 2 participants 2 messages Jan 30, 2019 – Feb 21, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/nfs: Fix nfs_parse_devname to not modify it's argument

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")
---
 fs/nfs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/super.c +1 -1
index 22ce3c8a2f46..35af005af748 100644
@@ -1914,7 +1914,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)
Signature · 1 line
2.17.1
#1 lore raw
Quoted 8 lines · Eric W. Biederman

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")

Thanks Eric! Applied to my linux-next branch for inclusion in the 5.1 merge window.

Signature · 3 lines
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected]