xfrm: Fix memory leak of aead algorithm name
authorIlan Tayari <ilant@mellanox.com>
Sun, 18 Sep 2016 07:42:53 +0000 (07:42 +0000)
committerSteffen Klassert <steffen.klassert@secunet.com>
Mon, 19 Sep 2016 10:08:58 +0000 (12:08 +0200)
commit 1a6509d99122 ("[IPSEC]: Add support for combined mode algorithms")
introduced aead. The function attach_aead kmemdup()s the algorithm
name during xfrm_state_construct().
However this memory is never freed.
Implementation has since been slightly modified in
commit ee5c23176fcc ("xfrm: Clone states properly on migration")
without resolving this leak.
This patch adds a kfree() call for the aead algorithm name.

Fixes: 1a6509d99122 ("[IPSEC]: Add support for combined mode algorithms")
Signed-off-by: Ilan Tayari <ilant@mellanox.com>
Acked-by: Rami Rosen <roszenrami@gmail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/xfrm/xfrm_state.c

index 9895a8c56d8c2675393e1aad3a1a438e16d4d47c..a30f898dc1c5a82fb6221248799f5adbb07f2236 100644 (file)
@@ -332,6 +332,7 @@ static void xfrm_state_gc_destroy(struct xfrm_state *x)
 {
        tasklet_hrtimer_cancel(&x->mtimer);
        del_timer_sync(&x->rtimer);
+       kfree(x->aead);
        kfree(x->aalg);
        kfree(x->ealg);
        kfree(x->calg);