diff mbox

[net-next,2/6] mac802154: account for all header parts during wpan header creationg

Message ID 1400082191-16493-3-git-send-email-phoebe.buckheister@itwm.fraunhofer.de
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Phoebe Buckheister May 14, 2014, 3:43 p.m. UTC
The current WPAN header creation code checks for EMSGSIZE conditions,
but does not account for the MIC field that link layer security may add
at the end of the frame. Now that we can accurately calculate the
maximum payload size of packets, use that to check for EMSGSIZE
conditions.

Signed-off-by: Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>
---
 net/mac802154/wpan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c
index 1df7a6a..cb34064 100644
--- a/net/mac802154/wpan.c
+++ b/net/mac802154/wpan.c
@@ -231,7 +231,7 @@  static int mac802154_header_create(struct sk_buff *skb,
 	skb_reset_mac_header(skb);
 	skb->mac_len = hlen;
 
-	if (hlen + len + 2 > dev->mtu)
+	if (len > ieee802154_max_payload(&hdr))
 		return -EMSGSIZE;
 
 	return hlen;