Skip to contentSkip to conversation

mac802154: ieee802154: stable patches

PATCH Applied Alexander Aring 2 participants 7 messages Aug 19, 2014

Subsystems (3)
lore
Share & tools
lore

Alexander Aring

author maintainer
#0 lore raw

v2 cover mac802154: ieee802154: stable patches

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(-)
Signature · 1 line
2.0.4
author maintainer
#1 lore raw

PATCH v2 1/5 mac802154: fixed potential skb leak with mac802154_parse_frame_start

From: Martin Townsend <[email protected]>

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

---
 net/mac802154/wpan.c | 1 +
 1 file changed, 1 insertion(+)
net/mac802154/wpan.c +1 -0
index 3c3069f..4c13323 100644
@@ -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;
 	}
 
Signature · 1 line
2.0.4
author maintainer
#2 lore raw

PATCH v2 2/5 ieee802154: 6lowpan_rtnl: fix correct errno value

In reply to Alexander Aring

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

---
 net/ieee802154/6lowpan_rtnl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ieee802154/6lowpan_rtnl.c +1 -1
index 016b77e..71fa7d4 100644
@@ -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;
Signature · 1 line
2.0.4
author maintainer
#3 lore raw

PATCH v2 3/5 ieee802154: mac802154: handle the reserved dest mode by dropping the packet

In reply to Alexander Aring

From: Martin Townsend <[email protected]>

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

---
 net/mac802154/wpan.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/mac802154/wpan.c +4 -1
index 4c13323..5478388 100644
@@ -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);
Signature · 1 line
2.0.4
author maintainer
#4 lore raw

PATCH v2 4/5 ieee802154: 6lowpan: ensure of sending 1280 packets

In reply to 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.

---
 net/ieee802154/6lowpan_rtnl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ieee802154/6lowpan_rtnl.c +1 -1
index 71fa7d4..6591d27 100644
@@ -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;
Signature · 1 line
2.0.4
author maintainer
#5 lore raw

PATCH v2 5/5 ieee802154: 6lowpan: ensure MTU of 1280 for 6lowpan

In reply to Alexander Aring

From: Martin Townsend <[email protected]>

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.

---
 include/net/netns/ieee802154_6lowpan.h |  1 -
 net/ieee802154/reassembly.c            | 15 +++------------
 2 files changed, 3 insertions(+), 13 deletions(-)
include/net/netns/ieee802154_6lowpan.h +0 -1
index e207096..8170f8d 100644
@@ -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
net/ieee802154/reassembly.c +3 -12
index ffec6ce..32755cb 100644
@@ -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);
 
Signature · 1 line
2.0.4
maintainer Applied
#6 lore raw
In reply to Alexander Aring

Hi Alex,

Quoted 21 lines

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

Quoted 5 lines
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