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: 11183531 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 0498A112B for ; Thu, 10 Oct 2019 13:14:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D94D3208C3 for ; Thu, 10 Oct 2019 13:14:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570713278; bh=FQX0xMB6lROMcqP/mnVeH32i9L3hg21Y95t5o1X1K6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ZEfqc01dg/meoezFkeHugm9KWIRSTei5th4z7t/olE/q8o5GH/SVPhzKOYYVcVgU9 nnQxAjnVY+FeCYgC5LzY2pm040g3eUFB3HZFaIiox/faW/qfZHuKFoKamEMiVeVbJs et7dSAA1qWPiFdflwTKf07NzAJxDmLMrwXUy1QCk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387828AbfJJNOi (ORCPT ); Thu, 10 Oct 2019 09:14:38 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:39234 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727788AbfJJNOi (ORCPT ); Thu, 10 Oct 2019 09:14:38 -0400 Received: by mail-lj1-f195.google.com with SMTP id y3so6161668ljj.6; Thu, 10 Oct 2019 06:14:35 -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=oXQr5K5AknmV7WOzIin2s0bc0UXSpL0sEbz5ZC7mWHK/Bna1bF0mswJNeGG1izrqEk HglDUe5pmeQk75c8IwkKyig/ND+fh+zwNHC1twqSJuHX4cvleN+woZqaMPzW1MIG3L7a bCEeIWmT+CuCv/I3uxDoiq9/NHRPo2uZQi9wWwnZk+W71el3Bl0C4Bh3E116gT49eZgr YCZrwzJFxS0DOju8ct9fGhAGby2z+Y4cnCN5GO34He4NKhcAgD1BCjFAOw84RE1OUX/u POxbm/sRphFQ+PJqP3RcneVkT3b+MVOHx/wx2H7ljYLexVweplYDx3jyNDhJWnh7Knrf +jnA== X-Gm-Message-State: APjAAAWzC/PNl+MBM3Z6U+4v3lAPhG2whTyBVZ+VMo8aM9O7I36g5CUj 0Hvq9Ffa025jCOkbtoVUpeI= 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 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 , Jordan Crouse 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 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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: 11183553 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 50BBB76 for ; Thu, 10 Oct 2019 13:14:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 32539214E0 for ; Thu, 10 Oct 2019 13:14:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570713292; bh=00oludAatgvPUo94IEAk1ex809k0kRn3C7x5fsmcZkU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ZQoV1laPpiV6GmD+wccLGgVDGDa6gEKQrAJZV1wdojwI6K+rVpg/p7ebEP0eG9vWo LWDbePGNyVTqDtkEnBzVfN29LQtzXYe51UMRJ9OGNjxfJQtobdZnG5WTESP68NcDGC hVoZbJamH2hWnsy5LN4w2KJiGQHeYe9KlLDkEWd4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727788AbfJJNOj (ORCPT ); Thu, 10 Oct 2019 09:14:39 -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-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 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 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 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: 11183551 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 BA09318B7 for ; Thu, 10 Oct 2019 13:14:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9A93621920 for ; Thu, 10 Oct 2019 13:14:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570713290; bh=QYPQPbKXANeWWzWZmjgnGXiHB/IRdHggQ9qoxHJb2bI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=h7VLbQwx4qvrSQgOOSuYyn4nbXEB4HNEQLyBNg75wkBtiXlagrJvyClvnLduYNiBw V07LD1kDE5XjZqatabUlb5FCRmEY5vqR2u741DAXQZ8I1QuTiOn+qS5K0glDBQbtS3 IXbQvuZZp8X6ay3EdXkFQvfJ6Uv7885j8rOy+Srs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388101AbfJJNOj (ORCPT ); Thu, 10 Oct 2019 09:14:39 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:40974 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387711AbfJJNOj (ORCPT ); Thu, 10 Oct 2019 09:14:39 -0400 Received: by mail-lf1-f66.google.com with SMTP id r2so4343859lfn.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=YiNIRjj0pudykJaz7uCOQvjxph1wvoZUlYbTUR43Ji8=; b=MyIKDDiCOcI/soRQUQl/XqxL9YioxJR3LTsTQfjHbMI9BWyDvWYTU7snZGBHOWIJzn zSD/89oLA3dZtfQapStsoSA2Lexc2nIp/h0iAi17IJZ+85E21cu86nlDw27DHThw0q9x eqL4Q25qJqzxbAEYrTPVaWz9BdPcsCgRPjNhTCLA9xLLKD1sZIQlxAfufmfa81uW7zB9 0vyW+/CtubHJCfehkPVNve454QAFg8T+gPbMFybJDa8dC5xWa+7AgFxk8rzbEMpYLgaX TPLtziwZ94J0FjzK+g9GEcJs9jw7FgR63wMFuMZaJvMorvE0gpqGHuYAngddZMnD0OtY HlfA== X-Gm-Message-State: APjAAAUxkQOCTBbH7yFyd+B25yMc8JdcTrdPPUARnetQJ9XJQ+6S2sTa 1FHa1n4gkybv+lSgx9zAwFI= 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 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 , Matti Aaltonen , Mauro Carvalho Chehab 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 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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: 11183557 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 EEBCB76 for ; Thu, 10 Oct 2019 13:14:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CFD73206B6 for ; Thu, 10 Oct 2019 13:14:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570713296; bh=hM0EHiZ+lbdsBaz/exs9ZfPI8jQI0gHEeaPxLpf9EPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=138cEdbEnVy95nev6oknjKZif2iU6HFR/M8toz8lJXvJiWGRAdRk5HyWxtRVq6gdf BNQ7wzrzhnRQiHFcCuS/slaIS0lc2LthnIhHTcDAuZ4+EuVRHEi5pS6ThuhADOUevF WHiLc4Am2hEejDoINpml5jbBIAFpQKMNzpWozZa8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388164AbfJJNOw (ORCPT ); Thu, 10 Oct 2019 09:14:52 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:37325 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388023AbfJJNOj (ORCPT ); Thu, 10 Oct 2019 09:14:39 -0400 Received: by mail-lj1-f193.google.com with SMTP id l21so6170980lje.4; 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=s1+YBubYAy3yg+TIRBWGGXrMgcLsTM12YLsh849J2aI=; b=GCr/BKYneZjSwP7jPBlb57caufJrp63/BJh+AMpnpy3T46QUyd0PB7z3TKPlz/5xmb 06BLf9DqaTSxVW8HGBv20bhkTfNZtZR8/ZFTA+hUJqYmog6w1FhiDCwNc/ii/kuTYizt 1PimM7DuCLDTY9YmidqlhDQOOybJdU1GeeR33idUDRiXvaMlSOKfq0EIeC1TwP16Me15 q2nHXRk+ucRL+MPVhmEf09UHJgASZSWpxvghJdOUq6UtFXOkeOCPOueXG/DAAzLx1jWq FeDivUhIp5k7UaF5IxOBuak3Jn5g9oZu8YpgU99zIpEjau4XONmzvEjZHwmUhSQIxaFu nzvQ== X-Gm-Message-State: APjAAAW4L0Rk+//uheyRhWs5FNdUMoD+vuhWF+tdQSOr3/HjgH7YDwb2 eQpkFOFJ9yupSGtwkUw8Ewxs4Y4v 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 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 , Martin Schwidefsky 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 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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) {