]> git.baikalelectronics.ru Git - kernel.git/commit
net: sunrpc: interpret the return value of kstrtou32 correctly
authorj.nixdorf@avm.de <j.nixdorf@avm.de>
Tue, 5 Jan 2021 14:17:01 +0000 (15:17 +0100)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Sun, 10 Jan 2021 18:32:51 +0000 (13:32 -0500)
commit2549836626feca46fb115242a8d3cb355baa1e9a
tree41b02ad37bf5a3496704ffe43cc7e33b8876a0bc
parent26ac5f4ccf4383ae804b7deb980f7f416e4f49bb
net: sunrpc: interpret the return value of kstrtou32 correctly

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: a59165309b08 ("replace strict_strto calls")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
net/sunrpc/addr.c