linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: nbowler@elliptictech.com
Cc: linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org
Subject: [PATCH] SUNRPC: Initialize source address if passed-in srcaddr is AF_UNSPEC
Date: Mon, 01 Nov 2010 15:58:21 -0400	[thread overview]
Message-ID: <20101101195631.9279.16018.stgit@matisse.1015granger.net> (raw)

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;


             reply	other threads:[~2010-11-01 19:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-01 19:58 Chuck Lever [this message]
     [not found] ` <20101101195631.9279.16018.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2010-11-01 20:08   ` [PATCH] SUNRPC: Initialize source address if passed-in srcaddr is AF_UNSPEC Nick Bowler

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=20101101195631.9279.16018.stgit@matisse.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=nbowler@elliptictech.com \
    /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;
as well as URLs for NNTP newsgroup(s).