From patchwork Thu Oct 10 13:13:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11183533 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 BA0871668 for ; Thu, 10 Oct 2019 13:14:39 +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 A2996206A1 for ; Thu, 10 Oct 2019 13:14:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A2996206A1 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 7522F6EB32; 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-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by gabe.freedesktop.org (Postfix) with ESMTPS id E22676EB2B; Thu, 10 Oct 2019 13:14:36 +0000 (UTC) Received: by mail-lj1-f196.google.com with SMTP id 7so6153368ljw.7; 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=7uV6DWb+5d+72lobYH9RlUHuo93UKxieqoJDmd2AkLE=; b=HWnpNNcSnogfiX0bECF/ibjJ4yQ+n11S8Y7WvLbsdqccZ1oOYH58wwsdHigxfbacJi BfNFgmSOEEe5YxuvDWaY0MuKqkbWU+j9HGAncNfZvixW1GvE6WYtwoPd22mWdlNQO/wH HtIFJ+PSmLrLZFezwb/F86nDqHH7MoAbXBXO4Ut24ZEt1u6NizGTTCtrINIjbXPnHq3U Hksl3As3UIK6juBrXWQhJyPUtOiuhnc9xflpKnaxLmHVuH1OMZutJU+2DoZmsS2oiu8W v7KL61SFCE3ZwHxpDhgJFOy8XXEzULJ6vcJuEHX3aKkt3+s/ooKFF7f+HHNrmc1Qub/1 Xd+g== X-Gm-Message-State: APjAAAUouiiHrNtORtCN/0rgZiRkCeACl83GXiT/tLrmAHDbFnwV1CpO Nkb/65t3XfQGPTa8IGl2r0Y= X-Google-Smtp-Source: APXvYqzFKhC+O0enYQEtd6+xCyXriydLhbwo0jiMAK6X/4MJHrEhzIRCF056ErjC0uEfoKkbTLxJHw== X-Received: by 2002:a2e:8ec2:: with SMTP id e2mr5820909ljl.126.1570713275165; Thu, 10 Oct 2019 06:14:35 -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 k7sm1184634lja.19.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-0006Ak-Dh; 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 1/4] drm/msm: fix memleak on release Date: Thu, 10 Oct 2019 15:13:30 +0200 Message-Id: <20191010131333.23635-2-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 , David Airlie , linux-arm-msm@vger.kernel.org, Heiko Carstens , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Johan Hovold , Christian Borntraeger , 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 "gpu" debugfs file and the drm device struct_mutex is contended, release() could return early and fail to free related resources. Note that the return value from release() is ignored. Fixes: 4f776f4511c7 ("drm/msm/gpu: Convert the GPU show function to use the GPU state") Cc: stable # 4.18 Cc: Jordan Crouse Cc: Rob Clark Signed-off-by: Johan Hovold Reviewed-by: Rob Clark --- drivers/gpu/drm/msm/msm_debugfs.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_debugfs.c b/drivers/gpu/drm/msm/msm_debugfs.c index 6be879578140..1c74381a4fc9 100644 --- a/drivers/gpu/drm/msm/msm_debugfs.c +++ b/drivers/gpu/drm/msm/msm_debugfs.c @@ -47,12 +47,8 @@ static int msm_gpu_release(struct inode *inode, struct file *file) struct msm_gpu_show_priv *show_priv = m->private; struct msm_drm_private *priv = show_priv->dev->dev_private; struct msm_gpu *gpu = priv->gpu; - int ret; - - ret = mutex_lock_interruptible(&show_priv->dev->struct_mutex); - if (ret) - return ret; + mutex_lock(&show_priv->dev->struct_mutex); gpu->funcs->gpu_state_put(show_priv->state); mutex_unlock(&show_priv->dev->struct_mutex); 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); From patchwork Thu Oct 10 13:13:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11183543 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 33A8F76 for ; Thu, 10 Oct 2019 13:14:48 +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 1B58521920 for ; Thu, 10 Oct 2019 13:14:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1B58521920 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 594A56EB34; Thu, 10 Oct 2019 13:14:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by gabe.freedesktop.org (Postfix) with ESMTPS id 53C226EB31; Thu, 10 Oct 2019 13:14:38 +0000 (UTC) Received: by mail-lf1-f66.google.com with SMTP id w6so4365284lfl.2; Thu, 10 Oct 2019 06:14:38 -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=YiNIRjj0pudykJaz7uCOQvjxph1wvoZUlYbTUR43Ji8=; b=bb52yX8YwGl9jj2OkVPsUY4Fg2BcI79cF0Zj91vWReJs8Sqhs4FYhgieS+JFRgRJ21 uvUkh58v8T4sBAbc126VlZS3AcDiiiV2i1TlbwlmSjykCz7Bp0Lx8ysUnDB4M1xy21EG GVoYoTJ0Os2bAFO81xwEagWUbWyAPOBhqj0l0QgBHzPEImc6ts4Jjnw+bWFSuoZ/x2B+ yBarfLDYwTyH6L0/u0jjwFwyictj9vmC8XlGrLNCf5/P0dhYIb6+bGGwU3LmwujXXgaQ krcH6IgD4vDWKkwsugE9uKuT+Ly0tGe+b5W0Lm0dOQDZIuS7wxCaZ3curuosF7V+MqTa 224A== X-Gm-Message-State: APjAAAUj3D4MytFrn4wALDbsQVaztmWVtXbH21zkauyfy0Dxy8SvSVQR 7PM6gRoTT14fGppSd/6JxBM= X-Google-Smtp-Source: APXvYqyCmQVkR/2FdzzVJEX6PjL3GNGbTAsSSuxU3ZMwE47t/9gz7cSpM9BywTnZ/2vtXS5zoQXYCg== X-Received: by 2002:a19:c392:: with SMTP id t140mr6140469lff.156.1570713276646; 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 f22sm1255270lfk.56.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-0006Au-Ju; 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 3/4] media: radio: wl1273: fix interrupt masking on release Date: Thu, 10 Oct 2019 15:13:32 +0200 Message-Id: <20191010131333.23635-4-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, Mauro Carvalho Chehab , Vasily Gorbik , David Airlie , linux-arm-msm@vger.kernel.org, Heiko Carstens , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Johan Hovold , Christian Borntraeger , Matti Aaltonen , 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 radio device and the core lock is contended, release() could return early and fail to update the interrupt mask. Note that the return value of the v4l2 release file operation is ignored. Fixes: 87d1a50ce451 ("[media] V4L2: WL1273 FM Radio: TI WL1273 FM radio driver") Cc: stable # 2.6.38 Cc: Matti Aaltonen Cc: Mauro Carvalho Chehab Signed-off-by: Johan Hovold --- drivers/media/radio/radio-wl1273.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/radio/radio-wl1273.c b/drivers/media/radio/radio-wl1273.c index 104ac41c6f96..112376873167 100644 --- a/drivers/media/radio/radio-wl1273.c +++ b/drivers/media/radio/radio-wl1273.c @@ -1148,8 +1148,7 @@ static int wl1273_fm_fops_release(struct file *file) if (radio->rds_users > 0) { radio->rds_users--; if (radio->rds_users == 0) { - if (mutex_lock_interruptible(&core->lock)) - return -EINTR; + mutex_lock(&core->lock); radio->irq_flags &= ~WL1273_RDS_EVENT; From patchwork Thu Oct 10 13:13:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11183539 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 5EF6B1668 for ; Thu, 10 Oct 2019 13:14:45 +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 475BB206B6 for ; Thu, 10 Oct 2019 13:14:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 475BB206B6 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 DE0BC6EB31; Thu, 10 Oct 2019 13:14:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2BB296EB36; Thu, 10 Oct 2019 13:14:39 +0000 (UTC) Received: by mail-lj1-f196.google.com with SMTP id v24so6178744ljj.3; Thu, 10 Oct 2019 06:14:39 -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=s1+YBubYAy3yg+TIRBWGGXrMgcLsTM12YLsh849J2aI=; b=Hc4BUbVAJvpxCgPsl2SKlk2UXzfLYFVIr2ATS65WZft3mP5VinSEJZf2kLDNuMIJBJ 9zHcbaqP0OsMRRKP1QuabSlB6z+3ICQpj1Wl18eqg2WoWwV7eu+qx+lKcWy3sYZqKu2J RxqDp5H/Zj3FO5P67tG/KrUISc7wbHDzbx+uS3A2WqUgfuqJv9QUc/uJRH1OqoOAN7jf wa03PaWU7hylrbRQeC8uU1q+6x0oPtRc2C31Pse1A77lyGbBVn1WkUPYg+ITY8QRnW8m tJrNMFzVN0tjIVoxs/XlSAdnP2LEaGcFuO8Ev325Pcukf4nNJn+o63myug47eePq3q6H ljrw== X-Gm-Message-State: APjAAAVVmg/xUSJAVceIjy7Rk3TIjsI+6vVu6/MIyRc8CF7Gq8Ob+ZDs rNUxT5rSR5d1gqNSTQStdH8= X-Google-Smtp-Source: APXvYqyGy/J5HJ8vBpZO6LgQKgo1ma21ffDHecTu24LtFMjl2KdmKbxfJ1wNcSxoN50D6wfsye9EWA== X-Received: by 2002:a2e:964c:: with SMTP id z12mr6158807ljh.79.1570713277523; Thu, 10 Oct 2019 06:14:37 -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 h3sm1238457lfc.26.2019.10.10.06.14.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Oct 2019 06:14:35 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.92.2) (envelope-from ) id 1iIYHF-0006Az-Mh; 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 4/4] s390/zcrypt: fix memleak at release Date: Thu, 10 Oct 2019 15:13:33 +0200 Message-Id: <20191010131333.23635-5-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 , David Airlie , linux-arm-msm@vger.kernel.org, Heiko Carstens , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Johan Hovold , Christian Borntraeger , stable , Greg Kroah-Hartman , Martin Schwidefsky , 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 crypto device and the global ap_perms_mutex is contented, release() could return early and fail to free related resources. Fixes: 00fab2350e6b ("s390/zcrypt: multiple zcrypt device nodes support") Cc: stable # 4.19 Cc: Harald Freudenberger Cc: Martin Schwidefsky Signed-off-by: Johan Hovold --- drivers/s390/crypto/zcrypt_api.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c index 45bdb47f84c1..9157e728a362 100644 --- a/drivers/s390/crypto/zcrypt_api.c +++ b/drivers/s390/crypto/zcrypt_api.c @@ -522,8 +522,7 @@ static int zcrypt_release(struct inode *inode, struct file *filp) if (filp->f_inode->i_cdev == &zcrypt_cdev) { struct zcdn_device *zcdndev; - if (mutex_lock_interruptible(&ap_perms_mutex)) - return -ERESTARTSYS; + mutex_lock(&ap_perms_mutex); zcdndev = find_zcdndev_by_devt(filp->f_inode->i_rdev); mutex_unlock(&ap_perms_mutex); if (zcdndev) {