diff options
author | Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> | 2019-08-15 22:56:35 +0200 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-08-20 16:39:48 +0200 |
commit | fb89c39455e4b49881c5a42761bd71f03d3ef888 (patch) | |
tree | 912fa84ac825b9b3db033cf9e0ba47fe7c3273f7 /net/xdp | |
parent | tools: bpftool: close prog FD before exit on showing a single program (diff) | |
download | linux-fb89c39455e4b49881c5a42761bd71f03d3ef888.tar.xz linux-fb89c39455e4b49881c5a42761bd71f03d3ef888.zip |
xdp: unpin xdp umem pages in error path
Fix mem leak caused by missed unpin routine for umem pages.
Fixes: 8aef7340ae9695 ("xsk: introduce xdp_umem_page")
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Acked-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'net/xdp')
-rw-r--r-- | net/xdp/xdp_umem.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c index 83de74ca729a..688aac7a6943 100644 --- a/net/xdp/xdp_umem.c +++ b/net/xdp/xdp_umem.c @@ -365,7 +365,7 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) umem->pages = kcalloc(umem->npgs, sizeof(*umem->pages), GFP_KERNEL); if (!umem->pages) { err = -ENOMEM; - goto out_account; + goto out_pin; } for (i = 0; i < umem->npgs; i++) @@ -373,6 +373,8 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) return 0; +out_pin: + xdp_umem_unpin_pages(umem); out_account: xdp_umem_unaccount_pages(umem); return err; |