All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>,
	Fabien Dessenne <fabien.dessenne@st.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Harald Freudenberger <freude@linux.ibm.com>
Cc: David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	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 <gregkh@linuxfoundation.org>,
	Johan Hovold <johan@kernel.org>, stable <stable@vger.kernel.org>,
	Hans Verkuil <hans.verkuil@cisco.com>,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Subject: [PATCH 2/4] media: bdisp: fix memleak on release
Date: Thu, 10 Oct 2019 15:13:31 +0200	[thread overview]
Message-ID: <20191010131333.23635-3-johan@kernel.org> (raw)
In-Reply-To: <20191010131333.23635-1-johan@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 <stable@vger.kernel.org>     # 4.2
Cc: Fabien Dessenne <fabien.dessenne@st.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 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


WARNING: multiple messages have this Message-ID (diff)
From: Johan Hovold <johan@kernel.org>
To: Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>,
	Fabien Dessenne <fabien.dessenne@st.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Harald Freudenberger <freude@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, Vasily Gorbik <gor@linux.ibm.com>,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	David Airlie <airlied@linux.ie>,
	linux-arm-msm@vger.kernel.org,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Johan Hovold <johan@kernel.org>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Hans Verkuil <hans.verkuil@cisco.com>,
	stable <stable@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	freedreno@lists.freedesktop.org, linux-media@vger.kernel.org
Subject: [PATCH 2/4] media: bdisp: fix memleak on release
Date: Thu, 10 Oct 2019 15:13:31 +0200	[thread overview]
Message-ID: <20191010131333.23635-3-johan@kernel.org> (raw)
In-Reply-To: <20191010131333.23635-1-johan@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 <stable@vger.kernel.org>     # 4.2
Cc: Fabien Dessenne <fabien.dessenne@st.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2019-10-10 13:14 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10 13:13 [PATCH 0/4] treewide: fix interrupted release Johan Hovold
2019-10-10 13:13 ` [PATCH 1/4] drm/msm: fix memleak on release Johan Hovold
2019-10-30 10:01   ` Johan Hovold
2019-10-30 10:01     ` Johan Hovold
2019-10-30 10:01     ` Johan Hovold
2019-11-12 10:40     ` Johan Hovold
2019-11-12 10:40       ` Johan Hovold
2019-11-12 14:01       ` Daniel Vetter
2019-11-12 14:01         ` Daniel Vetter
2019-11-12 16:32         ` Rob Clark
2019-11-12 16:32           ` Rob Clark
2019-11-12 20:42           ` Sean Paul
2019-11-12 20:42             ` Sean Paul
2019-11-12 20:42             ` Sean Paul
2019-10-10 13:13 ` Johan Hovold [this message]
2019-10-10 13:13   ` [PATCH 2/4] media: bdisp: " Johan Hovold
2019-10-10 14:07   ` Fabien DESSENNE
2019-10-10 13:13 ` [PATCH 3/4] media: radio: wl1273: fix interrupt masking " Johan Hovold
2019-10-10 13:13 ` [PATCH 4/4] s390/zcrypt: fix memleak at release Johan Hovold
2019-10-10 13:13   ` Johan Hovold
2019-10-14  6:18   ` Heiko Carstens
2019-10-10 13:50 ` [PATCH 0/4] treewide: fix interrupted release Daniel Vetter
2019-10-10 13:50   ` Daniel Vetter
2019-10-11  9:36   ` Johan Hovold
2019-10-11  9:36     ` Johan Hovold
2019-10-14  8:48     ` Daniel Vetter
2019-10-14 16:13       ` Johan Hovold
2019-10-15 14:07         ` Daniel Vetter
2019-10-15 14:07           ` Daniel Vetter
2019-10-21  9:55           ` Johan Hovold
2019-10-21  9:55             ` Johan Hovold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191010131333.23635-3-johan@kernel.org \
    --to=johan@kernel.org \
    --cc=airlied@linux.ie \
    --cc=borntraeger@de.ibm.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fabien.dessenne@st.com \
    --cc=freedreno@lists.freedesktop.org \
    --cc=freude@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hans.verkuil@cisco.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mchehab@osg.samsung.com \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.