]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
netfilter: ebtables: fix a memory leak bug in compat
authorWenwen Wang <wenwen@cs.uga.edu>
Sat, 20 Jul 2019 12:22:45 +0000 (07:22 -0500)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 17 Sep 2019 16:02:18 +0000 (18:02 +0200)
commit4506ed3dc9927a5cb858641c72a963ab276592f7
tree4e23124213412c92451032e00794d0d580b41527
parent90bf8ba5a558f2ea3bd5c312a086c2498942e012
netfilter: ebtables: fix a memory leak bug in compat

BugLink: https://bugs.launchpad.net/bugs/1842114
[ Upstream commit 15a78ba1844a8e052c1226f930133de4cef4e7ad ]

In compat_do_replace(), a temporary buffer is allocated through vmalloc()
to hold entries copied from the user space. The buffer address is firstly
saved to 'newinfo->entries', and later on assigned to 'entries_tmp'. Then
the entries in this temporary buffer is copied to the internal kernel
structure through compat_copy_entries(). If this copy process fails,
compat_do_replace() should be terminated. However, the allocated temporary
buffer is not freed on this path, leading to a memory leak.

To fix the bug, free the buffer before returning from compat_do_replace().

Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Reviewed-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
net/bridge/netfilter/ebtables.c