LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Pekka J Enberg <penberg@cs.helsinki.fi>
Cc: netfilter-devel@vger.kernel.org, clameter@sgi.com,
joe@perches.com, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org,
Netfilter Development Mailinglist
<netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH] netfilter: replace horrible hack with ksize()
Date: Thu, 06 Mar 2008 15:03:35 +0100 [thread overview]
Message-ID: <47CFF9B7.5060803@trash.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0803052319210.15759@sbz-30.cs.Helsinki.FI>
Pekka J Enberg wrote:
> From: Pekka Enberg <penberg@cs.helsinki.fi>
>
> There's a horrible slab abuse in net/netfilter/nf_conntrack_extend.c that
> can be replaced with a call to ksize().
This doesn't look right.
> @@ -95,7 +85,7 @@ void *__nf_ct_ext_add(struct nf_conn *ct
> newlen = newoff + t->len;
> rcu_read_unlock();
>
> - if (newlen >= ct->ext->real_len) {
> + if (newlen >= ksize(ct->ext)) {
This needs to look at the currently allocated size, otherwise
it will always realloc when adding new extensions after having
used up ksize(ct->ext) space.
> new = kmalloc(newlen, gfp);
And this should use ksize(newlen) and store the real length
in real_len below.
> if (!new)
> return NULL;
> @@ -114,7 +104,6 @@ void *__nf_ct_ext_add(struct nf_conn *ct
> rcu_read_unlock();
> }
> kfree(ct->ext);
> - new->real_len = newlen;
> ct->ext = new;
> }
next prev parent reply other threads:[~2008-03-06 14:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-05 21:20 Pekka J Enberg
2008-03-05 21:56 ` Christoph Lameter
2008-03-05 21:57 ` Pekka Enberg
2008-03-05 22:19 ` David Miller
2008-03-06 14:03 ` Patrick McHardy [this message]
2008-03-06 14:14 ` Pekka J Enberg
2008-03-06 14:20 ` Pekka J Enberg
2008-03-06 14:35 ` Patrick McHardy
2008-03-06 14:41 ` Pekka J Enberg
2008-03-06 14:51 ` Patrick McHardy
2008-03-06 15:49 ` Pekka Enberg
2008-03-10 17:57 ` Patrick McHardy
2008-03-06 16:41 ` Christoph Lameter
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=47CFF9B7.5060803@trash.net \
--to=kaber@trash.net \
--cc=clameter@sgi.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=penberg@cs.helsinki.fi \
--subject='Re: [PATCH] netfilter: replace horrible hack with ksize()' \
/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
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).