Skip to content

Commit

Permalink
sctp: change to hold sk after auth shkey is created successfully
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
lxin authored and davem330 committed Jun 27, 2019
1 parent 1369653 commit 25bff6d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/sctp/endpointola.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
/* Initialize the bind addr area */
sctp_bind_addr_init(&ep->base.bind_addr, 0);

/* Remember who we are attached to. */
ep->base.sk = sk;
sock_hold(ep->base.sk);

/* Create the lists of associations. */
INIT_LIST_HEAD(&ep->asocs);

Expand Down Expand Up @@ -154,6 +150,10 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
ep->prsctp_enable = net->sctp.prsctp_enable;
ep->reconf_enable = net->sctp.reconf_enable;

/* Remember who we are attached to. */
ep->base.sk = sk;
sock_hold(ep->base.sk);

return ep;

nomem_shkey:
Expand Down

0 comments on commit 25bff6d

Please sign in to comment.