[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1675864487-18620-1-git-send-email-quic_prashk@quicinc.com>
Date: Wed, 8 Feb 2023 19:24:47 +0530
From: Prashanth K <quic_prashk@...cinc.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Xiu Jianfeng <xiujianfeng@...wei.com>
CC: Pratham Pratap <quic_ppratap@...cinc.com>,
Jack Pham <quic_jackp@...cinc.com>,
<linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Prashanth K <quic_prashk@...cinc.com>
Subject: [PATCH] usb: gadget: u_serial: Add null pointer check in gserial_resume
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
gserial->port and thus causing null pointer dereference.Add
a null pointer check to prevent this.
Fixes: aba3a8d01d62 (" usb: gadget: u_serial: add suspend resume callbacks")
Signed-off-by: Prashanth K <quic_prashk@...cinc.com>
---
drivers/usb/gadget/function/u_serial.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
index 840626e..98be2b8 100644
--- a/drivers/usb/gadget/function/u_serial.c
+++ b/drivers/usb/gadget/function/u_serial.c
@@ -1428,6 +1428,9 @@ void gserial_resume(struct gserial *gser)
struct gs_port *port = gser->ioport;
unsigned long flags;
+ if (!port)
+ return;
+
spin_lock_irqsave(&port->port_lock, flags);
port->suspended = false;
if (!port->start_delayed) {
--
2.7.4
Powered by blists - more mailing lists