mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] fs: nfs: Error if a port is unregistered
@ 2023-02-01 22:34 John Watts
  2023-02-02  7:39 ` Sascha Hauer
  2023-02-02 11:20 ` [PATCH v2] " John Watts
  0 siblings, 2 replies; 8+ messages in thread
From: John Watts @ 2023-02-01 22:34 UTC (permalink / raw)
  To: barebox; +Cc: John Watts

If a server doesn't provide a service the port lookup will return 0.
Check for this and return an appropriate error code.

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>
---
 fs/nfs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/nfs.c b/fs/nfs.c
index 446d0f7946..696630684e 100644
--- a/fs/nfs.c
+++ b/fs/nfs.c
@@ -571,6 +571,9 @@ static int rpc_lookup_req(struct nfs_priv *npriv, uint32_t prog, uint32_t ver)
 
 	nfs_free_packet(nfs_packet);
 
+	if (port == 0)
+		return -ENOENT;
+
 	return port;
 }
 
-- 
2.39.1




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-02-03  8:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-01 22:34 [PATCH] fs: nfs: Error if a port is unregistered John Watts
2023-02-02  7:39 ` Sascha Hauer
2023-02-02  9:33   ` Jookia
2023-02-02  9:45     ` Ahmad Fatoum
2023-02-02 10:31       ` John Watts
2023-02-02 10:54         ` Ahmad Fatoum
2023-02-02 11:20 ` [PATCH v2] " John Watts
2023-02-03  8:00   ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox