From patchwork Fri Dec 25 11:26:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 7920681 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AE4F59F32E for ; Fri, 25 Dec 2015 11:26:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C92E6203AB for ; Fri, 25 Dec 2015 11:26:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 14772202F8 for ; Fri, 25 Dec 2015 11:26:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751911AbbLYL0V (ORCPT ); Fri, 25 Dec 2015 06:26:21 -0500 Received: from relmlor3.renesas.com ([210.160.252.173]:55967 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751698AbbLYL0U (ORCPT ); Fri, 25 Dec 2015 06:26:20 -0500 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 25 Dec 2015 20:26:18 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 62FF950B64; Fri, 25 Dec 2015 20:26:18 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 594921806F; Fri, 25 Dec 2015 20:26:18 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 5118E1800A; Fri, 25 Dec 2015 20:26:18 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac3.idc.renesas.com with ESMTP id WAC26940; Fri, 25 Dec 2015 20:26:18 +0900 X-IronPort-AV: E=Sophos;i="5.20,478,1444662000"; d="scan'";a="202515396" Received: from mail-sg2apc01lp0242.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.242]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 25 Dec 2015 20:26:17 +0900 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; Received: from localhost (211.11.155.144) by SG2PR06MB0918.apcprd06.prod.outlook.com (10.162.201.158) with Microsoft SMTP Server (TLS) id 15.1.361.13; Fri, 25 Dec 2015 11:26:15 +0000 From: Yoshihiro Shimoda To: , CC: , , Yoshihiro Shimoda Subject: [PATCH] usb: renesas_usbhs: gadget: fix giveback status code in usbhsg_pipe_disable() Date: Fri, 25 Dec 2015 20:26:03 +0900 Message-ID: <1451042763-4648-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.4.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: HK2PR02CA0027.apcprd02.prod.outlook.com (25.163.104.165) To SG2PR06MB0918.apcprd06.prod.outlook.com (25.162.201.158) X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB0918; 2:gtPY83Q+3J4SAxwBlMsKiF9Nq3NvU22vd1Qr4H5KsX2RMTJpklpIoxWbwS9WgajW4XluIeqrGroYnE1LjnyIhlTzyWq5E50Vp3zqJlV8HnLnbusKWb7C/sM9Vh7PIC1I+skKTSETW/ID+MRFqgfJTQ==; 3:2fznhIYljVO2uKQZ0UY7K66XCGsJzHLhf/xA/EW/AfgP6LvUsoRnXKTFH7IGz+E3KYNjwPhApKSmqArsFquQbtRolRCpbYNbX6spmO67liYQbeVDiHjzzo5Tj3vkK0Cf; 25:mDb8cMoloPUkMUEbgY6kiAcUqLH/aWzv+hXH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q6rLpvSDP4cNgtQytddsFWLdVRHQYUNdIJBoXjp9eq9fJWv6lIvdtzTIgtai3bhD0PzzGEkfrZOah52yo/84UN9Y0/T8CO4KG8KNuJ8f7bPjeo+cZRA0O/AT4NXrQ9s1l/uEZRkvRehi1aVCJgDC4ZwaIQoD1gMDbRjLDHGNTSjOEe6ZLDOTL18/iAnONXh k9/g8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85106069007906); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(10201501046)(3002001); SRVR:SG2PR06MB0918; BCL:0; PCL:0; RULEID:; SRVR:SG2PR06MB0918; X-Forefront-PRVS: 0801F2E62B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(6009001)(199003)(189002)(586003)(3846002)(92566002)(5008740100001)(189998001)(1096002)(42186005)(36756003)(4001430100002)(105586002)(106356001)(5003940100001)(78352003)(47776003)(50226001)(6116002)(66066001)(76506005)(229853001)(107886002)(48376002)(50466002)(5004730100002)(97736004)(33646002)(5001960100002)(81156007)(101416001)(19580405001)(5001770100001)(19580395003)(42382002)(122386002)(77096005)(87976001)(50986999)(40100003); DIR:OUT; SFP:1102; SCL:1; SRVR:SG2PR06MB0918; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:0; MX:0; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SG2PR06MB0918; 23:R0XWu8EHtfwdFJfLUQ9odrgNvNo/yOhI0kGpXNMEk?= =?us-ascii?Q?GIF0hMqtvuRLAhJz9b5JR8aidIw/SRz5o4KGVsyvluMUBet7FT1hKPmX9Gtd?= =?us-ascii?Q?tFXYoRsoVbYjvuGcdNvufBoeu7zhGChwE0UoU2fn0pD5pTacDtC7RfZPPJwg?= =?us-ascii?Q?Q6CzlDVaLXCx0nP7TmQ18Os/tv76rWJuIz1/CpgZTJhZ9Sj4XRHRQLRsDdOA?= =?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dYO7BqQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB0918; 5:TGgqmIB2gTac4IHwkqA+Qpz1Aw8yLbgB+KXPxMsxuGAWjMptoATze5QpA2SH0becw+K5nxaE15e8O7k49uB6PFiRQExw6l/5982u92GwlW42J8askWDQe8JpyMNtPryz7fv+3mIb5s4jU+kEBnj5eQ==; 24:9MF/98ottyXKujDLjGqRrCAbRelys/6NidiJkK8S7/mxsn9OT/NnXLtLfYZYNO5zAIaRXYxnSXjTBu7jGfZQfbD241Lc7yz9x5VTHQpWW/k=; 20:t+wa63oRWLSli20k5YLmLmn4F2zI6XMHt/d6l6jEtJ9wIuNBnT6zQgXZOKaI31oI/RAwXrK6Fef36Rwmv/ZUydFtNavN1gWxQCI41rIwb21mpzeoGjTZAOqgcRu+fN3xGFVOWeVVkBYY4sz9cD85P0qGyYp4eIKeDhu4ZQGdI+w= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Dec 2015 11:26:15.6905 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR06MB0918 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-3.9 required=5.0 tests=AXB_X_OUTLOOKPROT_ENVSDR, BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A udc driver should set the giveback status to -ESHUTDOWN in usb_ep_disable(). Otherwise, a gadget driver (e.g. g_serial) might request next data wrongly and it is possible to cause kernel panic. Signed-off-by: Yoshihiro Shimoda --- This patch is based on Felipe's usb.git / testing/fixes branch. (commit id = 5072cfc40a80cea3749fd3413b3896630d8c787e) drivers/usb/renesas_usbhs/mod_gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index 657f967..664b263 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -561,7 +561,7 @@ static int usbhsg_pipe_disable(struct usbhsg_uep *uep) if (!pkt) break; - usbhsg_queue_pop(uep, usbhsg_pkt_to_ureq(pkt), -ECONNRESET); + usbhsg_queue_pop(uep, usbhsg_pkt_to_ureq(pkt), -ESHUTDOWN); } usbhs_pipe_disable(pipe);