* [PATCH] net:netfilter alloc xt_byteslimit_htable with wrong size
@ 2017-09-08 3:00 zhizhou.tian
2017-09-08 11:58 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: zhizhou.tian @ 2017-09-08 3:00 UTC (permalink / raw)
To: pablo, kadlec, fw, davem, netfilter-devel, coreteam, netdev,
linux-kernel
Cc: Zhizhou Tian
From: Zhizhou Tian <zhizhou.tian@gmail.com>
struct xt_byteslimit_htable used hlist_head,
but alloc memory with sizeof(struct list_head)
Change-Id: I75bc60e47e0823700d4303c9d763b7995e3b7bb3
Signed-off-by: Zhizhou Tian <zhizhou.tian@gmail.com>
---
net/netfilter/xt_hashlimit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 10d4823..962ea4a 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -279,7 +279,7 @@ static int htable_create(struct net *net, struct hashlimit_cfg3 *cfg,
size = cfg->size;
} else {
size = (totalram_pages << PAGE_SHIFT) / 16384 /
- sizeof(struct list_head);
+ sizeof(struct hlist_head);
if (totalram_pages > 1024 * 1024 * 1024 / PAGE_SIZE)
size = 8192;
if (size < 16)
@@ -287,7 +287,7 @@ static int htable_create(struct net *net, struct hashlimit_cfg3 *cfg,
}
/* FIXME: don't use vmalloc() here or anywhere else -HW */
hinfo = vmalloc(sizeof(struct xt_hashlimit_htable) +
- sizeof(struct list_head) * size);
+ sizeof(struct hlist_head) * size);
if (hinfo == NULL)
return -ENOMEM;
*out_hinfo = hinfo;
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net:netfilter alloc xt_byteslimit_htable with wrong size
2017-09-08 3:00 [PATCH] net:netfilter alloc xt_byteslimit_htable with wrong size zhizhou.tian
@ 2017-09-08 11:58 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2017-09-08 11:58 UTC (permalink / raw)
To: zhizhou.tian
Cc: kadlec, fw, davem, netfilter-devel, coreteam, netdev, linux-kernel
On Fri, Sep 08, 2017 at 11:00:16AM +0800, zhizhou.tian@gmail.com wrote:
> From: Zhizhou Tian <zhizhou.tian@gmail.com>
>
> struct xt_byteslimit_htable used hlist_head,
> but alloc memory with sizeof(struct list_head)
Applied, thanks.
For the record, I have mangled the patch titled to:
netfilter: xt_hashlimit: alloc hashtable with right size
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-08 11:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-08 3:00 [PATCH] net:netfilter alloc xt_byteslimit_htable with wrong size zhizhou.tian
2017-09-08 11:58 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).