]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
xfrm: Fix memleak on xfrm state destroy
authorSteffen Klassert <steffen.klassert@secunet.com>
Fri, 29 Nov 2019 12:05:39 +0000 (13:05 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 4 Dec 2019 09:29:26 +0000 (10:29 +0100)
We leak the page that we use to create skb page fragments
when destroying the xfrm_state. Fix this by dropping a
page reference if a page was assigned to the xfrm_state.

Fixes: cac2661c53f3 ("esp4: Avoid skb_cow_data whenever possible")
Reported-by: JD <jdtxs00@gmail.com>
Reported-by: Paul Wouters <paul@nohats.ca>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
BugLink: https://bugs.launchpad.net/bugs/1853197
(cherry picked from commit 86c6739eda7d2a03f2db30cbee67a5fb81afa8ba)
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Sultan Alsawaf <sultan.alsawaf@canonical.com>
Acked-by: Kleber Souza <kleber.souza@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/xfrm/xfrm_state.c

index c6f3c4a1bd9935101008201a11c043ac3254ddec..f3423562d93365cd5db641b6b9af43a11984e93d 100644 (file)
@@ -495,6 +495,8 @@ static void ___xfrm_state_destroy(struct xfrm_state *x)
                x->type->destructor(x);
                xfrm_put_type(x->type);
        }
+       if (x->xfrag.page)
+               put_page(x->xfrag.page);
        xfrm_dev_state_free(x);
        security_xfrm_state_free(x);
        xfrm_state_free(x);