From d1d7358e9f032a43bd48d56a623943b7bee7dce0 Mon Sep 17 00:00:00 2001 From: Phoebe Buckheister Date: Fri, 14 Mar 2014 21:24:04 +0100 Subject: 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 Signed-off-by: David S. Miller --- net/ieee802154/dgram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net/ieee802154/dgram.c') diff --git a/net/ieee802154/dgram.c b/net/ieee802154/dgram.c index 55f2dc45a7dc..4c47154041b0 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; } -- cgit v1.2.3