summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJohn Watts <contact@jookia.org>2023-02-02 22:20:24 +1100
committerSascha Hauer <s.hauer@pengutronix.de>2023-02-03 09:00:39 +0100
commit505d7d503ecdd6b4715f26b684eaf6cff0361b90 (patch)
treedc2a2094b4d7501490c8e72305c0ea7b959a0edb /fs
parent39554e113f24aaa5dfa3e11023a08a17797036e4 (diff)
downloadbarebox-505d7d503ecdd6b4715f26b684eaf6cff0361b90.tar.gz
fs: nfs: Error if a port is unregistered
If a server doesn't provide a service the port lookup will return 0. Check for this, return an appropriate error code and give a hint as to why this might be happening. This was tested by running NFS with UDP disabled, which seems to be the default in Arch at least. Signed-off-by: John Watts <contact@jookia.org> Link: https://lore.barebox.org/20230202112024.2458085-1-contact@jookia.org Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/nfs.c b/fs/nfs.c
index 446d0f7946..1a0b28442d 100644
--- a/fs/nfs.c
+++ b/fs/nfs.c
@@ -571,6 +571,12 @@ static int rpc_lookup_req(struct nfs_priv *npriv, uint32_t prog, uint32_t ver)
nfs_free_packet(nfs_packet);
+ if (port == 0) {
+ pr_warn("No UDP port for RPC program %i! "
+ "Is your NFS server TCP only?\n", prog);
+ return -ENOENT;
+ }
+
return port;
}