Bluetooth: Fix issue with return value of rfcomm_sock_sendmsg()
authorVictor Shcherbatyuk <victor.shcherbatyuk@tomtom.com>
Thu, 15 Jan 2009 20:52:12 +0000 (21:52 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 27 Feb 2009 05:14:21 +0000 (06:14 +0100)
In case of connection failures the rfcomm_sock_sendmsg() should return
an error and not a 0 value.

Signed-off-by: Victor Shcherbatyuk <victor.shcherbatyuk@tomtom.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/rfcomm/sock.c

index d3fc6fca38d0892af7fe2e2d0f18328a82b6df2e..ce505f2a755b5ce531857e0be0bee106792e194e 100644 (file)
@@ -570,8 +570,11 @@ static int rfcomm_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
 
                skb = sock_alloc_send_skb(sk, size + RFCOMM_SKB_RESERVE,
                                msg->msg_flags & MSG_DONTWAIT, &err);
-               if (!skb)
+               if (!skb) {
+                       if (sent == 0)
+                               sent = err;
                        break;
+               }
                skb_reserve(skb, RFCOMM_SKB_HEAD_RESERVE);
 
                err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size);