Skip to content

Commit b4b1f8e

Browse files
lxinbwhacks
authored andcommitted
sctp: change to hold sk after auth shkey is created successfully
commit 25bff6d upstream. Now in sctp_endpoint_init(), it holds the sk then creates auth shkey. But when the creation fails, it doesn't release the sk, which causes a sk defcnf leak, Here to fix it by only holding the sk when auth shkey is created successfully. Fixes: a29a5bd ("[SCTP]: Implement SCTP-AUTH initializations.") Reported-by: [email protected] Reported-by: [email protected] Signed-off-by: Xin Long <[email protected]> Acked-by: Neil Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]> [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings <[email protected]>
1 parent 2489c9a commit b4b1f8e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/sctp/endpointola.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,6 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
126126
/* Initialize the bind addr area */
127127
sctp_bind_addr_init(&ep->base.bind_addr, 0);
128128

129-
/* Remember who we are attached to. */
130-
ep->base.sk = sk;
131-
sock_hold(ep->base.sk);
132-
133129
/* Create the lists of associations. */
134130
INIT_LIST_HEAD(&ep->asocs);
135131

@@ -165,6 +161,10 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
165161
ep->auth_hmacs_list = auth_hmacs;
166162
ep->auth_chunk_list = auth_chunks;
167163

164+
/* Remember who we are attached to. */
165+
ep->base.sk = sk;
166+
sock_hold(ep->base.sk);
167+
168168
return ep;
169169

170170
nomem_hmacs:

0 commit comments

Comments
 (0)