[PATCH] fs: nfs: Error if a port is unregistered

Sascha Hauer sha at pengutronix.de
Wed Feb 1 23:39:48 PST 2023


On Thu, Feb 02, 2023 at 09:34:04AM +1100, John Watts wrote:
> 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 at 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;
> +

When this happens do we see a meaningful error message on the barebox
side? From a feeling I would say -ECONNREFUSED might be a better error
code, but I don't know if that's suitable for UDP connections.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list