Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9287574pxu; Mon, 28 Dec 2020 11:27:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzLLhbqV+mfnDeU1g9DyAxL5PwSOmY6pNBWARO6JG3vZM7/AHsKYhDLiLJEGe8JcYzdxO1h X-Received: by 2002:a50:e882:: with SMTP id f2mr42204360edn.76.1609183669932; Mon, 28 Dec 2020 11:27:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609183669; cv=none; d=google.com; s=arc-20160816; b=jaP4cSeZpkU6c2dbC65QyRF70VNc1gX+sdmp/uV0rIdhNSvcstbklDEeTpLZJrK/jU Nj7zZp/LVlAQOvnFgmOoymwffcpVOGQ+Z5+esqaB5S95XaIUOIzeMp3Pg6NZNpAZKMkQ ATh/qA+1E0DXd7RQOCM2G58yxsrvwRRJFZFWse5snZixXJvUfKKYZ6X/AUJOOzola1GZ oVH3zOzC2NFmhJMi2ne5gGCav+BX5fsig+e9oBXlYa0tkDXIjarhQAEPoJ0mTTpsucfR PcKIU6lmcTE3ioeLNC+s6K+urk3Z4lj1psydAWaCJX4/VI47Ro3248oaffscbzOxfTO3 EXRg== 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=6UBlQ5UNo0apvLrlDbp7dp63b713ovl9SfDV/9hP14k=; b=had1bUgGLgUJNscgV5pgV2RkIP9Y3f6M6dod9060A0wofCwfgyCMB4LhVmB560u73E N8WBkG4ZF1JsWfU9DxfEJyLeUitozYWgT+2q/IVeaLNre7cjd/TvY6RIL3YmmY1HAAUv vOdefqsBPatkmnbIhkPDV3+85AVJJFHPeU6bboHcEO1wZKxFwK8frgI73uQZgtP9hEMb LpHAVb6gUro4qRnGxDudpzBU/xvFnNy5lpDwH7daWONXPfz/hoa+GKuFA8bevJ2Zy0Da Ze46OqnVGnnHdrVCuKFQYrYoMKzm9TOuX0UMe5SPD1mXGcME+TSVQxFBbsyFSjXPKBfM NJuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=flm1lo2y; 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=pass (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 dt1si21359346ejc.558.2020.12.28.11.27.28; Mon, 28 Dec 2020 11:27:49 -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=@linuxfoundation.org header.s=korg header.b=flm1lo2y; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437013AbgL1OCv (ORCPT + 99 others); Mon, 28 Dec 2020 09:02:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:36026 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436986AbgL1OCu (ORCPT ); Mon, 28 Dec 2020 09:02:50 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6E28B2063A; Mon, 28 Dec 2020 14:02:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164155; bh=FL0hmHsnvP38+KHy9XF381cvRatHQvShItITaNRVtFs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=flm1lo2ySwJ2uTJBEZOXFS+N5BY8N8tM/htC4KpQUIAisRNB08uGueXJRaofSsguf gDWcYtkvM5TxPFCLSuYJ4JlJykcGEIZZlJv/6P9O3DZ4KKQyIm48cAyBpU9AxZ8kkQ IO1asPhxMuqq9K4jUHDJETk4whCzD29gxl85ODy0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Mark Brown , Sasha Levin Subject: [PATCH 5.10 050/717] spi: spi-mem: fix reference leak in spi_mem_access_start Date: Mon, 28 Dec 2020 13:40:48 +0100 Message-Id: <20201228125023.389103430@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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 [ Upstream commit c02bb16b0e826bf0e19aa42c3ae60ea339f32cf5 ] pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to pm_runtime_put_noidle will result in reference leak in spi_mem_access_start, so we should fix it. Fixes: f86c24f479530 ("spi: spi-mem: Split spi_mem_exec_op() code") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20201103140910.3482-1-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-mem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c index ef53290b7d24d..4682f49dc7330 100644 --- a/drivers/spi/spi-mem.c +++ b/drivers/spi/spi-mem.c @@ -243,6 +243,7 @@ static int spi_mem_access_start(struct spi_mem *mem) ret = pm_runtime_get_sync(ctlr->dev.parent); if (ret < 0) { + pm_runtime_put_noidle(ctlr->dev.parent); dev_err(&ctlr->dev, "Failed to power device: %d\n", ret); return ret; -- 2.27.0