netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 4/8] netfilter: WARN about wrong usage of sequence number adjustments
Date: Sat, 28 Dec 2013 23:03:03 +0100	[thread overview]
Message-ID: <1388268187-11569-5-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1388268187-11569-1-git-send-email-pablo@netfilter.org>

From: Jesper Dangaard Brouer <brouer@redhat.com>

Since commit 41d73ec053d2 (netfilter: nf_conntrack: make sequence
number adjustments usuable without NAT), the sequence number extension
is dynamically allocated.

Instead of dying, give a WARN splash, in case of wrong usage of the
seqadj code, e.g. when forgetting to allocate via nfct_seqadj_ext_add().

Wrong usage have been seen in the IPVS code path.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
 net/netfilter/nf_conntrack_seqadj.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/netfilter/nf_conntrack_seqadj.c b/net/netfilter/nf_conntrack_seqadj.c
index 17c1bcb..b2d38da 100644
--- a/net/netfilter/nf_conntrack_seqadj.c
+++ b/net/netfilter/nf_conntrack_seqadj.c
@@ -36,6 +36,11 @@ int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
 	if (off == 0)
 		return 0;
 
+	if (unlikely(!seqadj)) {
+		WARN(1, "Wrong seqadj usage, missing nfct_seqadj_ext_add()\n");
+		return 0;
+	}
+
 	set_bit(IPS_SEQ_ADJUST_BIT, &ct->status);
 
 	spin_lock_bh(&ct->lock);
-- 
1.7.10.4

  parent reply	other threads:[~2013-12-28 22:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-28 22:02 [PATCH 0/8] Netfilter/IPVS fixes for net Pablo Neira Ayuso
2013-12-28 22:03 ` [PATCH 1/8] netfilter: nfnetlink_log: unset nf_loggers for netns when unloading module Pablo Neira Ayuso
2013-12-28 22:03 ` [PATCH 2/8] netfilter: nft_exthdr: call ipv6_find_hdr() with explicitly initialized offset Pablo Neira Ayuso
2013-12-28 22:03 ` [PATCH 3/8] netfilter: nf_ct_timestamp: Fix BUG_ON after netns deletion Pablo Neira Ayuso
2013-12-28 22:03 ` Pablo Neira Ayuso [this message]
2013-12-28 22:03 ` [PATCH 5/8] ipvs: correct usage/allocation of seqadj ext in ipvs Pablo Neira Ayuso
2013-12-28 22:03 ` [PATCH 6/8] netfilter: nf_tables: fix dumping with large number of sets Pablo Neira Ayuso
2013-12-28 22:03 ` [PATCH 7/8] netfilter: nf_tables: fix oops when updating table with user chains Pablo Neira Ayuso
2013-12-28 22:03 ` [PATCH 8/8] netfilter: nf_tables: fix wrong datatype in nft_validate_data_load() Pablo Neira Ayuso
2013-12-29  5:29 ` [PATCH 0/8] Netfilter/IPVS fixes for net David 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=1388268187-11569-5-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@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 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).