mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-15 23:25:07 +00:00
xdp: unpin xdp umem pages in error path
[ Upstream commitfb89c39455
] Fix mem leak caused by missed unpin routine for umem pages. Fixes:8aef7340ae
("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
55ed0ad502
commit
30881d79de
1 changed files with 3 additions and 1 deletions
|
@ -322,7 +322,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++)
|
||||
|
@ -330,6 +330,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;
|
||||
|
|
Loading…
Reference in a new issue