mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
netfilter: ebtables: zero chainstack array
commitcbfe53599eupstream. sashiko reports: looking at ebtables table translation, could a sparse cpu_possible_mask lead to an uninitialized pointer free? If cpu_possible_mask is sparse (for example, CPU 0 and CPU 2 are possible, but CPU 1 is not), the allocation loop skips CPU 1. If vmalloc_node() fails at CPU 2, the cleanup loop will blindly decrement and call vfree() on newinfo->chainstack[1]. Not a real-world bug, such allocation isn't expected to fail in the first place. Cc: stable@vger.kernel.org Fixes:1da177e4c3("Linux-2.6.12-rc2") Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
fc5bfe63ba
commit
9f74d28e90
@@ -921,8 +921,7 @@ static int translate_table(struct net *net, const char *name,
|
||||
* if an error occurs
|
||||
*/
|
||||
newinfo->chainstack =
|
||||
vmalloc_array(nr_cpu_ids,
|
||||
sizeof(*(newinfo->chainstack)));
|
||||
vcalloc(nr_cpu_ids, sizeof(*(newinfo->chainstack)));
|
||||
if (!newinfo->chainstack)
|
||||
return -ENOMEM;
|
||||
for_each_possible_cpu(i) {
|
||||
|
||||
Reference in New Issue
Block a user