Commit dd7445ad authored by Xin Long's avatar Xin Long Committed by David S. Miller

sctp: the temp asoc's transports should not be hashed/unhashed

Re-establish the previous behavior and avoid hashing temporary asocs by
checking t->asoc->temp in sctp_(un)hash_transport. Also, remove the
check of t->asoc->temp in __sctp_lookup_association, since they are
never hashed now.

Fixes: 4f008781 ("sctp: apply rhashtable api to send/recv path")
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Reported-by: default avatarVlad Yasevich <vyasevich@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0b6e26ce
...@@ -333,7 +333,7 @@ struct sctp_association *sctp_endpoint_lookup_assoc( ...@@ -333,7 +333,7 @@ struct sctp_association *sctp_endpoint_lookup_assoc(
if (!ep->base.bind_addr.port) if (!ep->base.bind_addr.port)
goto out; goto out;
t = sctp_epaddr_lookup_transport(ep, paddr); t = sctp_epaddr_lookup_transport(ep, paddr);
if (!t || t->asoc->temp) if (!t)
goto out; goto out;
*transport = t; *transport = t;
......
...@@ -874,6 +874,9 @@ void sctp_hash_transport(struct sctp_transport *t) ...@@ -874,6 +874,9 @@ void sctp_hash_transport(struct sctp_transport *t)
{ {
struct sctp_hash_cmp_arg arg; struct sctp_hash_cmp_arg arg;
if (t->asoc->temp)
return;
arg.ep = t->asoc->ep; arg.ep = t->asoc->ep;
arg.paddr = &t->ipaddr; arg.paddr = &t->ipaddr;
arg.net = sock_net(t->asoc->base.sk); arg.net = sock_net(t->asoc->base.sk);
...@@ -886,6 +889,9 @@ void sctp_hash_transport(struct sctp_transport *t) ...@@ -886,6 +889,9 @@ void sctp_hash_transport(struct sctp_transport *t)
void sctp_unhash_transport(struct sctp_transport *t) void sctp_unhash_transport(struct sctp_transport *t)
{ {
if (t->asoc->temp)
return;
rhashtable_remove_fast(&sctp_transport_hashtable, &t->node, rhashtable_remove_fast(&sctp_transport_hashtable, &t->node,
sctp_hash_params); sctp_hash_params);
} }
...@@ -931,7 +937,7 @@ static struct sctp_association *__sctp_lookup_association( ...@@ -931,7 +937,7 @@ static struct sctp_association *__sctp_lookup_association(
struct sctp_transport *t; struct sctp_transport *t;
t = sctp_addrs_lookup_transport(net, local, peer); t = sctp_addrs_lookup_transport(net, local, peer);
if (!t || t->dead || t->asoc->temp) if (!t || t->dead)
return NULL; return NULL;
sctp_association_hold(t->asoc); sctp_association_hold(t->asoc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment