From patchwork Sun Oct 27 18:31:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jozsef Kadlecsik X-Patchwork-Id: 286357 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D6FD72C0040 for ; Mon, 28 Oct 2013 05:32:03 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753521Ab3J0ScB (ORCPT ); Sun, 27 Oct 2013 14:32:01 -0400 Received: from smtp2.kfki.hu ([148.6.0.28]:52878 "EHLO smtp2.kfki.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751955Ab3J0ScA (ORCPT ); Sun, 27 Oct 2013 14:32:00 -0400 Received: from localhost (localhost [127.0.0.1]) by smtp2.kfki.hu (Postfix) with ESMTP id B3F861F40BE; Sun, 27 Oct 2013 19:31:59 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at smtp2.kfki.hu Received: from smtp2.kfki.hu ([127.0.0.1]) by localhost (smtp2.kfki.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Y7SJAM6J3w6D; Sun, 27 Oct 2013 19:31:59 +0100 (CET) Received: from blackhole.kfki.hu (blackhole.kfki.hu [148.6.0.114]) by smtp2.kfki.hu (Postfix) with ESMTP id 8298B1F40BD; Sun, 27 Oct 2013 19:31:59 +0100 (CET) Received: by blackhole.kfki.hu (Postfix, from userid 1000) id 6F35920656; Sun, 27 Oct 2013 19:31:59 +0100 (CET) From: Jozsef Kadlecsik To: netfilter-devel@vger.kernel.org Cc: Pablo Neira Ayuso Subject: [PATCH 1/2] netfilter:ipset: Fix memory allocation for bitmap:port Date: Sun, 27 Oct 2013 19:31:58 +0100 Message-Id: <1382898719-7003-2-git-send-email-kadlec@blackhole.kfki.hu> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1382898719-7003-1-git-send-email-kadlec@blackhole.kfki.hu> References: <1382898719-7003-1-git-send-email-kadlec@blackhole.kfki.hu> Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org At the restructuring of the bitmap types creation in ipset, for the bitmap:port type wrong (too large) memory allocation was copied (netfilter bugzilla id #859). Reported-by: Quentin Armitage Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_bitmap_port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netfilter/ipset/ip_set_bitmap_port.c b/net/netfilter/ipset/ip_set_bitmap_port.c index e7603c5..cf99676 100644 --- a/net/netfilter/ipset/ip_set_bitmap_port.c +++ b/net/netfilter/ipset/ip_set_bitmap_port.c @@ -254,7 +254,7 @@ bitmap_port_create(struct net *net, struct ip_set *set, struct nlattr *tb[], return -ENOMEM; map->elements = last_port - first_port + 1; - map->memsize = map->elements * sizeof(unsigned long); + map->memsize = bitmap_bytes(0, map->elements); set->variant = &bitmap_port; set->dsize = ip_set_elem_len(set, tb, 0); if (!init_map_port(set, map, first_port, last_port)) {