linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Lv Yunlong <lyl2019@mail.ustc.edu.cn>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	Sasha Levin <sashal@kernel.org>,
	linux-media@vger.kernel.org
Subject: [PATCH AUTOSEL 5.12 42/80] media: v4l2-core: Avoid the dangling pointer in v4l2_fh_release
Date: Sun,  4 Jul 2021 19:05:38 -0400	[thread overview]
Message-ID: <20210704230616.1489200-42-sashal@kernel.org> (raw)
In-Reply-To: <20210704230616.1489200-1-sashal@kernel.org>

From: Lv Yunlong <lyl2019@mail.ustc.edu.cn>

[ Upstream commit 7dd0c9e547b6924e18712b6b51aa3cba1896ee2c ]

A use after free bug caused by the dangling pointer
filp->privitate_data in v4l2_fh_release.
See https://lore.kernel.org/patchwork/patch/1419058/.

My patch sets the dangling pointer to NULL to provide
robust.

Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/media/v4l2-core/v4l2-fh.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/v4l2-core/v4l2-fh.c b/drivers/media/v4l2-core/v4l2-fh.c
index 684574f58e82..90eec79ee995 100644
--- a/drivers/media/v4l2-core/v4l2-fh.c
+++ b/drivers/media/v4l2-core/v4l2-fh.c
@@ -96,6 +96,7 @@ int v4l2_fh_release(struct file *filp)
 		v4l2_fh_del(fh);
 		v4l2_fh_exit(fh);
 		kfree(fh);
+		filp->private_data = NULL;
 	}
 	return 0;
 }
-- 
2.30.2


  parent reply	other threads:[~2021-07-04 23:08 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210704230616.1489200-1-sashal@kernel.org>
2021-07-04 23:04 ` [PATCH AUTOSEL 5.12 03/80] staging: media: rkvdec: fix pm_runtime_get_sync() usage count Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 04/80] media: i2c: imx334: fix the pm runtime get logic Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 05/80] media: marvel-ccic: fix some issues when getting pm_runtime Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 06/80] media: mdk-mdp: fix pm_runtime_get_sync() usage count Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 07/80] media: s5p: " Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 08/80] media: am437x: " Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 09/80] media: sh_vou: " Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 10/80] media: mtk-vcodec: fix PM runtime get logic Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 11/80] media: s5p-jpeg: fix pm_runtime_get_sync() usage count Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 12/80] media: sunxi: " Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 13/80] media: sti/bdisp: " Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 14/80] media: exynos4-is: " Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 15/80] media: exynos-gsc: " Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 24/80] media: sti: fix obj-$(config) targets Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 26/80] media: cpia2: fix memory leak in cpia2_usb_probe Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 27/80] media: cobalt: fix race condition in setting HPD Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 28/80] media: hevc: Fix dependent slice segment flags Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 29/80] media: pvrusb2: fix warning in pvr2_i2c_core_done Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 30/80] media: imx: imx7_mipi_csis: Fix logging of only error event counters Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 37/80] media: i2c: ov2659: Use clk_{prepare_enable,disable_unprepare}() to set xvclk on/off Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 38/80] media: bt878: do not schedule tasklet when it is not setup Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 39/80] media: em28xx: Fix possible memory leak of em28xx struct Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 40/80] media: hantro: Fix .buf_prepare Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 41/80] media: cedrus: " Sasha Levin
2021-07-04 23:05 ` Sasha Levin [this message]
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 43/80] media: bt8xx: Fix a missing check bug in bt878_probe Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 44/80] media: st-hva: Fix potential NULL pointer dereferences Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 47/80] media: dvd_usb: memory leak in cinergyt2_fe_attach Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 56/80] media: dvb_net: avoid speculation from net slot Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 57/80] media: dvbdev: fix error logic at dvb_register_device() Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 58/80] media: siano: fix device register error path Sasha Levin
2021-07-04 23:05 ` [PATCH AUTOSEL 5.12 59/80] media: imx-csi: Skip first few frames from a BT.656 source Sasha Levin
2021-07-04 23:06 ` [PATCH AUTOSEL 5.12 80/80] media: Fix Media Controller API config checks Sasha Levin

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=20210704230616.1489200-42-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=lyl2019@mail.ustc.edu.cn \
    --cc=mchehab+huawei@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).