netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] RDS: Invoke ->laddr_check() in rds_bind() for explicitly bound transports.
@ 2015-10-11 20:46 Sowmini Varadhan
  2015-10-12  2:29 ` santosh.shilimkar
  2015-10-13 11:23 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Sowmini Varadhan @ 2015-10-11 20:46 UTC (permalink / raw)
  To: sowmini.varadhan, netdev, linux-kernel
  Cc: davem, rds-devel, ajaykumar.hotchandani, igor.maximov,
	santosh.shilimkar


The IP address passed to rds_bind() should be vetted by the
transport's ->laddr_check() for a previously bound transport.
This needs to be done to avoid cases where, for example,
the application has asked for an IB transport,
but the IP address passed to bind is only usable on
ethernet interfaces.

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
---
 net/rds/bind.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/net/rds/bind.c b/net/rds/bind.c
index bc6b93e..6192566 100644
--- a/net/rds/bind.c
+++ b/net/rds/bind.c
@@ -196,7 +196,14 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 		goto out;
 
 	if (rs->rs_transport) { /* previously bound */
-		ret = 0;
+		trans = rs->rs_transport;
+		if (trans->laddr_check(sock_net(sock->sk),
+				       sin->sin_addr.s_addr) != 0) {
+			ret = -ENOPROTOOPT;
+			rds_remove_bound(rs);
+		} else {
+			ret = 0;
+		}
 		goto out;
 	}
 	trans = rds_trans_get_preferred(sock_net(sock->sk),
-- 
1.7.1

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

end of thread, other threads:[~2015-10-13 11:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-11 20:46 [PATCH net-next] RDS: Invoke ->laddr_check() in rds_bind() for explicitly bound transports Sowmini Varadhan
2015-10-12  2:29 ` santosh.shilimkar
2015-10-13 11:23 ` David Miller

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).