I cannot provide logs using apport. Please let me know if you need to
know how I am using this driver.


** Changed in: linux (Ubuntu)
       Status: Incomplete => Confirmed

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/2038852

Title:
  Isotp driver causes timeout because of race condition during
  nonblocking writes

Status in linux package in Ubuntu:
  Confirmed

Bug description:
  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/96d31e8c-fa26-4e32-4c36-768981f20...@hartkopp.net/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;
  >       }

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2038852/+subscriptions


-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to