All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] SUNRPC: Initialize source address if passed-in srcaddr is AF_UNSPEC
@ 2010-11-01 19:58 Chuck Lever
  2010-11-01 20:08   ` Nick Bowler
  0 siblings, 1 reply; 3+ 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] 3+ messages in thread

* Re: [PATCH] SUNRPC: Initialize source address if passed-in srcaddr is AF_UNSPEC
@ 2010-11-01 20:08   ` Nick Bowler
  0 siblings, 0 replies; 3+ 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] 3+ messages in thread

* Re: [PATCH] SUNRPC: Initialize source address if passed-in srcaddr is AF_UNSPEC
@ 2010-11-01 20:08   ` Nick Bowler
  0 siblings, 0 replies; 3+ 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] 3+ messages in thread

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

Thread overview: 3+ 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
2010-11-01 20:08 ` Nick Bowler
2010-11-01 20:08   ` Nick Bowler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.