[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <d6ec2447c0a8582b947becf448edb7cb70ca7031.1488791431.git.jslaby@suse.cz>
Date: Mon, 6 Mar 2017 10:12:06 +0100
From: Jiri Slaby <jslaby@...e.cz>
To: stable@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Daniel Borkmann <dborkman@...hat.com>,
Alexander Smirnov <alex.bluesman.smirnov@...il.com>,
Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
Werner Almesberger <werner@...esberger.net>,
"David S . Miller" <davem@...emloft.net>,
Jiri Slaby <jslaby@...e.cz>
Subject: [PATCH 3.12 102/113] net: 6lowpan: fix lowpan_header_create non-compression memcpy call
From: Daniel Borkmann <dborkman@...hat.com>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 965801e1eb624154fe5e9dc5d2ff0b7f1951a11c upstream.
In function lowpan_header_create(), we invoke the following code
construct:
struct ipv6hdr *hdr;
...
hdr = ipv6_hdr(skb);
...
if (...)
memcpy(hc06_ptr + 1, &hdr->flow_lbl[1], 2);
else
memcpy(hc06_ptr, &hdr, 4);
Where the else path of the condition, that is, non-compression
path, calls memcpy() with a pointer to struct ipv6hdr *hdr as
source, thus two levels of indirection. This cannot be correct,
and likely only one level of pointer was intended as source
buffer for memcpy() here.
Fixes: 44331fe2aa0d ("IEEE802.15.4: 6LoWPAN basic support")
Signed-off-by: Daniel Borkmann <dborkman@...hat.com>
Cc: Alexander Smirnov <alex.bluesman.smirnov@...il.com>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@...il.com>
Cc: Werner Almesberger <werner@...esberger.net>
Signed-off-by: David S. Miller <davem@...emloft.net>
Signed-off-by: Jiri Slaby <jslaby@...e.cz>
---
net/ieee802154/6lowpan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 70348be444c1..a377d435756e 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -548,7 +548,7 @@ static int lowpan_header_create(struct sk_buff *skb,
hc06_ptr += 3;
} else {
/* compress nothing */
- memcpy(hc06_ptr, &hdr, 4);
+ memcpy(hc06_ptr, hdr, 4);
/* replace the top byte with new ECN | DSCP format */
*hc06_ptr = tmp;
hc06_ptr += 4;
--
2.12.0
Powered by blists - more mailing lists