From: Phoebe Buckheister Date: Wed, 14 May 2014 15:43:07 +0000 (+0200) Subject: mac802154: account for all header parts during wpan header creationg X-Git-Tag: next-20140516~66^2~4^2~4 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=8c84296fd2867118944399ab7e9051515a70d60d;p=karo-tx-linux.git mac802154: account for all header parts during wpan header creationg 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 Signed-off-by: David S. Miller --- diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c index 1df7a6a57386..cb34064d05f6 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;