summaryrefslogtreecommitdiff
path: root/net/rds
diff options
context:
space:
mode:
authorSowmini Varadhan <sowmini.varadhan@oracle.com>2015-10-11 23:46:03 +0300
committerDavid S. Miller <davem@davemloft.net>2015-10-13 14:22:40 +0300
commit486798001b92eacbf9f809787a6348750c174035 (patch)
tree6c657666ad8f0f454aa02526651b77ca76d057cb /net/rds
parent571f2c11b343cd6997f35a21f6caa0f78e87fc84 (diff)
downloadlinux-486798001b92eacbf9f809787a6348750c174035.tar.xz
RDS: Invoke ->laddr_check() in rds_bind() for explicitly bound transports.
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> Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rds')
-rw-r--r--net/rds/bind.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/net/rds/bind.c b/net/rds/bind.c
index bc6b93ecedb5..61925667b7a4 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),