From patchwork Wed Dec 15 03:58:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 12677337 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C50FBC433F5 for ; Wed, 15 Dec 2021 03:52:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239633AbhLODwT (ORCPT ); Tue, 14 Dec 2021 22:52:19 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:32921 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235424AbhLODwT (ORCPT ); Tue, 14 Dec 2021 22:52:19 -0500 Received: from dggpeml500025.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4JDLsW6MXfzcbyr; Wed, 15 Dec 2021 11:51:59 +0800 (CST) Received: from dggpeml500017.china.huawei.com (7.185.36.243) by dggpeml500025.china.huawei.com (7.185.36.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 15 Dec 2021 11:51:50 +0800 Received: from huawei.com (10.175.103.91) by dggpeml500017.china.huawei.com (7.185.36.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 15 Dec 2021 11:51:50 +0800 From: Yang Yingliang To: , CC: , Subject: [PATCH -next] usb: host: xen-hcd: add missing unlock in error path Date: Wed, 15 Dec 2021 11:58:05 +0800 Message-ID: <20211215035805.375244-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500017.china.huawei.com (7.185.36.243) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add the missing unlock before return from function xenhcd_urb_request_done() and xenhcd_conn_notify() in the error handling case. Fixes: 494ed3997d75 ("usb: Introduce Xen pvUSB frontend (xen hcd)") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang Reviewed-by: Juergen Gross --- drivers/usb/host/xen-hcd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/host/xen-hcd.c b/drivers/usb/host/xen-hcd.c index 7801dde6f5ee..be09fd9bac58 100644 --- a/drivers/usb/host/xen-hcd.c +++ b/drivers/usb/host/xen-hcd.c @@ -942,6 +942,7 @@ static int xenhcd_urb_request_done(struct xenhcd_info *info) rp = info->urb_ring.sring->rsp_prod; if (RING_RESPONSE_PROD_OVERFLOW(&info->urb_ring, rp)) { xenhcd_set_error(info, "Illegal index on urb-ring"); + spin_unlock_irqrestore(&info->lock, flags); return 0; } rmb(); /* ensure we see queued responses up to "rp" */ @@ -997,6 +998,7 @@ static int xenhcd_conn_notify(struct xenhcd_info *info) rp = info->conn_ring.sring->rsp_prod; if (RING_RESPONSE_PROD_OVERFLOW(&info->conn_ring, rp)) { xenhcd_set_error(info, "Illegal index on conn-ring"); + spin_unlock_irqrestore(&info->lock, flags); return 0; } rmb(); /* ensure we see queued responses up to "rp" */ @@ -1010,6 +1012,7 @@ static int xenhcd_conn_notify(struct xenhcd_info *info) if (xenhcd_rhport_connect(info, portnum, speed)) { xenhcd_set_error(info, "Illegal data on conn-ring"); + spin_unlock_irqrestore(&info->lock, flags); return 0; }