[rds-devel] [PATCH net-next] RDS: Invoke ->laddr_check() in rds_bind() for explicitly bound transports.

santosh.shilimkar at oracle.com santosh.shilimkar at oracle.com
Sun Oct 11 19:29:23 PDT 2015


On 10/11/15 1:46 PM, Sowmini Varadhan wrote:
>
> 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.
>
Right. Probably it should go into stable as well.

> Signed-off-by: Sowmini Varadhan <sowmini.varadhan at 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;
Minor comment. If you retain above line you can drop the below else.
> +		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;
> +		}

Acked-by: Santosh Shilimkar <santosh.shilimkar at oracle.com>



More information about the rds-devel mailing list