Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp234916pxx; Wed, 28 Oct 2020 03:39:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0kyXrW3Ozvt/yTfzMmMfXitXVSjEQhquOL1NNiQW3iamWh+CG2wv/A1iajQhL1OO+Xz9t X-Received: by 2002:a05:6402:3064:: with SMTP id bs4mr7077013edb.140.1603881574790; Wed, 28 Oct 2020 03:39:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603881574; cv=none; d=google.com; s=arc-20160816; b=VV9zSf3Z5vyS6tjc3ZzrXLAuoZANwgiQjj6nxneH8W/QTECF2SjHP8/YK0VyOobhhd vzXCofsaAyjtPnl+M0ySUsmn/HhYbmhJoYmQ89uk9F5uTJsOv/9gXzl1ZhiOrSNju+y/ N9XkTl/vak9F0VIhnzoIm6+OGG8Y66i3/dR+U3ssqffe3VUV7Sy1LkVBoyW1Gdis0Hup HLU7tT8iqYtcvogufR+OcFCAPiIQiWY+yOLQy8ZmnpG04/QxMgdQXO8KDy75ztNQ+UUN MM7XrPFUIsWeYISsnd6T/LtVW+vHQf3OUEXwaUVO6gutIob+WFmq31g7rWURIIKHYPqB rc6Q== 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=lvpzvMQfJUZA4lhdcZqbPMuuh293S/a9xMRub06ZgTY=; b=FSK5wK5C91MNV48eEuidgZd+DqrbffVeQNGublg5RMXgFPPrr/BMfoclc7Q2eq6Nyk 205WkH4qYMn/no/v3W4WQB3VPaz3AMn+SlpEXIBB5fbpBky9RhT+v1CITeNzk2tHOhkX E0IrCpIPsKlFkeWTZKH3AhvR6R4dZ2Ax3GY8SLylhouE5HNwMSMTMAlJNKb7HB89H+V5 c6ViULM+J5KEPHOGD6maL1WFc13tz8wSKMCCA5wVI/bJTffmQC7DBbI6t8E02/Oh/zje yi9LJRUWMfAM+e3tpZZeDqgzLH1b1Tu+cLZtpzlDNMxXdKLAW5p9zk0z0nEssAyndbqC C9IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="q/B4b2V5"; 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 i19si2816688ejh.153.2020.10.28.03.39.12; Wed, 28 Oct 2020 03:39:34 -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="q/B4b2V5"; 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 S1763534AbgJ0Ooq (ORCPT + 99 others); Tue, 27 Oct 2020 10:44:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:43574 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762632AbgJ0Onp (ORCPT ); Tue, 27 Oct 2020 10:43:45 -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 36961206B2; Tue, 27 Oct 2020 14:43:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809824; bh=+n1S3A+tYy55zl/N+PuWYLmn/WLTr5AUGrt5WVfD6Nk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q/B4b2V5ja/0XaAkwDMSiuCLzP5kCScYWwndDbi5RWZVXXLd5/5ETb6C060TPqRDf pRniQrG4TyRCIFiIo2XucRkrelb2PJj/iHamJuUw0pJi7rwVIrndbywNPp2r+wlrg+ VR+d9dYaIsW5XjO4DXhsbVnNbBZnG1eAui4QyBYs= 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 5.4 332/408] media: sti: Fix reference count leaks Date: Tue, 27 Oct 2020 14:54:30 +0100 Message-Id: <20201027135510.440813609@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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 401aaafa17109..bb13348be0832 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; } @@ -553,6 +554,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