Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp578082pxx; Wed, 28 Oct 2020 11:32:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2973XQzu/pVF7zsMAjJQLIG0VRp5hIiQPCRVrNqSfDQVgxYrZmMj3b+OWxhs9b0+5+aF3 X-Received: by 2002:a17:906:1d53:: with SMTP id o19mr443943ejh.468.1603909966728; Wed, 28 Oct 2020 11:32:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603909966; cv=none; d=google.com; s=arc-20160816; b=mjt0amKmoLzA3pESbYxD/4Ww7Vm2mwaEBP7rUXB88VD49EWuFFdnf2/XildZK/ZfBR GlXm52w7o9W2VND+Upa73oIML16TwboQOvmY/nZb2k4BsgninQohF/Gy+MFCb8zLMc7g yvrkLlY5vSjw7jSZypN9ZbniihXNoDXY57FPxwYR7yYZrBXhx1JLSs2RtjW5ef5Mh75G QjzYjE8t6gOK+NACGUUGJLK/vecU61VOsPI/t4mvXgqJaNVJ2EAgnzyUDI99+wejwuEc ro6YHEkjj9SXq1gmBJAYj/d7eeNlFp2qkLnZtOBx7TbwXIo2J/NBOa5DtY0lk/zrJa33 4Ftg== 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=kdTrvG573s4YEiw97KIeUUwaw1qUr10/NBS7XlzpN6k=; b=i5rxvFf7mdt7gZz6MzDxCgyk35qOBT2xesvXZhgDf4LGAL7EOQU7LombjMHBhQkhFv jyroJT3Y09664mv38iWjy172VngI5XeDC8dcgFfcksRDzygGAXnZAHWeOlJz6/nRE0ce 8wPFXlUWXK83P1g5afZtjDpsqslgMIwcTdo884Ca83BEjbHjPG5bEY0fqbMrRx9fWFSE UljONt07Ev6jqvGjGDXEEa6iHILG6l9cEpHwLzahKFcPnkzjqFtVhBQXlF+QGFd+v1Sd dbiETpCdUTwrJuQTujfAisyNxm/fVS3R6yGFij3v0K5IQ2nx6od+zweU5/eEHHqo0MgJ nSiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jI0UGz0D; 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 8si179023edx.375.2020.10.28.11.32.24; Wed, 28 Oct 2020 11:32:46 -0700 (PDT) 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=jI0UGz0D; 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 S1825153AbgJ0SJD (ORCPT + 99 others); Tue, 27 Oct 2020 14:09:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:37492 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757000AbgJ0OPj (ORCPT ); Tue, 27 Oct 2020 10:15:39 -0400 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 3D4E322263; Tue, 27 Oct 2020 14:15:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808138; bh=FV/Fsa8Ro2Tm8IxfuIe/29ElMOBuhWSuAw5wnXh3vl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jI0UGz0D9qnpV0rT3dEQ58kabqNu76iqjlCDSSeCOVt/cvw/0tQRSjosvK6nofGuf 8xFzli/3FZQTQdex1qINFvx8MwV8M/KQW8TD7BReJPt4evyPWBuHOkFpL7U+BldMav cH6IkC8ou0NPvlx1U/4DsT8j3SMDMk4ea15X4mrg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qiushi Wu , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.14 140/191] media: sti: Fix reference count leaks Date: Tue, 27 Oct 2020 14:49:55 +0100 Message-Id: <20201027134916.441142869@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134909.701581493@linuxfoundation.org> References: <20201027134909.701581493@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: Qiushi Wu [ Upstream commit 6f4432bae9f2d12fc1815b5e26cc07e69bcad0df ] pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code, causing incorrect ref count if pm_runtime_put_noidle() is not called in error handling paths. Thus call pm_runtime_put_noidle() if pm_runtime_get_sync() fails. Signed-off-by: Qiushi Wu Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/sti/hva/hva-hw.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/sti/hva/hva-hw.c b/drivers/media/platform/sti/hva/hva-hw.c index ec25bdcfa3d1e..8dce2ccc551cb 100644 --- a/drivers/media/platform/sti/hva/hva-hw.c +++ b/drivers/media/platform/sti/hva/hva-hw.c @@ -272,6 +272,7 @@ static unsigned long int hva_hw_get_ip_version(struct hva_dev *hva) if (pm_runtime_get_sync(dev) < 0) { dev_err(dev, "%s failed to get pm_runtime\n", HVA_PREFIX); + pm_runtime_put_noidle(dev); mutex_unlock(&hva->protect_mutex); return -EFAULT; } @@ -557,6 +558,7 @@ void hva_hw_dump_regs(struct hva_dev *hva, struct seq_file *s) if (pm_runtime_get_sync(dev) < 0) { seq_puts(s, "Cannot wake up IP\n"); + pm_runtime_put_noidle(dev); mutex_unlock(&hva->protect_mutex); return; } -- 2.25.1