Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3852579pxb; Tue, 17 Nov 2020 05:25:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJzmGjRNjiFrbqgrLEE14QOJRjSvqFmoknm8E4qrDMjFx6N0YVgbtJO8XO02yORD5CGiFZBf X-Received: by 2002:a17:906:a4b:: with SMTP id x11mr19861421ejf.11.1605619510957; Tue, 17 Nov 2020 05:25:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605619510; cv=none; d=google.com; s=arc-20160816; b=tRu3VfUJxI/h4K6O0rTglxtXeOwuht8BOOsHILiltNrE3WPQFXLt8Rp3VL3TofQIM/ ShAvqTZqB2Arq6hF+Dx09Qf/lwzha+WLdlFXVXO0DPvN8qhgcZXnbhZuZHQpuQf/HCYQ Ao8dJHJY+0TCKa8xydt2ks61JRETGCMoCzJUOV8la0ICbWv887FDwzW1vPyuKS/E5KYR B7KEvLCl4+Fw7aoNwvWEbAJfUiYONZ/YUKweQSmk2j1TPq759kNPQZBgwHGLOV5h2PIQ +bbSeGPzfJQVVJpISyqftj7TYkqmDI9O+GVFF1DtELgXzoNMrvfRYj7WYQ1WqJ6/pcz1 Cmzw== 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=HsKbleFxfX51jSu2OW8U8yyYJ0co0XpJHeaeaiMsZew=; b=b5KfpErlqVI6++xy7nr0qLUmkI3S7itKJjD9APnl6LQH6te5mOsXzsGtT8Oxzp+nQk xtVYTs4ViXs/4nK5AJG29tcA4VDYDlfBQTrHpb7GL9xTiN/l4bPcxBO/RVuAYRnSdoDx iVx8O2G9//4XEX6I6bPDOnO3uzEIIVVmXgOi0IJNb0Hu0DhScaa5UplQkcCh+/ZmA/wi cLfS5pigzKSU/fvh1Lgnn+lZIsnrm99EdhnWeBHfXpE/WGcL/J4OusLupaKM0S2hJ1lZ kxEx9vOpuFxo/kqm6F+j0rFi4ZC+MhGwugZDR9ii6bBaMyiBjOBgYxMpdidw1upQg1e5 0p8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Spb+A/mE"; 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 y5si1373303edp.420.2020.11.17.05.24.46; Tue, 17 Nov 2020 05:25:10 -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="Spb+A/mE"; 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 S1730792AbgKQNUq (ORCPT + 99 others); Tue, 17 Nov 2020 08:20:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:54078 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730764AbgKQNUe (ORCPT ); Tue, 17 Nov 2020 08:20:34 -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 93E58241A5; Tue, 17 Nov 2020 13:20:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605619234; bh=AQ4pGKsA9yx3wFWgo1/O9cVVXd+CWFA1qClgYFjhxQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Spb+A/mEJIP+xyS/IXFyL4oYFkXtxbW1LDT4s95NEzJaOBIJQ+Tnu9+GBSlwzIb9J TuhCRNO8XZvP+QxqcSAs5qcijuusMw377coUXklPQnDowyHEUL7f/MRQqtgtN353Hf 8+MGUQ4ZD2gGbsWr1De1RmZ9hVxW2MsUp+l8BOxU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong Subject: [PATCH 4.19 071/101] xhci: hisilicon: fix refercence leak in xhci_histb_probe Date: Tue, 17 Nov 2020 14:05:38 +0100 Message-Id: <20201117122116.574689196@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122113.128215851@linuxfoundation.org> References: <20201117122113.128215851@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 @@ -241,7 +241,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) {