Linux IEEE 802.15.4 and 6LoWPAN development
 help / color / mirror / Atom feed
* [PATCHv2 bluetooth 0/5] mac802154: ieee802154: stable patches
@ 2014-08-19 17:03 Alexander Aring
  2014-08-19 17:03 ` [PATCHv2 bluetooth 1/5] mac802154: fixed potential skb leak with mac802154_parse_frame_start Alexander Aring
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Alexander Aring @ 2014-08-19 17:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: marcel, linux-wpan, kernel, Alexander Aring

Hi Marcel,

these patches contains patches for the bluetooth branch.

This series includes memory leak fixes and an errno value fix.
Also there are two patches for sending and receiving 1280 6LoWPAN packets,
which makes the IEEE 802.15.4 6LoWPAN stack more RFC compliant.

- Alex

changes v2:
 - remove ieee802154_lowpan in lowpan_frag_rcv to avoid compiler warning

Alexander Aring (2):
  ieee802154: 6lowpan_rtnl: fix correct errno value
  ieee802154: 6lowpan: ensure of sending 1280 packets

Martin Townsend (3):
  mac802154: fixed potential skb leak with mac802154_parse_frame_start
  ieee802154: mac802154: handle the reserved dest mode by dropping the
    packet
  ieee802154: 6lowpan: ensure MTU of 1280 for 6lowpan

 include/net/netns/ieee802154_6lowpan.h |  1 -
 net/ieee802154/6lowpan_rtnl.c          |  4 ++--
 net/ieee802154/reassembly.c            | 15 +++------------
 net/mac802154/wpan.c                   |  6 +++++-
 4 files changed, 10 insertions(+), 16 deletions(-)

-- 
2.0.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCHv2 bluetooth 1/5] mac802154: fixed potential skb leak with mac802154_parse_frame_start
  2014-08-19 17:03 [PATCHv2 bluetooth 0/5] mac802154: ieee802154: stable patches Alexander Aring
@ 2014-08-19 17:03 ` Alexander Aring
  2014-08-19 17:03 ` [PATCHv2 bluetooth 2/5] ieee802154: 6lowpan_rtnl: fix correct errno value Alexander Aring
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Aring @ 2014-08-19 17:03 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: marcel, linux-wpan, kernel, Martin Townsend, Alexander Aring

From: Martin Townsend <martin.townsend@xsilon.com>

This patch fix a memory leak if received frame was not able to parse.

Signed-off-by: Martin Townsend <martin.townsend@xsilon.com>
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/mac802154/wpan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c
index 3c3069f..4c13323 100644
--- a/net/mac802154/wpan.c
+++ b/net/mac802154/wpan.c
@@ -573,6 +573,7 @@ void mac802154_wpans_rx(struct mac802154_priv *priv, struct sk_buff *skb)
 	ret = mac802154_parse_frame_start(skb, &hdr);
 	if (ret) {
 		pr_debug("got invalid frame\n");
+		kfree_skb(skb);
 		return;
 	}
 
-- 
2.0.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCHv2 bluetooth 2/5] ieee802154: 6lowpan_rtnl: fix correct errno value
  2014-08-19 17:03 [PATCHv2 bluetooth 0/5] mac802154: ieee802154: stable patches Alexander Aring
  2014-08-19 17:03 ` [PATCHv2 bluetooth 1/5] mac802154: fixed potential skb leak with mac802154_parse_frame_start Alexander Aring
@ 2014-08-19 17:03 ` Alexander Aring
  2014-08-19 17:03 ` [PATCHv2 bluetooth 3/5] ieee802154: mac802154: handle the reserved dest mode by dropping the packet Alexander Aring
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Aring @ 2014-08-19 17:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: marcel, linux-wpan, kernel, Alexander Aring

This patch correct the return value of lowpan_alloc_frag if an error
occur. Errno numbers should always be negative.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/ieee802154/6lowpan_rtnl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ieee802154/6lowpan_rtnl.c b/net/ieee802154/6lowpan_rtnl.c
index 016b77e..71fa7d4 100644
--- a/net/ieee802154/6lowpan_rtnl.c
+++ b/net/ieee802154/6lowpan_rtnl.c
@@ -246,7 +246,7 @@ lowpan_alloc_frag(struct sk_buff *skb, int size,
 			return ERR_PTR(-rc);
 		}
 	} else {
-		frag = ERR_PTR(ENOMEM);
+		frag = ERR_PTR(-ENOMEM);
 	}
 
 	return frag;
-- 
2.0.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCHv2 bluetooth 3/5] ieee802154: mac802154: handle the reserved dest mode by dropping the packet
  2014-08-19 17:03 [PATCHv2 bluetooth 0/5] mac802154: ieee802154: stable patches Alexander Aring
  2014-08-19 17:03 ` [PATCHv2 bluetooth 1/5] mac802154: fixed potential skb leak with mac802154_parse_frame_start Alexander Aring
  2014-08-19 17:03 ` [PATCHv2 bluetooth 2/5] ieee802154: 6lowpan_rtnl: fix correct errno value Alexander Aring
@ 2014-08-19 17:03 ` Alexander Aring
  2014-08-19 17:03 ` [PATCHv2 bluetooth 4/5] ieee802154: 6lowpan: ensure of sending 1280 packets Alexander Aring
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Aring @ 2014-08-19 17:03 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: marcel, linux-wpan, kernel, Martin Townsend, Alexander Aring

From: Martin Townsend <martin.townsend@xsilon.com>

If received frame contains the reserved destination address mode. The
frame should be dropped and free the skb.

Signed-off-by: Martin Townsend <martin.townsend@xsilon.com>
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/mac802154/wpan.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c
index 4c13323..5478388 100644
--- a/net/mac802154/wpan.c
+++ b/net/mac802154/wpan.c
@@ -462,7 +462,10 @@ mac802154_subif_frame(struct mac802154_sub_if_data *sdata, struct sk_buff *skb,
 			skb->pkt_type = PACKET_OTHERHOST;
 		break;
 	default:
-		break;
+		spin_unlock_bh(&sdata->mib_lock);
+		pr_debug("invalid dest mode\n");
+		kfree_skb(skb);
+		return NET_RX_DROP;
 	}
 
 	spin_unlock_bh(&sdata->mib_lock);
-- 
2.0.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCHv2 bluetooth 4/5] ieee802154: 6lowpan: ensure of sending 1280 packets
  2014-08-19 17:03 [PATCHv2 bluetooth 0/5] mac802154: ieee802154: stable patches Alexander Aring
                   ` (2 preceding siblings ...)
  2014-08-19 17:03 ` [PATCHv2 bluetooth 3/5] ieee802154: mac802154: handle the reserved dest mode by dropping the packet Alexander Aring
@ 2014-08-19 17:03 ` Alexander Aring
  2014-08-19 17:03 ` [PATCHv2 bluetooth 5/5] ieee802154: 6lowpan: ensure MTU of 1280 for 6lowpan Alexander Aring
  2014-08-19 17:20 ` [PATCHv2 bluetooth 0/5] mac802154: ieee802154: stable patches Marcel Holtmann
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Aring @ 2014-08-19 17:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: marcel, linux-wpan, kernel, Alexander Aring

This patch changes the 1281 MTU to 1280. Others stack have only a 1280
byte array for uncompressed 6LoWPAN packets, this avoid that these
stacks have an overflow. Sending 1281 uncompressed 6LoWPAN packets isn't
also rfc complaint.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/ieee802154/6lowpan_rtnl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ieee802154/6lowpan_rtnl.c b/net/ieee802154/6lowpan_rtnl.c
index 71fa7d4..6591d27 100644
--- a/net/ieee802154/6lowpan_rtnl.c
+++ b/net/ieee802154/6lowpan_rtnl.c
@@ -437,7 +437,7 @@ static void lowpan_setup(struct net_device *dev)
 	/* Frame Control + Sequence Number + Address fields + Security Header */
 	dev->hard_header_len	= 2 + 1 + 20 + 14;
 	dev->needed_tailroom	= 2; /* FCS */
-	dev->mtu		= 1281;
+	dev->mtu		= IPV6_MIN_MTU;
 	dev->tx_queue_len	= 0;
 	dev->flags		= IFF_BROADCAST | IFF_MULTICAST;
 	dev->watchdog_timeo	= 0;
-- 
2.0.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCHv2 bluetooth 5/5] ieee802154: 6lowpan: ensure MTU of 1280 for 6lowpan
  2014-08-19 17:03 [PATCHv2 bluetooth 0/5] mac802154: ieee802154: stable patches Alexander Aring
                   ` (3 preceding siblings ...)
  2014-08-19 17:03 ` [PATCHv2 bluetooth 4/5] ieee802154: 6lowpan: ensure of sending 1280 packets Alexander Aring
@ 2014-08-19 17:03 ` Alexander Aring
  2014-08-19 17:20 ` [PATCHv2 bluetooth 0/5] mac802154: ieee802154: stable patches Marcel Holtmann
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Aring @ 2014-08-19 17:03 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: marcel, linux-wpan, kernel, Martin Townsend, Alexander Aring

From: Martin Townsend <martin.townsend@xsilon.com>

This patch drops the userspace accessable sysfs entry for the maximum
datagram size of a 6LoWPAN fragment packet.

A fragment should not have a datagram size value greater than 1280 byte.
Instead of make this value configurable, we accept 1280 datagram size
fragment packets only.

Signed-off-by: Martin Townsend <martin.townsend@xsilon.com>
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 include/net/netns/ieee802154_6lowpan.h |  1 -
 net/ieee802154/reassembly.c            | 15 +++------------
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/include/net/netns/ieee802154_6lowpan.h b/include/net/netns/ieee802154_6lowpan.h
index e207096..8170f8d 100644
--- a/include/net/netns/ieee802154_6lowpan.h
+++ b/include/net/netns/ieee802154_6lowpan.h
@@ -16,7 +16,6 @@ struct netns_sysctl_lowpan {
 struct netns_ieee802154_lowpan {
 	struct netns_sysctl_lowpan sysctl;
 	struct netns_frags	frags;
-	int			max_dsize;
 };
 
 #endif
diff --git a/net/ieee802154/reassembly.c b/net/ieee802154/reassembly.c
index ffec6ce..32755cb 100644
--- a/net/ieee802154/reassembly.c
+++ b/net/ieee802154/reassembly.c
@@ -355,8 +355,6 @@ int lowpan_frag_rcv(struct sk_buff *skb, const u8 frag_type)
 	struct net *net = dev_net(skb->dev);
 	struct lowpan_frag_info *frag_info = lowpan_cb(skb);
 	struct ieee802154_addr source, dest;
-	struct netns_ieee802154_lowpan *ieee802154_lowpan =
-		net_ieee802154_lowpan(net);
 	int err;
 
 	source = mac_cb(skb)->source;
@@ -366,8 +364,10 @@ int lowpan_frag_rcv(struct sk_buff *skb, const u8 frag_type)
 	if (err < 0)
 		goto err;
 
-	if (frag_info->d_size > ieee802154_lowpan->max_dsize)
+	if (frag_info->d_size > IPV6_MIN_MTU) {
+		net_warn_ratelimited("lowpan_frag_rcv: datagram size exceeds MTU\n");
 		goto err;
+	}
 
 	fq = fq_find(net, frag_info, &source, &dest);
 	if (fq != NULL) {
@@ -415,13 +415,6 @@ static struct ctl_table lowpan_frags_ns_ctl_table[] = {
 		.mode		= 0644,
 		.proc_handler	= proc_dointvec_jiffies,
 	},
-	{
-		.procname	= "6lowpanfrag_max_datagram_size",
-		.data		= &init_net.ieee802154_lowpan.max_dsize,
-		.maxlen		= sizeof(int),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec
-	},
 	{ }
 };
 
@@ -458,7 +451,6 @@ static int __net_init lowpan_frags_ns_sysctl_register(struct net *net)
 		table[1].data = &ieee802154_lowpan->frags.low_thresh;
 		table[1].extra2 = &ieee802154_lowpan->frags.high_thresh;
 		table[2].data = &ieee802154_lowpan->frags.timeout;
-		table[3].data = &ieee802154_lowpan->max_dsize;
 
 		/* Don't export sysctls to unprivileged users */
 		if (net->user_ns != &init_user_ns)
@@ -533,7 +525,6 @@ static int __net_init lowpan_frags_init_net(struct net *net)
 	ieee802154_lowpan->frags.high_thresh = IPV6_FRAG_HIGH_THRESH;
 	ieee802154_lowpan->frags.low_thresh = IPV6_FRAG_LOW_THRESH;
 	ieee802154_lowpan->frags.timeout = IPV6_FRAG_TIMEOUT;
-	ieee802154_lowpan->max_dsize = 0xFFFF;
 
 	inet_frags_init_net(&ieee802154_lowpan->frags);
 
-- 
2.0.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCHv2 bluetooth 0/5] mac802154: ieee802154: stable patches
  2014-08-19 17:03 [PATCHv2 bluetooth 0/5] mac802154: ieee802154: stable patches Alexander Aring
                   ` (4 preceding siblings ...)
  2014-08-19 17:03 ` [PATCHv2 bluetooth 5/5] ieee802154: 6lowpan: ensure MTU of 1280 for 6lowpan Alexander Aring
@ 2014-08-19 17:20 ` Marcel Holtmann
  5 siblings, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2014-08-19 17:20 UTC (permalink / raw)
  To: Alexander Aring; +Cc: BlueZ development, linux-wpan, kernel

Hi Alex,

> these patches contains patches for the bluetooth branch.
> 
> This series includes memory leak fixes and an errno value fix.
> Also there are two patches for sending and receiving 1280 6LoWPAN packets,
> which makes the IEEE 802.15.4 6LoWPAN stack more RFC compliant.
> 
> - Alex
> 
> changes v2:
> - remove ieee802154_lowpan in lowpan_frag_rcv to avoid compiler warning
> 
> Alexander Aring (2):
>  ieee802154: 6lowpan_rtnl: fix correct errno value
>  ieee802154: 6lowpan: ensure of sending 1280 packets
> 
> Martin Townsend (3):
>  mac802154: fixed potential skb leak with mac802154_parse_frame_start
>  ieee802154: mac802154: handle the reserved dest mode by dropping the
>    packet
>  ieee802154: 6lowpan: ensure MTU of 1280 for 6lowpan
> 
> include/net/netns/ieee802154_6lowpan.h |  1 -
> net/ieee802154/6lowpan_rtnl.c          |  4 ++--
> net/ieee802154/reassembly.c            | 15 +++------------
> net/mac802154/wpan.c                   |  6 +++++-
> 4 files changed, 10 insertions(+), 16 deletions(-)

I have applied this series to bluetooth tree now.

Regards

Marcel


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-08-19 17:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-19 17:03 [PATCHv2 bluetooth 0/5] mac802154: ieee802154: stable patches Alexander Aring
2014-08-19 17:03 ` [PATCHv2 bluetooth 1/5] mac802154: fixed potential skb leak with mac802154_parse_frame_start Alexander Aring
2014-08-19 17:03 ` [PATCHv2 bluetooth 2/5] ieee802154: 6lowpan_rtnl: fix correct errno value Alexander Aring
2014-08-19 17:03 ` [PATCHv2 bluetooth 3/5] ieee802154: mac802154: handle the reserved dest mode by dropping the packet Alexander Aring
2014-08-19 17:03 ` [PATCHv2 bluetooth 4/5] ieee802154: 6lowpan: ensure of sending 1280 packets Alexander Aring
2014-08-19 17:03 ` [PATCHv2 bluetooth 5/5] ieee802154: 6lowpan: ensure MTU of 1280 for 6lowpan Alexander Aring
2014-08-19 17:20 ` [PATCHv2 bluetooth 0/5] mac802154: ieee802154: stable patches Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox