ieee802154 socket: Return EMSGSIZE from raw_sendmsg() if packet too big.
authorLennert Buytenhek <buytenh@wantstofly.org>
Mon, 25 May 2015 12:38:24 +0000 (15:38 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 26 May 2015 16:07:39 +0000 (18:07 +0200)
The proper return code for trying to send a packet that exceeds the
outgoing interface's MTU is EMSGSIZE, not EINVAL, so patch ieee802154's
raw_sendmsg() to do the right thing.  (Its dgram_sendmsg() was already
returning EMSGSIZE for this case.)

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/ieee802154/socket.c

index e5cc2537c2a305b03234fb0cf3931ced92d344ac..d9fc5ccb1d0d26abaf4eb0217cca4c772f8b5781 100644 (file)
@@ -284,7 +284,7 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
 
        if (size > mtu) {
                pr_debug("size = %Zu, mtu = %u\n", size, mtu);
-               err = -EINVAL;
+               err = -EMSGSIZE;
                goto out_dev;
        }