diff options
author | Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de> | 2014-03-14 21:24:04 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-03-14 22:15:26 -0400 |
commit | d1d7358e9f032a43bd48d56a623943b7bee7dce0 (patch) | |
tree | 9e132ac257c7f520382d7082e34ab3f5f1cc9452 /net/mac802154 | |
parent | a13061ec04e9168625427a591235b167d5499bc6 (diff) |
ieee802154: add proper length checks to header creations
Have mac802154 header_ops.create fail with -EMSGSIZE if the length
passed will be too large to fit a frame. Since 6lowpan will ensure that
no packet payload will be too large, pass a length of 0 there. 802.15.4
dgram sockets will also return -EMSGSIZE on payloads larger than the
device MTU instead of -EINVAL.
Signed-off-by: Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac802154')
-rw-r--r-- | net/mac802154/wpan.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c index b61426662867..80cbee1a2f56 100644 --- a/net/mac802154/wpan.c +++ b/net/mac802154/wpan.c @@ -150,6 +150,9 @@ static int mac802154_header_create(struct sk_buff *skb, skb_reset_mac_header(skb); skb->mac_len = hlen; + if (hlen + len + 2 > dev->mtu) + return -EMSGSIZE; + return hlen; } |