From: pablo@netfilter.org
To: stable@kernel.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH 6/6] netfilter: xt_limit: have r->cost != 0 case work
Date: Thu, 11 Oct 2012 12:00:07 +0200 [thread overview]
Message-ID: <1349949607-12190-7-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1349949607-12190-1-git-send-email-pablo@netfilter.org>
From: Jan Engelhardt <jengelh@inai.de>
Commit v2.6.19-rc1~1272^2~41 tells us that r->cost != 0 can happen when
a running state is saved to userspace and then reinstated from there.
Make sure that private xt_limit area is initialized with correct values.
Otherwise, random matchings due to use of uninitialized memory.
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
This patch requires:
commit 7a909ac70f6b0823d9f23a43f19598d4b57ac901
Author: Florian Westphal <fw@strlen.de>
Date: Mon May 7 10:51:43 2012 +0000
netfilter: limit, hashlimit: avoid duplicated inline
---
net/netfilter/xt_limit.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/netfilter/xt_limit.c b/net/netfilter/xt_limit.c
index 5c22ce8..a4c1e45 100644
--- a/net/netfilter/xt_limit.c
+++ b/net/netfilter/xt_limit.c
@@ -117,11 +117,11 @@ static int limit_mt_check(const struct xt_mtchk_param *par)
/* For SMP, we only want to use one set of state. */
r->master = priv;
+ /* User avg in seconds * XT_LIMIT_SCALE: convert to jiffies *
+ 128. */
+ priv->prev = jiffies;
+ priv->credit = user2credits(r->avg * r->burst); /* Credits full. */
if (r->cost == 0) {
- /* User avg in seconds * XT_LIMIT_SCALE: convert to jiffies *
- 128. */
- priv->prev = jiffies;
- priv->credit = user2credits(r->avg * r->burst); /* Credits full. */
r->credit_cap = priv->credit; /* Credits full. */
r->cost = user2credits(r->avg);
}
--
1.7.10.4
next prev parent reply other threads:[~2012-10-11 10:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-11 10:00 [PATCH] Netfilter/IPVS updates for stable 3.0 onwards pablo
2012-10-11 10:00 ` [PATCH 1/6] netfilter: nf_ct_ipv4: packets with wrong ihl are invalid pablo
2012-10-11 10:00 ` [PATCH 2/6] netfilter: nf_nat_sip: fix incorrect handling of EBUSY for RTCP expectation pablo
2012-10-11 10:00 ` [PATCH 3/6] netfilter: nf_nat_sip: fix via header translation with multiple parameters pablo
2012-10-11 10:00 ` [PATCH 4/6] netfilter: nf_ct_expect: fix possible access to uninitialized timer pablo
2012-10-11 10:00 ` [PATCH 5/6] ipvs: fix oops on NAT reply in br_nf context pablo
2012-10-11 10:00 ` pablo [this message]
2012-10-11 19:08 ` [PATCH] Netfilter/IPVS updates for stable 3.0 onwards David Miller
2012-10-11 19:11 ` David Miller
2012-10-11 21:55 ` Pablo Neira Ayuso
2012-10-11 22:21 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2012-10-11 10:15 pablo
2012-10-11 10:15 ` [PATCH 6/6] netfilter: xt_limit: have r->cost != 0 case work pablo
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=1349949607-12190-7-git-send-email-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=stable@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 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).