Bluetooth: Read LE Max data length command
[platform/kernel/linux-rpi.git] / net / rxrpc / sendmsg.c
index da49fcf..8e0b947 100644 (file)
@@ -50,15 +50,11 @@ static int rxrpc_wait_to_be_connected(struct rxrpc_call *call, long *timeo)
        _enter("%d", call->debug_id);
 
        if (rxrpc_call_state(call) != RXRPC_CALL_CLIENT_AWAIT_CONN)
-               return call->error;
+               goto no_wait;
 
        add_wait_queue_exclusive(&call->waitq, &myself);
 
        for (;;) {
-               ret = call->error;
-               if (ret < 0)
-                       break;
-
                switch (call->interruptibility) {
                case RXRPC_INTERRUPTIBLE:
                case RXRPC_PREINTERRUPTIBLE:
@@ -69,10 +65,9 @@ static int rxrpc_wait_to_be_connected(struct rxrpc_call *call, long *timeo)
                        set_current_state(TASK_UNINTERRUPTIBLE);
                        break;
                }
-               if (rxrpc_call_state(call) != RXRPC_CALL_CLIENT_AWAIT_CONN) {
-                       ret = call->error;
+
+               if (rxrpc_call_state(call) != RXRPC_CALL_CLIENT_AWAIT_CONN)
                        break;
-               }
                if ((call->interruptibility == RXRPC_INTERRUPTIBLE ||
                     call->interruptibility == RXRPC_PREINTERRUPTIBLE) &&
                    signal_pending(current)) {
@@ -85,6 +80,7 @@ static int rxrpc_wait_to_be_connected(struct rxrpc_call *call, long *timeo)
        remove_wait_queue(&call->waitq, &myself);
        __set_current_state(TASK_RUNNING);
 
+no_wait:
        if (ret == 0 && rxrpc_call_is_complete(call))
                ret = call->error;
 
@@ -655,15 +651,19 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)
                if (IS_ERR(call))
                        return PTR_ERR(call);
                /* ... and we have the call lock. */
+               p.call.nr_timeouts = 0;
                ret = 0;
                if (rxrpc_call_is_complete(call))
                        goto out_put_unlock;
        } else {
                switch (rxrpc_call_state(call)) {
-               case RXRPC_CALL_UNINITIALISED:
                case RXRPC_CALL_CLIENT_AWAIT_CONN:
-               case RXRPC_CALL_SERVER_PREALLOC:
                case RXRPC_CALL_SERVER_SECURING:
+                       if (p.command == RXRPC_CMD_SEND_ABORT)
+                               break;
+                       fallthrough;
+               case RXRPC_CALL_UNINITIALISED:
+               case RXRPC_CALL_SERVER_PREALLOC:
                        rxrpc_put_call(call, rxrpc_call_put_sendmsg);
                        ret = -EBUSY;
                        goto error_release_sock;
@@ -703,7 +703,7 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)
                fallthrough;
        case 1:
                if (p.call.timeouts.hard > 0) {
-                       j = msecs_to_jiffies(p.call.timeouts.hard);
+                       j = p.call.timeouts.hard * HZ;
                        now = jiffies;
                        j += now;
                        WRITE_ONCE(call->expect_term_by, j);