summaryrefslogtreecommitdiffstats
path: root/net/ieee802154
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2015-09-30 04:20:09 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-09-30 07:23:57 -0400
commit72d53b116264d5e570f610b3971dae4721aa5c0f (patch)
tree827f46282aae1be8cab5f4d13ed606ed3934fef6 /net/ieee802154
parent5f2ebb3b59c81a461ffd4921d12e9f6e09c32945 (diff)
ieee802154: 6lowpan: change datagram var types
This patch changes datagram size variable from u16 type to unsigned int. The reason is that an IPv6 header has an MAX_UIN16 payload length, but the datagram size is payload + IPv6 header length. This avoids overflows at some places. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/ieee802154')
-rw-r--r--net/ieee802154/6lowpan/6lowpan_i.h4
-rw-r--r--net/ieee802154/6lowpan/reassembly.c2
-rw-r--r--net/ieee802154/6lowpan/tx.c8
3 files changed, 7 insertions, 7 deletions
diff --git a/net/ieee802154/6lowpan/6lowpan_i.h b/net/ieee802154/6lowpan/6lowpan_i.h
index b4e17a7c0df0..10d44d08a440 100644
--- a/net/ieee802154/6lowpan/6lowpan_i.h
+++ b/net/ieee802154/6lowpan/6lowpan_i.h
@@ -18,7 +18,7 @@ typedef unsigned __bitwise__ lowpan_rx_result;
18 18
19struct lowpan_create_arg { 19struct lowpan_create_arg {
20 u16 tag; 20 u16 tag;
21 u16 d_size; 21 unsigned int d_size;
22 const struct ieee802154_addr *src; 22 const struct ieee802154_addr *src;
23 const struct ieee802154_addr *dst; 23 const struct ieee802154_addr *dst;
24}; 24};
@@ -29,7 +29,7 @@ struct lowpan_frag_queue {
29 struct inet_frag_queue q; 29 struct inet_frag_queue q;
30 30
31 u16 tag; 31 u16 tag;
32 u16 d_size; 32 unsigned int d_size;
33 struct ieee802154_addr saddr; 33 struct ieee802154_addr saddr;
34 struct ieee802154_addr daddr; 34 struct ieee802154_addr daddr;
35}; 35};
diff --git a/net/ieee802154/6lowpan/reassembly.c b/net/ieee802154/6lowpan/reassembly.c
index 12e8cf4bda9f..af663cb74f1f 100644
--- a/net/ieee802154/6lowpan/reassembly.c
+++ b/net/ieee802154/6lowpan/reassembly.c
@@ -37,7 +37,7 @@ static struct inet_frags lowpan_frags;
37static int lowpan_frag_reasm(struct lowpan_frag_queue *fq, 37static int lowpan_frag_reasm(struct lowpan_frag_queue *fq,
38 struct sk_buff *prev, struct net_device *ldev); 38 struct sk_buff *prev, struct net_device *ldev);
39 39
40static unsigned int lowpan_hash_frag(u16 tag, u16 d_size, 40static unsigned int lowpan_hash_frag(u16 tag, unsigned int d_size,
41 const struct ieee802154_addr *saddr, 41 const struct ieee802154_addr *saddr,
42 const struct ieee802154_addr *daddr) 42 const struct ieee802154_addr *daddr)
43{ 43{
diff --git a/net/ieee802154/6lowpan/tx.c b/net/ieee802154/6lowpan/tx.c
index 7e0563eaea98..5ecf8af7154b 100644
--- a/net/ieee802154/6lowpan/tx.c
+++ b/net/ieee802154/6lowpan/tx.c
@@ -131,8 +131,8 @@ lowpan_xmit_fragment(struct sk_buff *skb, const struct ieee802154_hdr *wpan_hdr,
131 131
132static int 132static int
133lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *ldev, 133lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *ldev,
134 const struct ieee802154_hdr *wpan_hdr, u16 dgram_size, 134 const struct ieee802154_hdr *wpan_hdr,
135 u16 dgram_offset) 135 unsigned int dgram_size, unsigned int dgram_offset)
136{ 136{
137 __be16 frag_tag; 137 __be16 frag_tag;
138 u8 frag_hdr[5]; 138 u8 frag_hdr[5];
@@ -194,7 +194,7 @@ err:
194} 194}
195 195
196static int lowpan_header(struct sk_buff *skb, struct net_device *ldev, 196static int lowpan_header(struct sk_buff *skb, struct net_device *ldev,
197 u16 *dgram_size, u16 *dgram_offset) 197 unsigned int *dgram_size, unsigned int *dgram_offset)
198{ 198{
199 struct wpan_dev *wpan_dev = lowpan_dev_info(ldev)->wdev->ieee802154_ptr; 199 struct wpan_dev *wpan_dev = lowpan_dev_info(ldev)->wdev->ieee802154_ptr;
200 struct ieee802154_addr sa, da; 200 struct ieee802154_addr sa, da;
@@ -244,7 +244,7 @@ netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *ldev)
244{ 244{
245 struct ieee802154_hdr wpan_hdr; 245 struct ieee802154_hdr wpan_hdr;
246 int max_single, ret; 246 int max_single, ret;
247 u16 dgram_size, dgram_offset; 247 unsigned int dgram_size, dgram_offset;
248 248
249 pr_debug("package xmit\n"); 249 pr_debug("package xmit\n");
250 250