]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
bpf: Fix map leak in HASH_OF_MAPS map
authorAndrii Nakryiko <andriin@fb.com>
Wed, 29 Jul 2020 04:09:12 +0000 (21:09 -0700)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fri, 4 Sep 2020 19:28:35 +0000 (16:28 -0300)
commit303c2cbaf4fa78b6e6f5c6ae63f1aa3a977bf134
tree4e6ec6494d886c6f427e489aa7a6aa47d72650c4
parentfcf83eabbcbcb867a0ccd1821700468846808d51
bpf: Fix map leak in HASH_OF_MAPS map

BugLink: https://bugs.launchpad.net/bugs/1891063
[ Upstream commit 1d4e1eab456e1ee92a94987499b211db05f900ea ]

Fix HASH_OF_MAPS bug of not putting inner map pointer on bpf_map_elem_update()
operation. This is due to per-cpu extra_elems optimization, which bypassed
free_htab_elem() logic doing proper clean ups. Make sure that inner map is put
properly in optimized case as well.

Fixes: 8c290e60fa2a ("bpf: fix hashmap extra_elems logic")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20200729040913.2815687-1-andriin@fb.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Ian May <ian.may@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
kernel/bpf/hashtab.c