Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3864647pxb; Tue, 17 Nov 2020 05:42:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxm4aYj5LOA1tPQsn98n7lLwj9KGdY8JZM/yy3+gIhNW5neMfAeibSfoAo7D/9gpj7o0UKf X-Received: by 2002:a17:906:a4b:: with SMTP id x11mr19927256ejf.11.1605620565472; Tue, 17 Nov 2020 05:42:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605620565; cv=none; d=google.com; s=arc-20160816; b=JPpdIkgddQ3TNSLU02ajY87Kk5OVhRoeEbyeTgHALf+kGmsHTikW8YBlWQTTVvfy01 s1OET466mfRNZwwlLOOf/h2QkOW0H9SHrWQtf/pDxO4YTvsDQBnqq8ZTt5lHGaF9IE+F 06nSNS4Dazh+hE+C9fe57xwk+jOA9ELdQFqWEBXdsbmhiU5BL1l3eIvVdp8P8oasVVdy SUYybIuFwg4oHy7+gKv7ClOy53LUuoVI8CDLwLeo/2x1FvJ1bJ/3YJUau774Z6tqeVaK RyWPpfxt0kiXpBpe1jpcY8gamnhEqUVC7a9WXpfIZ9Ebyv6+I0GHUIc3oQTNhJKoOs+M eU/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Qchdzs+iVQj0w7hMWVXQWNiiNkfdV78a1VMpevAkDDQ=; b=pT/4yJ3vmZXXhhSVyoiYvng22SXpxOe+fyXBa++HnwV4k9zAwyN6QukJ9Qw2tLSTHl xRsrw3yppPZtBomhvu4t+8mQrbfa2gM6hUaKrJ/im8maEw/Zm9nPZVpGtrOAMJJ2p9nI nLnNGsVZTlbBdiW6raK87g7Ej8KELOVF6cuqePfiPXndPuNLB/4yMAAJs6X/D5K5+nBF /QZiEgaR5z/NdM0/3+828t/YuuwnI+ds/OTpwBjWgAiSSIb/z55iTQWVJJ5tZkC6/cbU WxSJhFjQSC6kqqdO9IjTE8hog6eVaub6Q58c+34QM+qbwrGlKSF8kgy+XZ1/reKPeFUj 4jNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BBIT95Xc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g23si13899071edr.322.2020.11.17.05.42.22; Tue, 17 Nov 2020 05:42:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BBIT95Xc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732810AbgKQNj5 (ORCPT + 99 others); Tue, 17 Nov 2020 08:39:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:51762 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732776AbgKQNjv (ORCPT ); Tue, 17 Nov 2020 08:39:51 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 871B620870; Tue, 17 Nov 2020 13:39:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605620391; bh=HswQOayRJA3M7pC77Ok4nA9JGibXpiliqFLdEbe2UjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BBIT95XchfARYyS3SYEK9uqUDwElNv23gRHpceSB3+2wo8NKCEkniR9jesoIyUbU3 naitKVahB3BwLYLsK9VWrx6GlScBWRuyG2tRzYxpUVeE1Q074p7TFC/dST8DOZDjFZ hAW5fe5ZK0pygpxLJpj2qGSdIq3pskuR7nj+7i+E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong Subject: [PATCH 5.9 203/255] xhci: hisilicon: fix refercence leak in xhci_histb_probe Date: Tue, 17 Nov 2020 14:05:43 +0100 Message-Id: <20201117122148.811471287@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhang Qilong commit 76255470ffa2795a44032e8b3c1ced11d81aa2db upstream. pm_runtime_get_sync() will increment pm usage at first and it will resume the device later. We should decrease the usage count whetever it succeeded or failed(maybe runtime of the device has error, or device is in inaccessible state, or other error state). If we do not call put operation to decrease the reference, it will result in reference leak in xhci_histb_probe. Moreover, this device cannot enter the idle state and always stay busy or other non-idle state later. So we fixed it by jumping to error handling branch. Fixes: c508f41da0788 ("xhci: hisilicon: support HiSilicon STB xHCI host controller") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20201106122221.2304528-1-zhangqilong3@huawei.com Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci-histb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/host/xhci-histb.c +++ b/drivers/usb/host/xhci-histb.c @@ -240,7 +240,7 @@ static int xhci_histb_probe(struct platf /* Initialize dma_mask and coherent_dma_mask to 32-bits */ ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); if (ret) - return ret; + goto disable_pm; hcd = usb_create_hcd(driver, dev, dev_name(dev)); if (!hcd) {