summaryrefslogtreecommitdiffstats
path: root/net/ieee802154
diff options
context:
space:
mode:
authorPhoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>2014-03-14 21:24:04 +0100
committerDavid S. Miller <davem@davemloft.net>2014-03-14 22:15:26 -0400
commitd1d7358e9f032a43bd48d56a623943b7bee7dce0 (patch)
tree9e132ac257c7f520382d7082e34ab3f5f1cc9452 /net/ieee802154
parenta13061ec04e9168625427a591235b167d5499bc6 (diff)
downloadop-kernel-dev-d1d7358e9f032a43bd48d56a623943b7bee7dce0.zip
op-kernel-dev-d1d7358e9f032a43bd48d56a623943b7bee7dce0.tar.gz
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/ieee802154')
-rw-r--r--net/ieee802154/6lowpan_rtnl.c2
-rw-r--r--net/ieee802154/dgram.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/net/ieee802154/6lowpan_rtnl.c b/net/ieee802154/6lowpan_rtnl.c
index d4edd20..6060394 100644
--- a/net/ieee802154/6lowpan_rtnl.c
+++ b/net/ieee802154/6lowpan_rtnl.c
@@ -141,7 +141,7 @@ static int lowpan_header_create(struct sk_buff *skb,
}
return dev_hard_header(skb, lowpan_dev_info(dev)->real_dev,
- type, (void *)&da, (void *)&sa, skb->len);
+ type, (void *)&da, (void *)&sa, 0);
}
static int lowpan_give_skb_to_devices(struct sk_buff *skb,
diff --git a/net/ieee802154/dgram.c b/net/ieee802154/dgram.c
index 55f2dc4..4c47154 100644
--- a/net/ieee802154/dgram.c
+++ b/net/ieee802154/dgram.c
@@ -233,7 +233,7 @@ static int dgram_sendmsg(struct kiocb *iocb, struct sock *sk,
if (size > mtu) {
pr_debug("size = %Zu, mtu = %u\n", size, mtu);
- err = -EINVAL;
+ err = -EMSGSIZE;
goto out_dev;
}
OpenPOWER on IntegriCloud