public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Steve Dickson <steved@redhat.com>
To: Chen Hanxiao <chenhx.fnst@fujitsu.com>,
	libtirpc-devel@lists.sourceforge.net
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH] svc_fd_create: skip getsockname on a non-network socket
Date: Wed, 16 Oct 2024 10:53:01 -0400	[thread overview]
Message-ID: <3f266a7c-e8d5-4e3f-b679-af06cf8b3b11@redhat.com> (raw)
In-Reply-To: <20241014085525.2067-1-chenhx.fnst@fujitsu.com>



On 10/14/24 4:55 AM, Chen Hanxiao wrote:
> As svcfd_create(3) said, it can:
> Create a service on top of any open file descriptor.
> 
> But getsockname and getpeername in svc_fd_create assume that
> fd should be a connected socket.
> 
> This patch will leave xp_raddr and xp_laddr uninitialized
> if fd is not a connected socket.
> 
> Signed-off-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>
Committed... (tag: libtirpc-1-3-6-rc3)

steved.
> ---
>   src/svc_vc.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/src/svc_vc.c b/src/svc_vc.c
> index 3dc8a75..438cbc5 100644
> --- a/src/svc_vc.c
> +++ b/src/svc_vc.c
> @@ -59,6 +59,7 @@
>   #include <rpc/rpc.h>
>   
>   #include "rpc_com.h"
> +#include "debug.h"
>   
>   #include <getpeereid.h>
>   
> @@ -232,6 +233,12 @@ svc_fd_create(fd, sendsize, recvsize)
>   
>   	slen = sizeof (struct sockaddr_storage);
>   	if (getsockname(fd, (struct sockaddr *)(void *)&ss, &slen) < 0) {
> +		if (errno == ENOTSOCK) {
> +			if (libtirpc_debug_level > 3) {
> +				LIBTIRPC_DEBUG(4, ("svc_fd_create: ENOTSOCK, return directly"));
> +			}
> +			return ret;
> +		}
>   		warnx("svc_fd_create: could not retrieve local addr");
>   		goto freedata;
>   	}


      reply	other threads:[~2024-10-16 14:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-14  8:55 [PATCH] svc_fd_create: skip getsockname on a non-network socket Chen Hanxiao
2024-10-16 14:53 ` Steve Dickson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3f266a7c-e8d5-4e3f-b679-af06cf8b3b11@redhat.com \
    --to=steved@redhat.com \
    --cc=chenhx.fnst@fujitsu.com \
    --cc=libtirpc-devel@lists.sourceforge.net \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox