diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-10-16 20:46:20 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-10-16 20:46:20 +0200 |
commit | 5f19ca4e014f2bd4088b78f31426f0ba3b8e6a3c (patch) | |
tree | 7357ef42d49b5ff46e1f9c7d0f873a3606b612f4 /net/can/isotp.c | |
parent | d712d205210c494c29f33dc1d1f2ce4d7448faa9 (diff) | |
parent | 58720809f52779dc0f08e53e54b014209d13eebb (diff) |
Merge 6.6-rc6 into char-misc-next
We need the char/misc fixes in here as well, to build on for other
changes.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/can/isotp.c')
-rw-r--r-- | net/can/isotp.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/net/can/isotp.c b/net/can/isotp.c index f02b5d3e4733..d1c6f206f429 100644 --- a/net/can/isotp.c +++ b/net/can/isotp.c @@ -948,21 +948,18 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) if (!so->bound || so->tx.state == ISOTP_SHUTDOWN) return -EADDRNOTAVAIL; -wait_free_buffer: - /* we do not support multiple buffers - for now */ - if (wq_has_sleeper(&so->wait) && (msg->msg_flags & MSG_DONTWAIT)) - return -EAGAIN; + while (cmpxchg(&so->tx.state, ISOTP_IDLE, ISOTP_SENDING) != ISOTP_IDLE) { + /* we do not support multiple buffers - for now */ + if (msg->msg_flags & MSG_DONTWAIT) + return -EAGAIN; - /* wait for complete transmission of current pdu */ - err = wait_event_interruptible(so->wait, so->tx.state == ISOTP_IDLE); - if (err) - goto err_event_drop; - - if (cmpxchg(&so->tx.state, ISOTP_IDLE, ISOTP_SENDING) != ISOTP_IDLE) { if (so->tx.state == ISOTP_SHUTDOWN) return -EADDRNOTAVAIL; - goto wait_free_buffer; + /* wait for complete transmission of current pdu */ + err = wait_event_interruptible(so->wait, so->tx.state == ISOTP_IDLE); + if (err) + goto err_event_drop; } /* PDU size > default => try max_pdu_size */ |