Skip to content

Commit

Permalink
sctp: Fix memory leak in sctp_sf_do_5_2_4_dupcook
Browse files Browse the repository at this point in the history
In the implementation of sctp_sf_do_5_2_4_dupcook() the allocated
new_asoc is leaked if security_sctp_assoc_request() fails. Release it
via sctp_association_free().

Fixes: 2277c7c ("sctp: Add LSM hooks")
Signed-off-by: Navid Emamdoost <[email protected]>
Acked-by: Marcelo Ricardo Leitner <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
Navidem authored and Jakub Kicinski committed Nov 24, 2019
1 parent 34c36f4 commit b6631c6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/sctp/sm_statefuns.c
Original file line number Diff line number Diff line change
Expand Up @@ -2160,8 +2160,10 @@ enum sctp_disposition sctp_sf_do_5_2_4_dupcook(

/* Update socket peer label if first association. */
if (security_sctp_assoc_request((struct sctp_endpoint *)ep,
chunk->skb))
chunk->skb)) {
sctp_association_free(new_asoc);
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
}

/* Set temp so that it won't be added into hashtable */
new_asoc->temp = 1;
Expand Down

0 comments on commit b6631c6

Please sign in to comment.