Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp2821627ybx; Sun, 3 Nov 2019 04:43:05 -0800 (PST) X-Google-Smtp-Source: APXvYqxWu3HflyZoshwIs/nUhTCzC7rCc4iV64AzVnFftopdcnJbb38W2sXIX8iOW+em6fDQWN6h X-Received: by 2002:a50:8851:: with SMTP id c17mr8702214edc.60.1572784985859; Sun, 03 Nov 2019 04:43:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572784985; cv=none; d=google.com; s=arc-20160816; b=FJQ4fYEN6OpvhtjAFrawEafYt1I0aSaSqzXfH6yNxeBXBibf6eMdioH1OFv7kB3nVB HVd0JTY1TNc38o/r157S8kZAd5/wAD2Oa3AzHnu6RkyvbWFGzuufwQP3XFnC8d7FK1CV /exCdrXKvNEf+ZVIR10ZRk++C2SeImYsp2PF1K6NOLXtplyA62tgdSQk+9LuhGDmBMNj SRJAPaxfwCO+L0HbI5qn0np1KLjDerHwo+L21xktYg520oaRJYLl7bmg8uaObZ4EYyPU BMt9B51a4CyAvs2NfGKKFNXZqt/+GBYb4L8tAq0rxYdwOO/kwIlKRPA0h7xEBrQE1Bvx bI4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=JxHQyT3wGq8009l0PhADk2jnNE5inHoQN9mfzwaB4gI=; b=FXYhjSfulr84AdZbW0xf3dMTb78RzL5Wal50cMgZeXyDEMZ7E9ZaL1pDrgc9YWlRXv RNBL+wdC0rCixw43jleRvZ0VYgzo5sQD8nckJmqwtW5UPtQZjIJfHQtOyWrkwD4qtsUC C+AtRJ2/e59YbRC1h1CeV14Xs+0JtJYy04xXkngD2KXQJMM5pl8O6mWyoYS1nVFXExxu /C0CbFhTZjXNwE9wsXCHzA42LT+5kK1aA+CWxOXrcxQc3F3urMGHV1Gvw/WxxqW+jb5x qoGfrEr6z657l46W2DQoakdXoUE41cg1WiMUK/1p9qxT8VQvo/N49kC7G+ODavmvVIY0 yFOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mF2mfMyf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e15si9492791ejt.370.2019.11.03.04.42.42; Sun, 03 Nov 2019 04:43:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mF2mfMyf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727555AbfKCMmE (ORCPT + 99 others); Sun, 3 Nov 2019 07:42:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:52220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727377AbfKCMmE (ORCPT ); Sun, 3 Nov 2019 07:42:04 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6F4A32080F; Sun, 3 Nov 2019 12:42:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572784923; bh=xbgHsJBJRvoxAQ7KVYp/h1DOPwN2mmCDsuUBaPIhuf0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mF2mfMyfseqyne4SCDmzGdBzWYPpkcIoSgPZRVnZz9wjd9L3pQc9Y8EhfHVqFBVhF jgi9RVkJcqDkt6VwMyDk6IuFHp1cdBEjCdtgp70+DMZbyqHJoU8HePyDqflDbMCYkL gQ0WbiZxk/B5tsnMrSBhfJV1LROvcrgRK6b4l2nI= Date: Sun, 3 Nov 2019 13:42:01 +0100 From: Greg KH To: hui yang Cc: balbi@kernel.org, mirq-linux@rere.qmqm.pl, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] USB(u_serial.c): it has a NULL point Message-ID: <20191103124201.GB619218@kroah.com> References: <1572749044-6091-1-git-send-email-yanghui.def@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1572749044-6091-1-git-send-email-yanghui.def@gmail.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Nov 03, 2019 at 10:44:04AM +0800, hui yang wrote: > From: YangHui > > 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 > --- > 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; How can this happen? Shouldn't this be handled earlier? If not, can you document this how this can be true and what should be done about it? thanks, greg k-h