diff options
author | Navid Emamdoost <navid.emamdoost@gmail.com> | 2019-11-22 16:17:56 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-12-05 09:21:30 +0100 |
commit | 681e08498e5e7e051ba1fedf815509f56ef31c4f (patch) | |
tree | ae7ee725ffea6767637f530ecc4a8e675b6f46f2 /net | |
parent | ae0ab39570fbb2a37690f70f2d93dfb2ddebdf3d (diff) | |
download | linux-stable-681e08498e5e7e051ba1fedf815509f56ef31c4f.tar.gz linux-stable-681e08498e5e7e051ba1fedf815509f56ef31c4f.tar.bz2 linux-stable-681e08498e5e7e051ba1fedf815509f56ef31c4f.zip |
sctp: Fix memory leak in sctp_sf_do_5_2_4_dupcook
[ Upstream commit b6631c6031c746ed004c4221ec0616d7a520f441 ]
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: 2277c7cd75e3 ("sctp: Add LSM hooks")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/sctp/sm_statefuns.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 713a669d2058..559f09ac0b22 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c @@ -2175,8 +2175,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; |