On 13-02-23 11:28 pm, Alan Stern wrote:
On Mon, Feb 13, 2023 at 11:00:38PM +0530, Prashanth K wrote:
Consider a case where gserial_disconnect has already cleared
gser->ioport. And if a wakeup interrupt triggers afterwards,
gserial_resume gets called, which will lead to accessing of
gser->ioport and thus causing null pointer dereference.Add
a null pointer check to prevent this.
Added a static spinlock to prevent gser->ioport from becoming
null after the newly added check.
Fixes: aba3a8d01d62 ("usb: gadget: u_serial: add suspend resume callbacks")
Signed-off-by: Prashanth K <quic_prashk@xxxxxxxxxxx>
---
v5: Updated the comment in new patch
Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
I'm not very familiar with the u_serial function. Is it possible for
gserial_disconnect to cause a similar problem in gserial_suspend?
Alan Stern
Hi Alen,
You were right, we have similar issue in suspend path also. I have
pushed a patch for the same.
Regards,
Prashanth K