net: 6lowpan: fix lowpan_header_create non-compression memcpy call
authorDaniel Borkmann <dborkman@redhat.com>
Mon, 6 Jan 2014 00:45:50 +0000 (01:45 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 7 Jun 2017 22:47:00 +0000 (00:47 +0200)
commit3ac993d473612d4830646fc5dfa25fb542aa40f1
treedd5966e6e7596ad8a9e8e04918597eec3878f7f6
parentc4c175dbd7c40e14393a83065edc14f147c5a087
net: 6lowpan: fix lowpan_header_create non-compression memcpy call

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@redhat.com>
Cc: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Werner Almesberger <werner@almesberger.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
net/ieee802154/6lowpan.c