linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: hui yang <yanghui.def@gmail.com>
To: balbi@kernel.org
Cc: gregkh@linuxfoundation.org, mirq-linux@rere.qmqm.pl,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	YangHui <yanghui.def@gmail.com>
Subject: [PATCH 2/2] USB(u_serial.c): it has a NULL point
Date: Sun,  3 Nov 2019 10:44:04 +0800	[thread overview]
Message-ID: <1572749044-6091-1-git-send-email-yanghui.def@gmail.com> (raw)

From: YangHui <yanghui.def@gmail.com>

Unable to handle kernel NULL pointer dereference at virtual address 000002a0
Kernel BUG at tty_wakeup+0x18/0x8c
[<0000000095135e9d>] tty_wakeup+0x18/0x8c
[<00000000c35f19e4>] gs_start_io+0xc8/0x158
[<00000000b11b184e>] gserial_connect+0xd0/0x174
[<00000000642201de>] acm_set_alt+0x70/0x180
[<00000000a9d38e8b>] composite_setup+0x1848/0x1a7c
[<0000000072c88781>] android_setup+0x1ec/0x1f4
[<000000004c0127a5>] msm_udc_irq+0x8d0/0xc0c
[<00000000f8bb9acf>] __handle_irq_event_percpu+0x74/0x294
[<00000000afd57256>] handle_irq_event+0x60/0xc8
[<0000000076719b24>] handle_fasteoi_irq+0xc8/0x1c4
[<00000000421f3d87>] generic_handle_irq+0x34/0x4c
[<00000000b2f2d343>] __handle_domain_irq+0x6c/0xbc
[<00000000c74325e8>] gic_handle_irq+0x6c/0xe0
yes,we can see the port->port.tty==NULL, so system crashed

Signed-off-by: YangHui <yanghui.def@gmail.com>
---
 drivers/usb/gadget/function/u_serial.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
index 65f634e..a1c2ac2 100644
--- a/drivers/usb/gadget/function/u_serial.c
+++ b/drivers/usb/gadget/function/u_serial.c
@@ -562,6 +562,8 @@ static int gs_start_io(struct gs_port *port)
 
 	/* unblock any pending writes into our circular buffer */
 	if (started) {
+		if (port->port.tty == NULL)
+			return -EIO;
 		tty_wakeup(port->port.tty);
 	} else {
 		gs_free_requests(ep, head, &port->read_allocated);
-- 
2.7.4


             reply	other threads:[~2019-11-03  2:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-03  2:44 hui yang [this message]
2019-11-03 12:42 ` [PATCH 2/2] USB(u_serial.c): it has a NULL point Greg KH
2019-11-09  7:49   ` hui yang
2019-11-13  7:13     ` Peter Chen
     [not found] <5dbeddab.1c69fb81.244fa.5f8c@mx.google.com>
2019-11-03 14:16 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1572749044-6091-1-git-send-email-yanghui.def@gmail.com \
    --to=yanghui.def@gmail.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mirq-linux@rere.qmqm.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).