Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1396667

[PATCH 3.14 12/23] batman-adv: Check skb size before using encapsulated ETH+VLAN header

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 3.14 12/23] batman-adv: Check skb size before using encapsulated ETH+VLAN header
Date 2016-05-09 09:20 +0200
Message-ID <rwNE0-8jo-59@gated-at.bofh.it> (permalink)
References <rwNDX-8jo-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

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

From: Sven Eckelmann <sven@narfation.org>

commit c78296665c3d81f040117432ab9e1cb125521b0c upstream.

The encapsulated ethernet and VLAN header may be outside the received
ethernet frame. Thus the skb buffer size has to be checked before it can be
parsed to find out if it encapsulates another batman-adv packet.

Fixes: 420193573f11 ("batman-adv: softif bridge loop avoidance")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/batman-adv/soft-interface.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -356,11 +356,17 @@ void batadv_interface_rx(struct net_devi
 	 */
 	nf_reset(skb);
 
+	if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
+		goto dropped;
+
 	vid = batadv_get_vid(skb, 0);
 	ethhdr = eth_hdr(skb);
 
 	switch (ntohs(ethhdr->h_proto)) {
 	case ETH_P_8021Q:
+		if (!pskb_may_pull(skb, VLAN_ETH_HLEN))
+			goto dropped;
+
 		vhdr = (struct vlan_ethhdr *)skb->data;
 
 		if (vhdr->h_vlan_encapsulated_proto != ethertype)
@@ -372,8 +378,6 @@ void batadv_interface_rx(struct net_devi
 	}
 
 	/* skb->dev & skb->pkt_type are set here */
-	if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
-		goto dropped;
 	skb->protocol = eth_type_trans(skb, soft_iface);
 
 	/* should not be necessary anymore as we use skb_pull_rcsum()

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3.14 00/23] 3.14.69-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 09:20 +0200
  [PATCH 3.14 21/23] iio: ak8975: Fix NULL pointer exception on early interrupt Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 09:20 +0200
  [PATCH 3.14 07/23] lpfc: fix misleading indentation Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 09:20 +0200
  [PATCH 3.14 04/23] ipvs: correct initial offset of Call-ID header search in SIP persistence engine Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 09:20 +0200
  [PATCH 3.14 22/23] Input: ads7846 - correct the value got from SPI Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 09:20 +0200
  [PATCH 3.14 01/23] compiler-gcc: integrate the various compiler-gcc[345].h files Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 09:20 +0200
    Re: [PATCH 3.14 01/23] compiler-gcc: integrate the various  compiler-gcc[345].h files Jiri Slaby <jslaby@suse.cz> - 2016-05-11 11:30 +0200
  [PATCH 3.14 20/23] USB: serial: cp210x: add Straizona Focusers device ids Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 09:20 +0200
  [PATCH 3.14 16/23] x86/tsc: Read all ratio bits from MSR_PLATFORM_INFO Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 09:20 +0200
  [PATCH 3.14 23/23] powerpc: scan_features() updates incorrect bits for REAL_LE Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 09:20 +0200
  [PATCH 3.14 19/23] USB: serial: cp210x: add ID for Link ECU Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 09:20 +0200
  [PATCH 3.14 12/23] batman-adv: Check skb size before using encapsulated ETH+VLAN header Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 09:20 +0200
  [PATCH 3.14 10/23] Input: zforce_ts - fix dual touch recognition Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 09:20 +0200
  [PATCH 3.14 09/23] ARM: SoCFPGA: Fix secondary CPU startup in thumb2 kernel Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 10:00 +0200
  [PATCH 3.14 18/23] ACPICA: Dispatcher: Update thread ID for recursive method calls Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 10:10 +0200
  [PATCH 3.14 15/23] MAINTAINERS: Remove asterisk from EFI directory names Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 10:10 +0200
  [PATCH 3.14 11/23] proc: prevent accessing /proc/<PID>/environ until its ready Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 10:10 +0200
  [PATCH 3.14 08/23] tracing: Dont display trigger file for events that cant be enabled Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 10:10 +0200
  [PATCH 3.14 17/23] x86/sysfb_efi: Fix valid BAR address range check Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 10:10 +0200
  [PATCH 3.14 05/23] nbd: ratelimit error msgs after socket close Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 10:10 +0200
  [PATCH 3.14 02/23] compiler-gcc: disable -ftracer for __noclone functions Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-09 10:10 +0200
  Re: [PATCH 3.14 00/23] 3.14.69-stable review Guenter Roeck <linux@roeck-us.net> - 2016-05-09 15:30 +0200
  Re: [PATCH 3.14 00/23] 3.14.69-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2016-05-09 21:50 +0200

csiph-web