Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1244221 > unrolled thread

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

Started bySowmini Varadhan <sowmini.varadhan@oracle.com>
First post2015-10-11 22:50 +0200
Last post2015-10-13 13:10 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH net-next] RDS: Invoke ->laddr_check() in rds_bind() for  explicitly bound transports. Sowmini Varadhan <sowmini.varadhan@oracle.com> - 2015-10-11 22:50 +0200
    Re: [PATCH net-next] RDS: Invoke ->laddr_check() in rds_bind() for  explicitly bound transports. "santosh.shilimkar@oracle.com" <santosh.shilimkar@oracle.com> - 2015-10-12 04:30 +0200
    Re: [PATCH net-next] RDS: Invoke ->laddr_check() in rds_bind() for  explicitly bound transports. David Miller <davem@davemloft.net> - 2015-10-13 13:10 +0200

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

FromSowmini Varadhan <sowmini.varadhan@oracle.com>
Date2015-10-11 22:50 +0200
Subject[PATCH net-next] RDS: Invoke ->laddr_check() in rds_bind() for explicitly bound transports.
Message-ID<qivJ8-2Fs-17@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1244341

From"santosh.shilimkar@oracle.com" <santosh.shilimkar@oracle.com>
Date2015-10-12 04:30 +0200
Message-ID<qiB2a-25v-3@gated-at.bofh.it>
In reply to#1244221
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@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@oracle.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1245589

FromDavid Miller <davem@davemloft.net>
Date2015-10-13 13:10 +0200
Message-ID<qj5CW-4Ht-13@gated-at.bofh.it>
In reply to#1244221
From: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Date: Sun, 11 Oct 2015 16:46:03 -0400

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

Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web