mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org,
	stable-review@kernel.org
Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, Patrick McHardy <kaber@trash.net>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH 67/97] netfilter: fix crashes in bridge netfilter caused by fragment jumps
Date: Mon,  4 Jan 2010 16:33:20 -0800	[thread overview]
Message-ID: <1262651630-7354-67-git-send-email-gregkh@suse.de> (raw)
In-Reply-To: <20100105003133.GA7199@kroah.com>

From: Patrick McHardy <kaber@trash.net>

commit 8fa9ff6849bb86c59cc2ea9faadf3cb2d5223497 upstream.

When fragments from bridge netfilter are passed to IPv4 or IPv6 conntrack
and a reassembly queue with the same fragment key already exists from
reassembling a similar packet received on a different device (f.i. with
multicasted fragments), the reassembled packet might continue on a different
codepath than where the head fragment originated. This can cause crashes
in bridge netfilter when a fragment received on a non-bridge device (and
thus with skb->nf_bridge == NULL) continues through the bridge netfilter
code.

Add a new reassembly identifier for packets originating from bridge
netfilter and use it to put those packets in insolated queues.

Fixes http://bugzilla.kernel.org/show_bug.cgi?id=14805

Reported-and-Tested-by: Chong Qiao <qiaochong@loongson.cn>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 include/net/ip.h                               |    1 +
 include/net/ipv6.h                             |    1 +
 net/ipv4/netfilter/nf_defrag_ipv4.c            |   21 +++++++++++++++++----
 net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c |    6 ++++++
 4 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/include/net/ip.h b/include/net/ip.h
index 2f47e54..69db943 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -342,6 +342,7 @@ enum ip_defrag_users
 	IP_DEFRAG_CALL_RA_CHAIN,
 	IP_DEFRAG_CONNTRACK_IN,
 	IP_DEFRAG_CONNTRACK_OUT,
+	IP_DEFRAG_CONNTRACK_BRIDGE_IN,
 	IP_DEFRAG_VS_IN,
 	IP_DEFRAG_VS_OUT,
 	IP_DEFRAG_VS_FWD
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index a496499..639bbf0 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -358,6 +358,7 @@ enum ip6_defrag_users {
 	IP6_DEFRAG_LOCAL_DELIVER,
 	IP6_DEFRAG_CONNTRACK_IN,
 	IP6_DEFRAG_CONNTRACK_OUT,
+	IP6_DEFRAG_CONNTRACK_BRIDGE_IN,
 };
 
 struct ip6_create_arg {
diff --git a/net/ipv4/netfilter/nf_defrag_ipv4.c b/net/ipv4/netfilter/nf_defrag_ipv4.c
index fa2d6b6..331ead3 100644
--- a/net/ipv4/netfilter/nf_defrag_ipv4.c
+++ b/net/ipv4/netfilter/nf_defrag_ipv4.c
@@ -14,6 +14,7 @@
 #include <net/route.h>
 #include <net/ip.h>
 
+#include <linux/netfilter_bridge.h>
 #include <linux/netfilter_ipv4.h>
 #include <net/netfilter/ipv4/nf_defrag_ipv4.h>
 
@@ -34,6 +35,20 @@ static int nf_ct_ipv4_gather_frags(struct sk_buff *skb, u_int32_t user)
 	return err;
 }
 
+static enum ip_defrag_users nf_ct_defrag_user(unsigned int hooknum,
+					      struct sk_buff *skb)
+{
+#ifdef CONFIG_BRIDGE_NETFILTER
+	if (skb->nf_bridge &&
+	    skb->nf_bridge->mask & BRNF_NF_BRIDGE_PREROUTING)
+		return IP_DEFRAG_CONNTRACK_BRIDGE_IN;
+#endif
+	if (hooknum == NF_INET_PRE_ROUTING)
+		return IP_DEFRAG_CONNTRACK_IN;
+	else
+		return IP_DEFRAG_CONNTRACK_OUT;
+}
+
 static unsigned int ipv4_conntrack_defrag(unsigned int hooknum,
 					  struct sk_buff *skb,
 					  const struct net_device *in,
@@ -50,10 +65,8 @@ static unsigned int ipv4_conntrack_defrag(unsigned int hooknum,
 #endif
 	/* Gather fragments. */
 	if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
-		if (nf_ct_ipv4_gather_frags(skb,
-					    hooknum == NF_INET_PRE_ROUTING ?
-					    IP_DEFRAG_CONNTRACK_IN :
-					    IP_DEFRAG_CONNTRACK_OUT))
+		enum ip_defrag_users user = nf_ct_defrag_user(hooknum, skb);
+		if (nf_ct_ipv4_gather_frags(skb, user))
 			return NF_STOLEN;
 	}
 	return NF_ACCEPT;
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index c0a82fe..0956eba 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -20,6 +20,7 @@
 #include <net/ipv6.h>
 #include <net/inet_frag.h>
 
+#include <linux/netfilter_bridge.h>
 #include <linux/netfilter_ipv6.h>
 #include <net/netfilter/nf_conntrack.h>
 #include <net/netfilter/nf_conntrack_helper.h>
@@ -190,6 +191,11 @@ out:
 static enum ip6_defrag_users nf_ct6_defrag_user(unsigned int hooknum,
 						struct sk_buff *skb)
 {
+#ifdef CONFIG_BRIDGE_NETFILTER
+	if (skb->nf_bridge &&
+	    skb->nf_bridge->mask & BRNF_NF_BRIDGE_PREROUTING)
+		return IP6_DEFRAG_CONNTRACK_BRIDGE_IN;
+#endif
 	if (hooknum == NF_INET_PRE_ROUTING)
 		return IP6_DEFRAG_CONNTRACK_IN;
 	else
-- 
1.6.6


  parent reply	other threads:[~2010-01-05  0:35 UTC|newest]

Thread overview: 123+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-05  0:31 [00/97] 2.6.32.3 stable review Greg KH
2010-01-05  0:32 ` [PATCH 01/97] SCSI: ipr: fix EEH recovery Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 02/97] SCSI: qla2xxx: dpc thread can execute before scsi host has been added Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 03/97] SCSI: st: fix mdata->page_order handling Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 04/97] SCSI: fc class: fix fc_transport_init error handling Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 05/97] sched: Fix task_hot() test order Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 06/97] x86, cpuid: Add "volatile" to asm in native_cpuid() Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 07/97] sched: Select_task_rq_fair() must honour SD_LOAD_BALANCE Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 08/97] clockevents: Prevent clockevent_devices list corruption on cpu hotplug Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 09/97] pata_hpt3x2n: fix clock turnaround Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 10/97] pata_cmd64x: fix overclocking of UDMA0-2 modes Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 11/97] ASoC: wm8974: fix a wrong bit definition Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 12/97] sound: sgio2audio/pdaudiocf/usb-audio: initialize PCM buffer Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 13/97] ALSA: hda - Fix missing capsrc_nids for ALC88x Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 14/97] acerhdf: limit modalias matching to supported Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 15/97] ACPI: EC: Fix MSI DMI detection Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 16/97] ACPI: Use the return result of ACPI lid notifier chain correctly Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 17/97] powerpc: Handle VSX alignment faults correctly in little-endian mode Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 18/97] ASoC: Do not write to invalid registers on the wm9712 Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 19/97] drm/radeon: fix build on 64-bit with some compilers Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 20/97] USB: emi62: fix crash when trying to load EMI 6|2 firmware Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 21/97] USB: option: support hi speed for modem Haier CE100 Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 22/97] USB: Fix a bug on appledisplay.c regarding signedness Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 23/97] USB: musb: gadget_ep0: avoid SetupEnd interrupt Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 24/97] Bluetooth: Prevent ill-timed autosuspend in USB driver Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 25/97] USB: rename usb_configure_device Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 26/97] USB: fix bugs in usb_(de)authorize_device Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 27/97] drivers/net/usb: Correct code taking the size of a pointer Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 28/97] x86: SGI UV: Fix writes to led registers on remote uv hubs Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 29/97] md: Fix unfortunate interaction with evms Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 30/97] dma: at_hdmac: correct incompatible type for argument 1 of 'spin_lock_bh' Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 31/97] dma-debug: Do not add notifier when dma debugging is disabled Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 32/97] dma-debug: Fix bug causing build warning Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 33/97] cifs: NULL out tcon, pSesInfo, and srvTcp pointers when chasing DFS referrals Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 34/97] x86/amd-iommu: Fix initialization failure panic Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 35/97] ioat3: fix p-disabled q-continuation Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 36/97] ioat2,3: put channel hardware in known state at init Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 37/97] KVM: MMU: remove prefault from invlpg handler Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 38/97] KVM: LAPIC: make sure IRR bitmap is scanned after vm load Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 39/97] Libertas: fix buffer overflow in lbs_get_essid() Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 40/97] iwmc3200wifi: fix array out-of-boundary access Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 41/97] mac80211: fix propagation of failed hardware reconfigurations Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 42/97] mac80211: fix WMM AP settings application Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 43/97] mac80211: Fix IBSS merge Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 44/97] cfg80211: fix race between deauth and assoc response Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 45/97] ath5k: fix SWI calibration interrupt storm Greg Kroah-Hartman
2010-01-05  0:32 ` [PATCH 46/97] ath9k: wake hardware for interface IBSS/AP/Mesh removal Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 47/97] ath9k: Fix TX queue draining Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 48/97] ath9k: fix missed error codes in the tx status check Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 49/97] ath9k: wake hardware during AMPDU TX actions Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 50/97] ath9k: fix suspend by waking device prior to stop Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 51/97] ath9k_hw: Fix possible OOB array indexing in gen_timer_index[] on 64-bit Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 52/97] ath9k_hw: Fix AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB and its shift value in 0x4054 Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 53/97] iwl3945: disable power save Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 54/97] iwl3945: fix panic in iwl3945 driver Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 55/97] iwlwifi: fix EEPROM/OTP reading endian annotations and a bug Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 56/97] iwlwifi: fix more eeprom endian bugs Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 57/97] iwlwifi: fix 40MHz operation setting on cards that do not allow it Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 58/97] mac80211: fix race with suspend and dynamic_ps_disable_work Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 59/97] NOMMU: Optimise away the {dac_,}mmap_min_addr tests Greg Kroah-Hartman
2010-01-07  2:03   ` Mike Frysinger
2010-01-07 17:58     ` Greg KH
2010-01-08  5:40       ` [PATCH] kernel/sysctl.c: fix stable merge error in NOMMU mmap_min_addr Mike Frysinger
2010-01-05  0:33 ` [PATCH 60/97] 'sysctl_max_map_count' should be non-negative Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 61/97] kernel/sysctl.c: fix the incomplete part of sysctl_max_map_count-should-be-non-negative.patch Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 62/97] V4L/DVB (13596): ov511.c typo: lock => unlock Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 63/97] x86/ptrace: make genregs[32]_get/set more robust Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 64/97] memcg: avoid oom-killing innocent task in case of use_hierarchy Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 65/97] e100: Fix broken cbs accounting due to missing memset Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 66/97] ipv6: reassembly: use seperate reassembly queues for conntrack and local delivery Greg Kroah-Hartman
2010-01-05  0:33 ` Greg Kroah-Hartman [this message]
2010-01-05  0:33 ` [PATCH 68/97] hwmon: (sht15) Off-by-one error in array index + incorrect constants Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 69/97] b43: avoid PPC fault during resume Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 70/97] Keys: KEYCTL_SESSION_TO_PARENT needs TIF_NOTIFY_RESUME architecture support Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 71/97] sched: Fix balance vs hotplug race Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 72/97] drm/radeon/kms: fix crtc vblank update for r600 Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 73/97] drm: disable all the possible outputs/crtcs before entering KMS mode Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 74/97] S390: dasd: support DIAG access for read-only devices Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 75/97] xen: fix is_disconnected_device/exists_disconnected_device Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 76/97] xen: improvement to wait_for_devices() Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 77/97] xen: wait up to 5 minutes for device connetion Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 78/97] orinoco: fix GFP_KERNEL in orinoco_set_key with interrupts disabled Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 79/97] udf: Try harder when looking for VAT inode Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 80/97] Add unlocked version of inode_add_bytes() function Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 81/97] quota: decouple fs reserved space from quota reservation Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 82/97] ext4: Convert to generic reserved quota's space management Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 83/97] ext4: Fix potential quota deadlock Greg Kroah-Hartman
2010-01-05  0:47   ` Jan Kara
2010-01-05 18:56     ` Greg KH
2010-01-05 21:39       ` Jan Kara
2010-01-05 23:16         ` Greg KH
2010-01-06  5:20           ` tytso
2010-01-06 10:43             ` Jan Kara
2010-01-06 18:27             ` [stable] " Greg KH
2010-01-06 19:55               ` Jan Kara
2010-01-05  0:33 ` [PATCH 84/97] ext4: fix sleep inside spinlock issue with quota and dealloc (#14739) Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 85/97] x86, msr: Unify rdmsr_on_cpus/wrmsr_on_cpus Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 86/97] cpumask: use modern cpumask style in drivers/edac/amd64_edac.c Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 87/97] amd64_edac: unify MCGCTL ECC switching Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 88/97] x86, msr: Add support for non-contiguous cpumasks Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 89/97] x86, msr: msrs_alloc/free for CONFIG_SMP=n Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 90/97] amd64_edac: fix driver instance freeing Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 91/97] amd64_edac: make driver loading more robust Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 92/97] amd64_edac: fix forcing module load/unload Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 93/97] sched: Sched_rt_periodic_timer vs cpu hotplug Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 94/97] ext4: Update documentation to correct the inode_readahead_blks option name Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 95/97] lguest: fix bug in setting guest GDT entry Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 96/97] vmscan: do not evict inactive pages when skipping an active list scan Greg Kroah-Hartman
2010-01-05  0:33 ` [PATCH 97/97] Linux 2.6.32.3-rc1 Greg Kroah-Hartman
2010-01-05  1:13   ` [Stable-review] " Jake Edge
2010-01-05 14:58     ` Greg KH
2010-01-05 15:10       ` Jake Edge
2010-01-05 15:26         ` Greg KH
2010-01-05  0:55 ` [Stable-review] [00/97] 2.6.32.3 stable review Luis R. Rodriguez
2010-01-05 18:56   ` Greg KH
2010-01-05 10:26 ` Hugh Dickins
2010-01-05 18:53   ` Greg KH
2010-01-05 19:20 ` Greg KH
2010-01-05 19:21   ` [PATCH 098/101] ksm: fix mlockfreed to munlocked Greg Kroah-Hartman
2010-01-05 19:21     ` [PATCH 099/101] rt2x00: Disable powersaving for rt61pci and rt2800pci Greg Kroah-Hartman
2010-01-05 19:21       ` [PATCH 100/101] generic_permission: MAY_OPEN is not write access Greg Kroah-Hartman
2010-01-05 19:21         ` [PATCH 101/101] Linux 2.6.32.3-rc2 Greg Kroah-Hartman
2010-01-05 20:54       ` [PATCH 099/101] rt2x00: Disable powersaving for rt61pci and rt2800pci Gertjan van Wingerde

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=1262651630-7354-67-git-send-email-gregkh@suse.de \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=kaber@trash.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable-review@kernel.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.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

Powered by JetHome