From: Georg Chini <georg.chini@triaton-webhosting.com>
To: "David S. Miller" <davem@redhat.com>
Cc: Balint Cristian <rezso@rdsor.ro>,
sparclinux@vger.kernel.org, netfilter-devel@lists.netfilter.org
Subject: Re: iptables+2.6-test8-bk4 : Still problems
Date: Tue, 28 Oct 2003 21:31:02 +0100 [thread overview]
Message-ID: <3F9ED206.4040806@triaton-webhosting.com> (raw)
In-Reply-To: <20031026223438.1cf757ce.davem@redhat.com>
David S. Miller wrote:
> It's some bug in the translation code in net/compat.c
Yes it is.
The problem is, that the ipt_entries are not all the same
size. So instead of copying them one by one you have
to copy the whole block. Here is a patch:
--- linux-test/net/compat.c Tue Oct 28 21:15:36 2003
+++ linux-2.6.0-test9/net/compat.c Tue Oct 28 20:52:43 2003
@@ -318,11 +318,12 @@
{
struct compat_ipt_replace *urepl = (struct compat_ipt_replace *)optval;
struct ipt_replace *repl_nat;
+ struct ipt_entry *k_ipt_entries;
char name[IPT_TABLE_MAXNAMELEN];
u32 origsize, tmp32, num_counters;
unsigned int repl_nat_size;
int ret;
- int i, num_ents;
+ int i;
compat_uptr_t ucntrs;
if (get_user(origsize, &urepl->size))
@@ -366,15 +367,14 @@
__put_user(compat_ptr(ucntrs), &repl_nat->counters))
goto out;
- num_ents = origsize / sizeof(struct ipt_entry);
-
- for (i = 0; i < num_ents; i++) {
- struct ipt_entry ent;
+ k_ipt_entries = (struct ipt_entry *)kmalloc(origsize, GFP_KERNEL);
+ if (__copy_from_user(k_ipt_entries, &urepl->entries[0], origsize) ||
+ __copy_to_user(&repl_nat->entries[0], k_ipt_entries, origsize)) {
+ kfree(k_ipt_entries);
+ goto out;
+ }
- if (__copy_from_user(&ent, &urepl->entries[i], sizeof(ent)) ||
- __copy_to_user(&repl_nat->entries[i], &ent, sizeof(ent)))
- goto out;
- }
+ kfree(k_ipt_entries);
for (i = 0; i < NF_IP_NUMHOOKS; i++) {
if (__get_user(tmp32, &urepl->hook_entry[i]) ||
next prev parent reply other threads:[~2003-10-28 20:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-26 8:48 iptables+2.6-test8-bk4 : Still problems Georg Chini
2003-10-26 15:52 ` Balint Cristian
2003-10-27 6:34 ` David S. Miller
2003-10-28 20:31 ` Georg Chini [this message]
2003-10-29 6:48 ` David S. Miller
2003-10-29 7:13 ` David S. Miller
2003-10-29 18:20 ` Ryan Veety
2003-10-29 18:34 ` David S. Miller
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=3F9ED206.4040806@triaton-webhosting.com \
--to=georg.chini@triaton-webhosting.com \
--cc=davem@redhat.com \
--cc=netfilter-devel@lists.netfilter.org \
--cc=rezso@rdsor.ro \
--cc=sparclinux@vger.kernel.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.