From patchwork Thu Oct 10 13:13:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11183537 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 971D576 for ; Thu, 10 Oct 2019 13:14:43 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7F70A206B6 for ; Thu, 10 Oct 2019 13:14:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F70A206B6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EC1B56EB2B; Thu, 10 Oct 2019 13:14:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-f67.google.com (mail-lf1-f67.google.com [209.85.167.67]) by gabe.freedesktop.org (Postfix) with ESMTPS id AFA3B6EB2B; Thu, 10 Oct 2019 13:14:37 +0000 (UTC) Received: by mail-lf1-f67.google.com with SMTP id r2so4343830lfn.8; Thu, 10 Oct 2019 06:14:37 -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=amo5EeeW38zmhV8hw1eDSllgNV7Utg4k8OJKcmHXG5ZV3Mt2RZoXJCEyZSeywGlz6M enG3czf/3wyoEyngw+kjBpEH176yhR4TBr4CAG6dEAbbyLNbMX95Bnmsbt+IwhczIMqY e8hGw9Xc8zPF7W7y/ZvFVB0EtmhusCg59XS2AmxSSRtv7bQCh+1UDglbhNQcgnMSy6Z4 nyFtWjrLElo79F5CpLj3NHkdWD3mx2gyhez/hOKqwTX+iPxDolbEdILNTmTRTJO4P5ET QZXjtjjMWH9xdddT40UaSqDLzC2/c5TAgGHqBWqQLRK69GNhsVGh1lzvAZF4AeWB0j52 5HCw== X-Gm-Message-State: APjAAAVNG5I02dqLmaf2v3pmR2xLNDNOgyC+3VE1ZwROCox8dhrRaR+q YP+0g2eKod2gSPZnsoxCC6Q= X-Google-Smtp-Source: APXvYqzmken7paFvOEfr/CD2e/T7S2TzQVEBo50hTfTSua/scq6cymNNbisN35TBca4BLqUtqWWS/w== 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 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-s390@vger.kernel.org, Vasily Gorbik , Mauro Carvalho Chehab , David Airlie , linux-arm-msm@vger.kernel.org, Heiko Carstens , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Johan Hovold , Christian Borntraeger , Hans Verkuil , stable , Greg Kroah-Hartman , freedreno@lists.freedesktop.org, linux-media@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Reviewed-by: Fabien Dessenne --- 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);