From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934427AbbIVULM (ORCPT ); Tue, 22 Sep 2015 16:11:12 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:33293 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933591AbbIVULJ (ORCPT ); Tue, 22 Sep 2015 16:11:09 -0400 From: Alexandru M Stan To: John Youn , Paul Zimmerman Cc: Heiko Stuebner , Douglas Anderson , Jonathan Dixon , Mian Yousaf Kaukab , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Alexandru M Stan , gregkh@linuxfoundation.org Subject: [PATCH 0/1] usb: dwc2: Fix NULL qh in dwc2_queue_transaction Date: Tue, 22 Sep 2015 13:10:50 -0700 Message-Id: <1442952651-4341-1-git-send-email-amstan@chromium.org> X-Mailer: git-send-email 2.6.0.rc0.131.gf624c3d Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I have a weird usb device which doesn't a normal connector, so there's no guarantee that the pins will get removed in the correct order (data pins first, then ground and vcc). I wouldn't be mad if there was a weird error or something at connect/disconnect, but in this case I can actually get a kernel panic. Part of the panic text: [ 143.654956] [] (dwc2_queue_transaction) from [] (dwc2_hcd_queue_transactions+0x24c/0x31c) [ 143.664868] [] (dwc2_hcd_queue_transactions) from [] (_dwc2_hcd_clear_tt_buffer_complete+0x58/0x68) [ 143.675648] [] (_dwc2_hcd_clear_tt_buffer_complete) from [] (hub_tt_work+0x130/0x164) [ 143.685214] [] (hub_tt_work) from [] (process_one_work+0x258/0x3c0) [ 143.693217] [] (process_one_work) from [] (worker_thread+0x234/0x38c) [ 143.701394] [] (worker_thread) from [] (kthread+0xe4/0xfc) [ 143.708618] [] (kthread) from [] (ret_from_fork+0x14/0x20) I traced it down to a dereference of qh(chan->qh->ping_state) in dwc2_queue_transaction. At usb device disconnect, dwc2_hcd_cleanup_channels gets called, which sets qh to NULL, but dwc2_queue_transaction still manages to get called after that. I can reproduce this in an isolated manner on my rk3288 board with an FTDI/prolific device, having the usb pins easily disconnectable(independently), then playing with the vcc pin while leaving the data lines connected. While my patch is probably not a proper fix for this issue, it's pretty harmless where it is (and it's consistent with other checks in there). I also hope this opens up discussions on this issue. Alexandru M Stan (1): usb: dwc2: Fix NULL qh in dwc2_queue_transaction drivers/usb/dwc2/hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.6.0.rc0.131.gf624c3d