mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luis Henriques <luis.henriques@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	kernel-team@lists.ubuntu.com
Cc: Daniel Borkmann <dborkman@redhat.com>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Luis Henriques <luis.henriques@canonical.com>
Subject: [PATCH 3.11 02/46] netfilter: nf_conntrack_dccp: fix skb_header_pointer API usages
Date: Wed, 16 Apr 2014 11:31:18 +0100	[thread overview]
Message-ID: <1397644322-13905-3-git-send-email-luis.henriques@canonical.com> (raw)
In-Reply-To: <1397644322-13905-1-git-send-email-luis.henriques@canonical.com>

3.11.10.8 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Daniel Borkmann <dborkman@redhat.com>

commit b22f5126a24b3b2f15448c3f2a254fc10cbc2b92 upstream.

Some occurences in the netfilter tree use skb_header_pointer() in
the following way ...

  struct dccp_hdr _dh, *dh;
  ...
  skb_header_pointer(skb, dataoff, sizeof(_dh), &dh);

... where dh itself is a pointer that is being passed as the copy
buffer. Instead, we need to use &_dh as the forth argument so that
we're copying the data into an actual buffer that sits on the stack.

Currently, we probably could overwrite memory on the stack (e.g.
with a possibly mal-formed DCCP packet), but unintentionally, as
we only want the buffer to be placed into _dh variable.

Fixes: 2bc780499aa3 ("[NETFILTER]: nf_conntrack: add DCCP protocol support")
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/nf_conntrack_proto_dccp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/netfilter/nf_conntrack_proto_dccp.c b/net/netfilter/nf_conntrack_proto_dccp.c
index a99b6c3..59359be 100644
--- a/net/netfilter/nf_conntrack_proto_dccp.c
+++ b/net/netfilter/nf_conntrack_proto_dccp.c
@@ -428,7 +428,7 @@ static bool dccp_new(struct nf_conn *ct, const struct sk_buff *skb,
 	const char *msg;
 	u_int8_t state;
 
-	dh = skb_header_pointer(skb, dataoff, sizeof(_dh), &dh);
+	dh = skb_header_pointer(skb, dataoff, sizeof(_dh), &_dh);
 	BUG_ON(dh == NULL);
 
 	state = dccp_state_table[CT_DCCP_ROLE_CLIENT][dh->dccph_type][CT_DCCP_NONE];
@@ -486,7 +486,7 @@ static int dccp_packet(struct nf_conn *ct, const struct sk_buff *skb,
 	u_int8_t type, old_state, new_state;
 	enum ct_dccp_roles role;
 
-	dh = skb_header_pointer(skb, dataoff, sizeof(_dh), &dh);
+	dh = skb_header_pointer(skb, dataoff, sizeof(_dh), &_dh);
 	BUG_ON(dh == NULL);
 	type = dh->dccph_type;
 
@@ -577,7 +577,7 @@ static int dccp_error(struct net *net, struct nf_conn *tmpl,
 	unsigned int cscov;
 	const char *msg;
 
-	dh = skb_header_pointer(skb, dataoff, sizeof(_dh), &dh);
+	dh = skb_header_pointer(skb, dataoff, sizeof(_dh), &_dh);
 	if (dh == NULL) {
 		msg = "nf_ct_dccp: short packet ";
 		goto out_invalid;
-- 
1.9.1


  parent reply	other threads:[~2014-04-16 10:32 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 01/46] Input: cypress_ps2 - don't report as a button pads Luis Henriques
2014-04-16 10:31 ` Luis Henriques [this message]
2014-04-16 10:31 ` [PATCH 3.11 03/46] cpufreq: Fix timer/workqueue corruption due to double queueing Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 04/46] futex: Allow architectures to skip futex_atomic_cmpxchg_inatomic() test Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 05/46] m68k: Skip " Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 06/46] powernow-k6: disable cache when changing frequency Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 07/46] powernow-k6: correctly initialize default parameters Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 08/46] powernow-k6: reorder frequencies Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 09/46] selinux: correctly label /proc inodes in use before the policy is loaded Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 10/46] net: fix for a race condition in the inet frag code Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 11/46] net: sctp: fix skb leakage in COOKIE ECHO path of chunk->auth_chunk Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 12/46] bridge: multicast: add sanity check for query source addresses Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 13/46] inet: frag: make sure forced eviction removes all frags Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 14/46] net: unix: non blocking recvmsg() should not return -EINTR Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 15/46] ipv6: Fix exthdrs offload registration Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 16/46] ipv6: don't set DST_NOCOUNT for remotely added routes Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 17/46] vlan: Set correct source MAC address with TX VLAN offload enabled Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 18/46] tcp: tcp_release_cb() should release socket ownership Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 19/46] net: socket: error on a negative msg_namelen Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 20/46] ipv6: Avoid unnecessary temporary addresses being generated Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 21/46] ipv6: ip6_append_data_mtu do not handle the mtu of the second fragment properly Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 22/46] vxlan: fix potential NULL dereference in arp_reduce() Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 23/46] rtnetlink: fix fdb notification flags Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 24/46] ipmr: fix mfc " Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 25/46] ip6mr: " Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 26/46] netpoll: fix the skb check in pkt_is_ns Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 27/46] tg3: Do not include vlan acceleration features in vlan_features Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 28/46] usbnet: include wait queue head in device structure Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 29/46] vlan: Set hard_header_len according to available acceleration Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 30/46] vhost: fix total length when packets are too short Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 31/46] vhost: validate vhost_get_vq_desc return value Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 32/46] xen-netback: remove pointless clause from if statement Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 33/46] ipv6: some ipv6 statistic counters failed to disable bh Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 34/46] netlink: don't compare the nul-termination in nla_strcmp Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 35/46] isdnloop: Validate NUL-terminated strings from user Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 36/46] isdnloop: several buffer overflows Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 37/46] rds: prevent dereference of a NULL device in rds_iw_laddr_check Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 38/46] cpuidle: Check the result of cpuidle_get_driver() against NULL Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 39/46] sparc: PCI: Fix incorrect address calculation of PCI Bridge windows on Simba-bridges Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 40/46] Revert "sparc64: Fix __copy_{to,from}_user_inatomic defines." Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 41/46] sparc32: fix build failure for arch_jump_label_transform Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 42/46] sparc64: don't treat 64-bit syscall return codes as 32-bit Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 43/46] sparc64: Make sure %pil interrupts are enabled during hypervisor yield Luis Henriques
2014-04-16 10:32 ` [PATCH 3.11 44/46] netfilter: nf_conntrack: reserve two bytes for nf_ct_ext->len Luis Henriques
2014-04-16 10:32 ` [PATCH 3.11 45/46] netfilter: Can't fail and free after table replacement Luis Henriques
2014-04-16 10:32 ` [PATCH 3.11 46/46] crypto: ghash-clmulni-intel - use C implementation for setkey() Luis Henriques

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=1397644322-13905-3-git-send-email-luis.henriques@canonical.com \
    --to=luis.henriques@canonical.com \
    --cc=dborkman@redhat.com \
    --cc=kernel-team@lists.ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=stable@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

all inboxes | Powered by JetHome®