Skip to content

Commit

Permalink
RDS: Invoke ->laddr_check() in rds_bind() for explicitly bound transp…
Browse files Browse the repository at this point in the history
…orts.

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>
  • Loading branch information
Sowmini Varadhan authored and David S. Miller committed Oct 13, 2015
1 parent 571f2c1 commit 4867980
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion net/rds/bind.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 4867980

Please sign in to comment.