Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2351477ybp; Thu, 10 Oct 2019 06:15:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhW6gzw5aReKrvAvLPgFFq2bNnPsGV8mRL6KtrGJQUNAd85Cg2BXDuxeHZhdDYlvBP0/1s X-Received: by 2002:aa7:cfcd:: with SMTP id r13mr8195215edy.146.1570713316136; Thu, 10 Oct 2019 06:15:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570713316; cv=none; d=google.com; s=arc-20160816; b=uOMrcc0im54NJWKBoS6/xYUKE5Qv56ThAfdEzKY9VxjKRmr4Z4rHJEo4BYHniLtzQa hk6z3U0icd/yu1AhOdcagSJC45byxf7cCK1oueC6+KQIBLdEkEbAhYTEr9k+zZ2S57RR cm1WvD4aC+vayKUSzCTKccQkJF7yhA7i9uchkfe3pg9c6jizZVRjyZOaapsPe/27z2Ec 7pt1hSGiNAIcgMTDq5NMOp0Ce9BmQkQdGKbh+fBy5AetlUeWHXgYQdbVPXZsdowXsrMH JWNw0k3g+mcQdZw8Du6tEW+PoLzaM8w27ozK3GUp1RPIvQERF/y/WLV0OmAMaopfWN2+ hjFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=C0vnKt7A5LqxtaENHa2gtLyhDwSuKtDsHcAbgoX1Zl0=; b=KDhQhoXU85EvuvifM4ovJ7MBAdhE+JRVrWKGFuDF7apG8PjILJH/1rcRH/SJCHSBm9 gtUL2v8v5phH3ydIdAqKSrSyI+cqKfm5LEkwN7j1gxjHBSdvvYkXCofFEffVm3pq7F0u H4hOiG7ahU7uLuKWgGcux9taCd1aisF/IBbQHuhRrGz66vZHr5ufWA+EQklZi15VOjei cQWJgejJVjzMRSt/uUK8PePrRSLBIKW/fy1WaQq47TvqkWkyYdTr1rYz1iLphlrGty/B 1fjie4HDQAXXhkaOLbIdBobYH7tOjlDZKp1ggH3R986Kq/FFNIzbg9OdfZuOtvoODNdU Xfxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o14si3032411ejc.405.2019.10.10.06.14.51; Thu, 10 Oct 2019 06:15:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388130AbfJJNOk (ORCPT + 99 others); Thu, 10 Oct 2019 09:14:40 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:42514 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387660AbfJJNOj (ORCPT ); Thu, 10 Oct 2019 09:14:39 -0400 Received: by mail-lf1-f66.google.com with SMTP id c195so4342341lfg.9; Thu, 10 Oct 2019 06:14:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=C0vnKt7A5LqxtaENHa2gtLyhDwSuKtDsHcAbgoX1Zl0=; b=mKUro6qI4tkGzji199Sjih+X1LW+5kwSHBybETR5C3Z0BAQuNc1h6ap3yAs+qYM/Fv VXiN63Mvmz9COZZls9D0rFBQA8PqxfhAYq8Sh7irvoF1EBibyCsKMKba6TfKXViDjmVc 4qG/JWnJyj8S5lXKQK+LHhZDKNyY6z+SCBmNQV9TLWKKv3dUsWXyuxr+hpTZgenviQUT wbk69NZqWGMFk4SF3TriO1Q8wCzjtEIU7MdGfq0ihX2y3WcGAEgQPaA65uuNWsTjyRSh OJCeYod8w2hyoyc+kHGZo18ikV4QCrFRcfepVJc4fiPxX7z5dGGkXg7zwILAMyEPDN1d LrBQ== X-Gm-Message-State: APjAAAWp0bZS/EYDMOM7E0HOZfdnvICS9Yn81amA09sKjneuvLm+8HQW aZAETipFsp6O19vs2xfB7sY= X-Received: by 2002:a19:c514:: with SMTP id w20mr6058964lfe.135.1570713276057; Thu, 10 Oct 2019 06:14:36 -0700 (PDT) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id w27sm1233549ljd.55.2019.10.10.06.14.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Oct 2019 06:14:34 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.92.2) (envelope-from ) id 1iIYHF-0006Ap-GZ; Thu, 10 Oct 2019 15:14:45 +0200 From: Johan Hovold To: Rob Clark , Sean Paul , Fabien Dessenne , Mauro Carvalho Chehab , Harald Freudenberger Cc: David Airlie , Daniel Vetter , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-s390@vger.kernel.org, Greg Kroah-Hartman , Johan Hovold , stable , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 2/4] media: bdisp: fix memleak on release Date: Thu, 10 Oct 2019 15:13:31 +0200 Message-Id: <20191010131333.23635-3-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010131333.23635-1-johan@kernel.org> References: <20191010131333.23635-1-johan@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If a process is interrupted while accessing the video device and the device lock is contended, release() could return early and fail to free related resources. Note that the return value of the v4l2 release file operation is ignored. Fixes: 28ffeebbb7bd ("[media] bdisp: 2D blitter driver using v4l2 mem2mem framework") Cc: stable # 4.2 Cc: Fabien Dessenne Cc: Hans Verkuil Cc: Mauro Carvalho Chehab Signed-off-by: Johan Hovold --- drivers/media/platform/sti/bdisp/bdisp-v4l2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c index e90f1ba30574..675b5f2b4c2e 100644 --- a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c +++ b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c @@ -651,8 +651,7 @@ static int bdisp_release(struct file *file) dev_dbg(bdisp->dev, "%s\n", __func__); - if (mutex_lock_interruptible(&bdisp->lock)) - return -ERESTARTSYS; + mutex_lock(&bdisp->lock); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); -- 2.23.0