Commit 2e0c9e79 authored by Daniel Borkmann's avatar Daniel Borkmann Committed by David S. Miller
Browse files

net: sctp: sctp_association_init: put refs in reverse order

In case we need to bail out for whatever reason during assoc
init, we call sctp_endpoint_put() and then sock_put(), however,
we've hold both refs in reverse, non-symmetric order, so first
sctp_endpoint_hold() and then sock_hold().

Reverse this, so that in an error case we have sock_put() and then
sctp_endpoint_put(). Actually shouldn't matter too much, since both
cleanup paths do the right thing, but that way, it is more consistent
with the rest of the code.
Signed-off-by: default avatarDaniel Borkmann <>
Acked-by: default avatarVlad Yasevich <>
Signed-off-by: default avatarDavid S. Miller <>
parent c164b838
......@@ -86,10 +86,9 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
/* Discarding const is appropriate here. */
asoc->ep = (struct sctp_endpoint *)ep;
/* Hold the sock. */
asoc-> = (struct sock *)sk;
/* Initialize the common base substructure. */
......@@ -343,8 +342,8 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
return asoc;
return NULL;
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