diff options
author | Sowmini Varadhan <sowmini.varadhan@oracle.com> | 2015-09-03 16:24:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-09-06 01:04:58 -0400 |
commit | 8f384c0177a03640312b9cb3638c998b32243b63 (patch) | |
tree | 4814d59e07aaa668296f3feb919aeba003b439b9 /net | |
parent | 42ea4457aea7aaeddf0c0b06724f297608f5e9d2 (diff) |
RDS: rds_conn_lookup() should factor in the struct net for a match
Only return a conn if the rds_conn_net(conn) matches the struct
net passed to rds_conn_lookup().
Fixes: 467fa15356ac ("RDS-TCP: Support multiple RDS-TCP listen endpoints,
one per netns.")
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')
-rw-r--r-- | net/rds/connection.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/rds/connection.c b/net/rds/connection.c index a50e652eb269..9b2de5e67d79 100644 --- a/net/rds/connection.c +++ b/net/rds/connection.c | |||
@@ -70,7 +70,8 @@ static struct hlist_head *rds_conn_bucket(__be32 laddr, __be32 faddr) | |||
70 | } while (0) | 70 | } while (0) |
71 | 71 | ||
72 | /* rcu read lock must be held or the connection spinlock */ | 72 | /* rcu read lock must be held or the connection spinlock */ |
73 | static struct rds_connection *rds_conn_lookup(struct hlist_head *head, | 73 | static struct rds_connection *rds_conn_lookup(struct net *net, |
74 | struct hlist_head *head, | ||
74 | __be32 laddr, __be32 faddr, | 75 | __be32 laddr, __be32 faddr, |
75 | struct rds_transport *trans) | 76 | struct rds_transport *trans) |
76 | { | 77 | { |
@@ -78,7 +79,7 @@ static struct rds_connection *rds_conn_lookup(struct hlist_head *head, | |||
78 | 79 | ||
79 | hlist_for_each_entry_rcu(conn, head, c_hash_node) { | 80 | hlist_for_each_entry_rcu(conn, head, c_hash_node) { |
80 | if (conn->c_faddr == faddr && conn->c_laddr == laddr && | 81 | if (conn->c_faddr == faddr && conn->c_laddr == laddr && |
81 | conn->c_trans == trans) { | 82 | conn->c_trans == trans && net == rds_conn_net(conn)) { |
82 | ret = conn; | 83 | ret = conn; |
83 | break; | 84 | break; |
84 | } | 85 | } |
@@ -132,7 +133,7 @@ static struct rds_connection *__rds_conn_create(struct net *net, | |||
132 | if (!is_outgoing && otrans->t_type == RDS_TRANS_TCP) | 133 | if (!is_outgoing && otrans->t_type == RDS_TRANS_TCP) |
133 | goto new_conn; | 134 | goto new_conn; |
134 | rcu_read_lock(); | 135 | rcu_read_lock(); |
135 | conn = rds_conn_lookup(head, laddr, faddr, trans); | 136 | conn = rds_conn_lookup(net, head, laddr, faddr, trans); |
136 | if (conn && conn->c_loopback && conn->c_trans != &rds_loop_transport && | 137 | if (conn && conn->c_loopback && conn->c_trans != &rds_loop_transport && |
137 | laddr == faddr && !is_outgoing) { | 138 | laddr == faddr && !is_outgoing) { |
138 | /* This is a looped back IB connection, and we're | 139 | /* This is a looped back IB connection, and we're |
@@ -239,7 +240,7 @@ new_conn: | |||
239 | if (!is_outgoing && otrans->t_type == RDS_TRANS_TCP) | 240 | if (!is_outgoing && otrans->t_type == RDS_TRANS_TCP) |
240 | found = NULL; | 241 | found = NULL; |
241 | else | 242 | else |
242 | found = rds_conn_lookup(head, laddr, faddr, trans); | 243 | found = rds_conn_lookup(net, head, laddr, faddr, trans); |
243 | if (found) { | 244 | if (found) { |
244 | trans->conn_free(conn->c_transport_data); | 245 | trans->conn_free(conn->c_transport_data); |
245 | kmem_cache_free(rds_conn_slab, conn); | 246 | kmem_cache_free(rds_conn_slab, conn); |