From: Charlie Sale <chucks.8090@gmail.com>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Charlie Sale <chucks.8090@gmail.com>
Subject: [PATCH] Net: netfilter: vmalloc/vfree to kvmalloc/kvfree
Date: Fri, 3 Nov 2017 16:07:31 -0400 [thread overview]
Message-ID: <20171103200731.6576-1-chucks.8090@gmail.com> (raw)
Fixed FIXME by changing memory allocation and freeing
in htable_create to kvmalloc and kvfree from vmalloc and vfree.
Changes are made throughout the file in order to account
for the different allocation of htable_create.
Small note: This is a replacement of an earlier patch that did not
work. Enough was changed, so I thought I would just submit a new
patch.
Signed-off-by: Charlie Sale <chucks.8090@gmail.com>
---
net/netfilter/xt_hashlimit.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 5da8746f7b88..28ad74b3e3d0 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -286,9 +286,9 @@ static int htable_create(struct net *net, struct hashlimit_cfg3 *cfg,
if (size < 16)
size = 16;
}
- /* FIXME: don't use vmalloc() here or anywhere else -HW */
- hinfo = vmalloc(sizeof(struct xt_hashlimit_htable) +
- sizeof(struct hlist_head) * size);
+
+ hinfo = kvmalloc(sizeof(*hinfo) + sizeof(struct hlist_head) * size,
+ GPT_KERNEL);
if (hinfo == NULL)
return -ENOMEM;
*out_hinfo = hinfo;
@@ -314,7 +314,7 @@ static int htable_create(struct net *net, struct hashlimit_cfg3 *cfg,
hinfo->rnd_initialized = false;
hinfo->name = kstrdup(name, GFP_KERNEL);
if (!hinfo->name) {
- vfree(hinfo);
+ kvfree(hinfo);
return -ENOMEM;
}
spin_lock_init(&hinfo->lock);
@@ -336,7 +336,7 @@ static int htable_create(struct net *net, struct hashlimit_cfg3 *cfg,
fops, hinfo);
if (hinfo->pde == NULL) {
kfree(hinfo->name);
- vfree(hinfo);
+ kvfree(hinfo);
return -ENOMEM;
}
hinfo->net = net;
@@ -414,7 +414,7 @@ static void htable_destroy(struct xt_hashlimit_htable *hinfo)
htable_remove_proc_entry(hinfo);
htable_selective_cleanup(hinfo, select_all);
kfree(hinfo->name);
- vfree(hinfo);
+ kvfree(hinfo);
}
static struct xt_hashlimit_htable *htable_find_get(struct net *net,
--
2.13.6
next reply other threads:[~2017-11-03 20:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-03 20:07 Charlie Sale [this message]
2017-11-04 0:19 ` [PATCH] Net: netfilter: vmalloc/vfree to kvmalloc/kvfree Florian Westphal
-- strict thread matches above, loose matches on Subject: below --
2017-11-19 17:46 Charlie Sale
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171103200731.6576-1-chucks.8090@gmail.com \
--to=chucks.8090@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.