linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] SUNRPC: Initialize source address if passed-in srcaddr is AF_UNSPEC
@ 2010-11-01 19:58 Chuck Lever
       [not found] ` <20101101195631.9279.16018.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Chuck Lever @ 2010-11-01 19:58 UTC (permalink / raw)
  To: nbowler; +Cc: linux-kernel, linux-nfs

Recently xs_bind() was changed so it can't tolerate an AF_UNSPEC
bind address; it needs a fully initialized ANYADDR.  We recently fixed
this case in xprtsock.c, but some upper layer protocols seem to assume
that it's OK to pass in an AF_UNSPEC address for the source address.
Catch that case too.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

Untested.

 net/sunrpc/xprtsock.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index dfcab5a..fd6484b 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -2181,7 +2181,7 @@ static struct rpc_xprt *xs_setup_xprt(struct xprt_create *args,
 	new = container_of(xprt, struct sock_xprt, xprt);
 	memcpy(&xprt->addr, args->dstaddr, args->addrlen);
 	xprt->addrlen = args->addrlen;
-	if (args->srcaddr)
+	if (args->srcaddr && args->srcaddr->sa_family != AF_UNSPEC)
 		memcpy(&new->srcaddr, args->srcaddr, args->addrlen);
 	else {
 		int err;


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

* Re: [PATCH] SUNRPC: Initialize source address if passed-in srcaddr is AF_UNSPEC
       [not found] ` <20101101195631.9279.16018.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
@ 2010-11-01 20:08   ` Nick Bowler
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Bowler @ 2010-11-01 20:08 UTC (permalink / raw)
  To: Chuck Lever; +Cc: linux-kernel, linux-nfs

On 2010-11-01 15:58 -0400, Chuck Lever wrote:
> Recently xs_bind() was changed so it can't tolerate an AF_UNSPEC
> bind address; it needs a fully initialized ANYADDR.  We recently fixed
> this case in xprtsock.c, but some upper layer protocols seem to assume
> that it's OK to pass in an AF_UNSPEC address for the source address.
> Catch that case too.
> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
> 
> Untested.

This one seems to correct the issue.

Tested-by: Nick Bowler <nbowler@elliptictech.com>

-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)

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

end of thread, other threads:[~2010-11-01 20:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-01 19:58 [PATCH] SUNRPC: Initialize source address if passed-in srcaddr is AF_UNSPEC Chuck Lever
     [not found] ` <20101101195631.9279.16018.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2010-11-01 20:08   ` Nick Bowler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).