Re: [RFC PATCH] can: isotp: fix race between isotp_sendsmg() and isotp_release()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 31, 2023 at 9:23 PM Oliver Hartkopp <socketcan@xxxxxxxxxxxx> wrote:
>
> Hi Dae,
>
(...)
>
> /* wait for complete transmission of current pdu */
> while (wait_event_interruptible(so->wait, so->tx.state == ISOTP_IDLE) ==
> 0 &&
>         cmpxchg(&so->tx.state, ISOTP_IDLE, ISOTP_SHUTDOWN) != ISOTP_IDLE);

I'm not sure, but your intention in this condition is probably
while (wait_event_interruptible() != 0 || cmpxchg() != ISOTP_IDLE)?
So, release() can get out of the loop only if
wait_event_interruptible() returns 0 and cmpxchg() successes?

> /* force state machines to be idle also when a signal occurred */
> so->tx.state = ISOTP_SHUTDOWN;
> so->rx.state = ISOTP_IDLE;
>
> When wait_event_interruptible() does not return '0' we can neither rely
> on tx.state to be ISOTP_IDLE nor on anybody else taking care for that.
>
> So I would suggest to continue removing the socket.
>
> > Thank you for your hard work!
>
> Thanks for the review and the request to take an additional look at the
> code!
>
> Best regards,
> Oliver

Best regards,
Dae R. Jeong




[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux