From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Mike Isely <isely@pobox.com>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Sasha Levin <sashal@kernel.org>,
linux-media@vger.kernel.org
Subject: [PATCH AUTOSEL 5.4 252/350] media: pvrusb2: Fix oops on tear-down when radio support is not present
Date: Tue, 10 Dec 2019 16:05:57 -0500 [thread overview]
Message-ID: <20191210210735.9077-213-sashal@kernel.org> (raw)
In-Reply-To: <20191210210735.9077-1-sashal@kernel.org>
From: Mike Isely <isely@pobox.com>
[ Upstream commit 7f404ae9cf2a285f73b3c18ab9303d54b7a3d8e1 ]
In some device configurations there's no radio or radio support in the
driver. That's OK, as the driver sets itself up accordingly. However
on tear-down in these caes it's still trying to tear down radio
related context when there isn't anything there, leading to
dereferences through a null pointer and chaos follows.
How this bug survived unfixed for 11 years in the pvrusb2 driver is a
mystery to me.
[hverkuil: fix two checkpatch warnings]
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
index a34717eba409b..eaa08c7999d4f 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
@@ -898,8 +898,12 @@ static void pvr2_v4l2_internal_check(struct pvr2_channel *chp)
pvr2_v4l2_dev_disassociate_parent(vp->dev_video);
pvr2_v4l2_dev_disassociate_parent(vp->dev_radio);
if (!list_empty(&vp->dev_video->devbase.fh_list) ||
- !list_empty(&vp->dev_radio->devbase.fh_list))
+ (vp->dev_radio &&
+ !list_empty(&vp->dev_radio->devbase.fh_list))) {
+ pvr2_trace(PVR2_TRACE_STRUCT,
+ "pvr2_v4l2 internal_check exit-empty id=%p", vp);
return;
+ }
pvr2_v4l2_destroy_no_lock(vp);
}
@@ -935,7 +939,8 @@ static int pvr2_v4l2_release(struct file *file)
kfree(fhp);
if (vp->channel.mc_head->disconnect_flag &&
list_empty(&vp->dev_video->devbase.fh_list) &&
- list_empty(&vp->dev_radio->devbase.fh_list)) {
+ (!vp->dev_radio ||
+ list_empty(&vp->dev_radio->devbase.fh_list))) {
pvr2_v4l2_destroy_no_lock(vp);
}
return 0;
--
2.20.1
next prev parent reply other threads:[~2019-12-10 21:12 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-10 21:02 [PATCH AUTOSEL 5.4 040/350] media: ov6650: Fix control handler not freed on init error Sasha Levin
2019-12-10 21:02 ` [PATCH AUTOSEL 5.4 041/350] media: i2c: ov2659: fix s_stream return value Sasha Levin
2019-12-10 21:02 ` [PATCH AUTOSEL 5.4 042/350] media: ov6650: Fix crop rectangle alignment not passed back Sasha Levin
2019-12-10 21:02 ` [PATCH AUTOSEL 5.4 043/350] media: i2c: ov2659: Fix missing 720p register config Sasha Levin
2019-12-10 21:02 ` [PATCH AUTOSEL 5.4 044/350] media: ov6650: Fix stored frame format not in sync with hardware Sasha Levin
2019-12-10 21:02 ` [PATCH AUTOSEL 5.4 045/350] media: ov6650: Fix stored crop rectangle " Sasha Levin
2019-12-10 21:02 ` [PATCH AUTOSEL 5.4 047/350] media: venus: core: Fix msm8996 frequency table Sasha Levin
2019-12-10 21:02 ` [PATCH AUTOSEL 5.4 049/350] media: vimc: Fix gpf in rmmod path when stream is active Sasha Levin
2019-12-10 21:02 ` [PATCH AUTOSEL 5.4 058/350] media: venus: Fix occasionally failures to suspend Sasha Levin
2019-12-10 21:02 ` [PATCH AUTOSEL 5.4 066/350] media: flexcop-usb: fix NULL-ptr deref in flexcop_usb_transfer_init() Sasha Levin
2019-12-10 21:02 ` [PATCH AUTOSEL 5.4 067/350] media: cec-funcs.h: add status_req checks Sasha Levin
2019-12-10 21:02 ` [PATCH AUTOSEL 5.4 068/350] media: meson/ao-cec: move cec_notifier_cec_adap_register after hw setup Sasha Levin
2019-12-10 21:03 ` [PATCH AUTOSEL 5.4 084/350] media: cx88: Fix some error handling path in 'cx8800_initdev()' Sasha Levin
2019-12-10 21:03 ` [PATCH AUTOSEL 5.4 089/350] media: ti-vpe: vpe: Fix Motion Vector vpdma stride Sasha Levin
2019-12-10 21:03 ` [PATCH AUTOSEL 5.4 090/350] media: ti-vpe: vpe: fix a v4l2-compliance warning about invalid pixel format Sasha Levin
2019-12-10 21:03 ` [PATCH AUTOSEL 5.4 091/350] media: ti-vpe: vpe: fix a v4l2-compliance failure about frame sequence number Sasha Levin
2019-12-10 21:03 ` [PATCH AUTOSEL 5.4 092/350] media: ti-vpe: vpe: Make sure YUYV is set as default format Sasha Levin
2019-12-10 21:03 ` [PATCH AUTOSEL 5.4 093/350] media: ti-vpe: vpe: fix a v4l2-compliance failure causing a kernel panic Sasha Levin
2019-12-10 21:03 ` [PATCH AUTOSEL 5.4 094/350] media: ti-vpe: vpe: ensure buffers are cleaned up properly in abort cases Sasha Levin
2019-12-10 21:03 ` [PATCH AUTOSEL 5.4 097/350] media: ti-vpe: vpe: fix a v4l2-compliance failure about invalid sizeimage Sasha Levin
2019-12-10 21:04 ` [PATCH AUTOSEL 5.4 144/350] media: cedrus: Fix undefined shift with a SHIFT_AND_MASK_BITS macro Sasha Levin
2019-12-10 21:04 ` [PATCH AUTOSEL 5.4 145/350] media: aspeed: set hsync and vsync polarities to normal before starting mode detection Sasha Levin
2019-12-10 21:04 ` [PATCH AUTOSEL 5.4 147/350] media: ov6650: Fix stored frame interval not in sync with hardware Sasha Levin
2019-12-10 21:04 ` [PATCH AUTOSEL 5.4 148/350] media: ad5820: Define entity function Sasha Levin
2019-12-12 12:19 ` Pavel Machek
2019-12-12 12:24 ` Greg KH
2019-12-12 13:48 ` Pavel Machek
2019-12-10 21:04 ` [PATCH AUTOSEL 5.4 149/350] media: ov5640: Make 2592x1944 mode only available at 15 fps Sasha Levin
2019-12-10 21:04 ` [PATCH AUTOSEL 5.4 150/350] media: st-mipid02: add a check for devm_gpiod_get_optional Sasha Levin
2019-12-10 21:04 ` [PATCH AUTOSEL 5.4 151/350] media: imx7-mipi-csis: Add a check for devm_regulator_get Sasha Levin
2019-12-10 21:04 ` [PATCH AUTOSEL 5.4 152/350] media: aspeed: clear garbage interrupts Sasha Levin
2019-12-10 21:04 ` [PATCH AUTOSEL 5.4 153/350] media: smiapp: Register sensor after enabling runtime PM on the device Sasha Levin
2019-12-10 21:05 ` [PATCH AUTOSEL 5.4 202/350] media: rcar_drif: fix a memory disclosure Sasha Levin
2019-12-10 21:05 ` [PATCH AUTOSEL 5.4 203/350] media: v4l2-core: fix touch support in v4l_g_fmt Sasha Levin
2019-12-10 21:05 ` [PATCH AUTOSEL 5.4 205/350] media: staging/imx: Use a shorter name for driver Sasha Levin
2019-12-10 21:05 ` [PATCH AUTOSEL 5.4 209/350] media: vivid: media_device_cleanup was called too early Sasha Levin
2019-12-10 21:05 ` [PATCH AUTOSEL 5.4 247/350] media: exynos4-is: fix wrong mdev and v4l2 dev order in error path Sasha Levin
2019-12-10 21:05 ` Sasha Levin [this message]
2019-12-10 21:06 ` [PATCH AUTOSEL 5.4 257/350] media: si470x-i2c: add missed operations in remove Sasha Levin
2019-12-10 21:06 ` [PATCH AUTOSEL 5.4 258/350] media: cedrus: Use helpers to access capture queue Sasha Levin
2019-12-10 21:06 ` [PATCH AUTOSEL 5.4 259/350] media: v4l2-ctrl: Lock main_hdl on operations of requests_queued Sasha Levin
2019-12-10 21:06 ` [PATCH AUTOSEL 5.4 262/350] media: vicodec: media_device_cleanup was called too early Sasha Levin
2019-12-10 21:06 ` [PATCH AUTOSEL 5.4 263/350] media: vim2m: " 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=20191210210735.9077-213-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=isely@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@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