From patchwork Tue Dec 10 16:54:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Liu X-Patchwork-Id: 11283009 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6139D6C1 for ; Tue, 10 Dec 2019 16:55:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 351A82077B for ; Tue, 10 Dec 2019 16:55:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="K4Lkxhi6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727568AbfLJQza (ORCPT ); Tue, 10 Dec 2019 11:55:30 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:45888 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727536AbfLJQz3 (ORCPT ); Tue, 10 Dec 2019 11:55:29 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id xBAGtS5g106935; Tue, 10 Dec 2019 10:55:28 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1575996928; bh=g9McmvHlwW3mj2yAcDaVFA3nqtYkS4Mh1U3vQqnU0ss=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=K4Lkxhi6VehYgHUJs+PTdqe8dPQYY5q2xSmU6fED2DTm+FRUuznp0XsYJAv384JoE KLs7TIKkwXaLHokPRIovV25S7UhmHfFAYhT7JPoDxvPm1ZyJyiJoE5IQo+gitNikPu MGc70ImhVQbP/FnzUxv7OYvOV8dFEIPhNjxQLMNc= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id xBAGtSIF088721; Tue, 10 Dec 2019 10:55:28 -0600 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Tue, 10 Dec 2019 10:55:28 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Tue, 10 Dec 2019 10:55:28 -0600 Received: from uda0271908.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id xBAGtSPF006664; Tue, 10 Dec 2019 10:55:28 -0600 From: Bin Liu To: Greg Kroah-Hartman CC: Subject: [PATCH 1/2] usb: musb: sunxi: propagate devicetree node to glue pdev Date: Tue, 10 Dec 2019 10:54:53 -0600 Message-ID: <20191210165454.13772-2-b-liu@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191210165454.13772-1-b-liu@ti.com> References: <20191210165454.13772-1-b-liu@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Mans Rullgard In order for devicetree nodes to be correctly associated with attached devices, the controller node needs to be propagated to the glue device. Signed-off-by: Mans Rullgard Signed-off-by: Bin Liu --- drivers/usb/musb/sunxi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c index 832a41f9ee7d..a72665fbf111 100644 --- a/drivers/usb/musb/sunxi.c +++ b/drivers/usb/musb/sunxi.c @@ -781,6 +781,8 @@ static int sunxi_musb_probe(struct platform_device *pdev) pinfo.name = "musb-hdrc"; pinfo.id = PLATFORM_DEVID_AUTO; pinfo.parent = &pdev->dev; + pinfo.fwnode = of_fwnode_handle(pdev->dev.of_node); + pinfo.of_node_reused = true; pinfo.res = pdev->resource; pinfo.num_res = pdev->num_resources; pinfo.data = &pdata; From patchwork Tue Dec 10 16:54:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Liu X-Patchwork-Id: 11283007 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB16014BD for ; Tue, 10 Dec 2019 16:55:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BFCB020838 for ; Tue, 10 Dec 2019 16:55:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="gv/lCbGh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727573AbfLJQza (ORCPT ); Tue, 10 Dec 2019 11:55:30 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:45890 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727535AbfLJQz3 (ORCPT ); Tue, 10 Dec 2019 11:55:29 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id xBAGtSRd106939; Tue, 10 Dec 2019 10:55:28 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1575996928; bh=u5UAvfjh0PLFujv2s960GAVcGZghF86VQDi782BiUfY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=gv/lCbGhfFQhlgrLsAts1e7h9CnqhCtL3XjIGVcWmISVC5KYNYZE0ODUM4Ri9K1fL U2ckHRNTp1A+WByX967NqZS7+EwJSrKpeFW9xZWNS4ZkRvq2YNhbzSRX8GSsebJp3P f9uo0oSyTOGA21Wnvu+J2BOjRZ9NuAeUOSE+rASc= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xBAGtSc1115891 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 10 Dec 2019 10:55:28 -0600 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Tue, 10 Dec 2019 10:55:28 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Tue, 10 Dec 2019 10:55:28 -0600 Received: from uda0271908.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id xBAGtSPG006664; Tue, 10 Dec 2019 10:55:28 -0600 From: Bin Liu To: Greg Kroah-Hartman CC: Subject: [PATCH 2/2] usb: musb: Fix a possible null-pointer dereference in musb_handle_intr_connect() Date: Tue, 10 Dec 2019 10:54:54 -0600 Message-ID: <20191210165454.13772-3-b-liu@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191210165454.13772-1-b-liu@ti.com> References: <20191210165454.13772-1-b-liu@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Jia-Ju Bai In musb_handle_intr_connect(), there is an if statement on line 783 to check whether musb->hcd is NULL: if (musb->hcd) When musb->hcd is NULL, it is used on line 797: musb_host_poke_root_hub(musb); if (musb->hcd->status_urb) Thus, a possible null-pointer dereference may occur. To fix this bug, musb->hcd is checked before calling musb_host_poke_root_hub(). This bug is found by a static analysis tool STCheck written by us. Signed-off-by: Jia-Ju Bai Signed-off-by: Bin Liu --- drivers/usb/musb/musb_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 15cca912c53e..5080fc6a0808 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -794,7 +794,8 @@ static void musb_handle_intr_connect(struct musb *musb, u8 devctl, u8 int_usb) break; } - musb_host_poke_root_hub(musb); + if (musb->hcd) + musb_host_poke_root_hub(musb); musb_dbg(musb, "CONNECT (%s) devctl %02x", usb_otg_state_string(musb->xceiv->otg->state), devctl);