Skip to content

Commit f0cd3fb

Browse files
mixi-workgregkh
authored andcommitted
net: sunrpc: interpret the return value of kstrtou32 correctly
commit 86b53fb 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: 00cfaa9 ("replace strict_strto calls") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a9bc9c9 commit f0cd3fb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎net/sunrpc/addr.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static int rpc_parse_scope_id(struct net *net, const char *buf,
185185
scope_id = dev->ifindex;
186186
dev_put(dev);
187187
} else {
188-
if (kstrtou32(p, 10, &scope_id) == 0) {
188+
if (kstrtou32(p, 10, &scope_id) != 0) {
189189
kfree(p);
190190
return 0;
191191
}

0 commit comments

Comments
 (0)