Skip to content

Commit d6a4562

Browse files
Navidemgregkh
authored andcommitted
sctp: Fix memory leak in sctp_sf_do_5_2_4_dupcook
[ Upstream commit b6631c6 ] 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8109f5b commit d6a4562

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/sctp/sm_statefuns.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -2160,8 +2160,10 @@ enum sctp_disposition sctp_sf_do_5_2_4_dupcook(
21602160

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

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

0 commit comments

Comments
 (0)