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: 467fa15356
("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>
This commit is contained in:
parent
42ea4457ae
commit
8f384c0177
|
@ -70,7 +70,8 @@ static struct hlist_head *rds_conn_bucket(__be32 laddr, __be32 faddr)
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* rcu read lock must be held or the connection spinlock */
|
/* rcu read lock must be held or the connection spinlock */
|
||||||
static struct rds_connection *rds_conn_lookup(struct hlist_head *head,
|
static struct rds_connection *rds_conn_lookup(struct net *net,
|
||||||
|
struct hlist_head *head,
|
||||||
__be32 laddr, __be32 faddr,
|
__be32 laddr, __be32 faddr,
|
||||||
struct rds_transport *trans)
|
struct rds_transport *trans)
|
||||||
{
|
{
|
||||||
|
@ -78,7 +79,7 @@ static struct rds_connection *rds_conn_lookup(struct hlist_head *head,
|
||||||
|
|
||||||
hlist_for_each_entry_rcu(conn, head, c_hash_node) {
|
hlist_for_each_entry_rcu(conn, head, c_hash_node) {
|
||||||
if (conn->c_faddr == faddr && conn->c_laddr == laddr &&
|
if (conn->c_faddr == faddr && conn->c_laddr == laddr &&
|
||||||
conn->c_trans == trans) {
|
conn->c_trans == trans && net == rds_conn_net(conn)) {
|
||||||
ret = conn;
|
ret = conn;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -132,7 +133,7 @@ static struct rds_connection *__rds_conn_create(struct net *net,
|
||||||
if (!is_outgoing && otrans->t_type == RDS_TRANS_TCP)
|
if (!is_outgoing && otrans->t_type == RDS_TRANS_TCP)
|
||||||
goto new_conn;
|
goto new_conn;
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
conn = rds_conn_lookup(head, laddr, faddr, trans);
|
conn = rds_conn_lookup(net, head, laddr, faddr, trans);
|
||||||
if (conn && conn->c_loopback && conn->c_trans != &rds_loop_transport &&
|
if (conn && conn->c_loopback && conn->c_trans != &rds_loop_transport &&
|
||||||
laddr == faddr && !is_outgoing) {
|
laddr == faddr && !is_outgoing) {
|
||||||
/* This is a looped back IB connection, and we're
|
/* This is a looped back IB connection, and we're
|
||||||
|
@ -239,7 +240,7 @@ new_conn:
|
||||||
if (!is_outgoing && otrans->t_type == RDS_TRANS_TCP)
|
if (!is_outgoing && otrans->t_type == RDS_TRANS_TCP)
|
||||||
found = NULL;
|
found = NULL;
|
||||||
else
|
else
|
||||||
found = rds_conn_lookup(head, laddr, faddr, trans);
|
found = rds_conn_lookup(net, head, laddr, faddr, trans);
|
||||||
if (found) {
|
if (found) {
|
||||||
trans->conn_free(conn->c_transport_data);
|
trans->conn_free(conn->c_transport_data);
|
||||||
kmem_cache_free(rds_conn_slab, conn);
|
kmem_cache_free(rds_conn_slab, conn);
|
||||||
|
|
Loading…
Reference in New Issue