[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f2419bb9-2d81-4a6d-838d-b404e3ce7786@suse.com>
Date: Tue, 24 Jun 2025 10:02:06 +0200
From: Oliver Neukum <oneukum@...e.com>
To: Abinash Singh <abinashlalotra@...il.com>, johan@...nel.org
Cc: gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, Abinash Singh <abinashsinghlalotra@...il.com>
Subject: Re: [RFC PATCH] usb_wwan : add locking around shared port data in two
FIXME-marked places
Hi,
On 20.06.25 12:17, Abinash Singh wrote:
> Fix two locking-related FIXME comments by adding a mutex
> to protect shared fields in `usb_wwan_port_private`.
>
> - In `usb_wwan_dtr_rts()`, access to `rts_state`
> and `dtr_state` is now protected by `portdata->lock`.
> - In `usb_wwan_tiocmset()`, access to `rts_state`
> and `dtr_state` is now also synchronized with the same mutex.
>
> These changes prevent possible data races
> and inconsistent state updates when the port is written concurrently.
unfortunately this patch is rather problematic because
1. you never initialize the mutex
2. these values are read in usb_wwan_send_setup(), where you don't take the lock
Now, as usb_wwan_send_setup() is called right after you drop
the mutex, this patch is kind of inelegant.
Sorry
Oliver
Powered by blists - more mailing lists