summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorj.nixdorf@avm.de <j.nixdorf@avm.de>2021-01-05 15:17:01 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-01-23 15:48:44 +0100
commite7ee3b992a46d04d024b3a5b5f230b847e9a3123 (patch)
treea6d973f9a06bd21f3ca5f22fe74a671e49330483 /net
parent4d4d46d0193425b0dd3c5794f86a12b236ff0bc9 (diff)
downloadlinux-e7ee3b992a46d04d024b3a5b5f230b847e9a3123.tar.gz
linux-e7ee3b992a46d04d024b3a5b5f230b847e9a3123.tar.bz2
linux-e7ee3b992a46d04d024b3a5b5f230b847e9a3123.zip
net: sunrpc: interpret the return value of kstrtou32 correctly
commit 86b53fbf08f48d353a86a06aef537e78e82ba721 upstream. A return value of 0 means success. This is documented in lib/kstrtox.c. This was found by trying to mount an NFS share from a link-local IPv6 address with the interface specified by its index: mount("[fe80::1%1]:/srv/nfs", "/mnt", "nfs", 0, "nolock,addr=fe80::1%1") Before this commit this failed with EINVAL and also caused the following message in dmesg: [...] NFS: bad IP address specified: addr=fe80::1%1 The syscall using the same address based on the interface name instead of its index succeeds. Credits for this patch go to my colleague Christian Speich, who traced the origin of this bug to this line of code. Signed-off-by: Johannes Nixdorf <j.nixdorf@avm.de> Fixes: 00cfaa943ec3 ("replace strict_strto calls") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/addr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/sunrpc/addr.c b/net/sunrpc/addr.c
index 8391c2785550..7404f02702a1 100644
--- a/net/sunrpc/addr.c
+++ b/net/sunrpc/addr.c
@@ -184,7 +184,7 @@ static int rpc_parse_scope_id(struct net *net, const char *buf,
scope_id = dev->ifindex;
dev_put(dev);
} else {
- if (kstrtou32(p, 10, &scope_id) == 0) {
+ if (kstrtou32(p, 10, &scope_id) != 0) {
kfree(p);
return 0;
}