You have been subscribed to a public bug:

This are my system details
Description:    Ubuntu 20.04.6 LTS
Release:        20.04

When using 5.15.133 kernel on Ubuntu 20.04. I am seeing that non blocking 
writes cause race condition and locks the socket. This issue is resolved by a 
patch from here 
https://lore.kernel.org/linux-can/[email protected]/T/#u.
 This patch is supposed to make in the 6.7 kernel commit id 61caf48cf7 and I 
would like it to be fixed for 5.15 stream as well. I have tested that this 
patch when applied to 5.15.133 works. The patch cannot be directly applied but 
a more comprehensive look at the current code at net/can/isotp.c. This is a 
diff of my changes to isotp.c
119c119,120
<       ISOTP_SENDING
---
>       ISOTP_SENDING,
>       ISOTP_SHUTDOWN,
873c874
<       if (!so->bound)
---
>       if (!so->bound|| so->tx.state == ISOTP_SHUTDOWN)
876,893c877,887
<       /* we do not support multiple buffers - for now */
<       if (cmpxchg(&so->tx.state, ISOTP_IDLE, ISOTP_SENDING) != ISOTP_IDLE ||
<           wq_has_sleeper(&so->wait)) {
<               if (msg->msg_flags & MSG_DONTWAIT) {
<                    err = -EAGAIN;
<                    goto err_out;
<               }
<
<               /* wait for complete transmission of current pdu */
<               err = wait_event_interruptible(so->wait, so->tx.state == 
ISOTP_IDLE);
<               if (err)
<                    goto err_out;
<       }
<
<       if (!size || size > MAX_MSG_LENGTH) {
<               err = -EINVAL;
<               goto err_out_drop;
<       }
---
>       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;
>               if (so->tx.state == ISOTP_SHUTDOWN)
>             return -EADDRNOTAVAIL;
>       /* wait for complete transmission of current pdu */
>         err = wait_event_interruptible(so->wait, so->tx.state == ISOTP_IDLE);
>         if (err)
>            goto err_out;
>       }

** Affects: linux (Ubuntu)
     Importance: Undecided
         Status: New

-- 
Isotp driver causes timeout because of race condition during nonblocking writes
https://bugs.launchpad.net/bugs/2038852
You received this bug notification because you are a member of Kernel Packages, 
which is subscribed to linux in Ubuntu.

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to