linux-kernel.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: Yang Yingliang <yangyingliang@huawei.com>,
	Hulk Robot <hulkci@huawei.com>,
	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.4 39/57] media: adv7604: fix possible use-after-free in adv76xx_remove()
Date: Mon,  3 May 2021 12:39:23 -0400	[thread overview]
Message-ID: <20210503163941.2853291-39-sashal@kernel.org> (raw)
In-Reply-To: <20210503163941.2853291-1-sashal@kernel.org>

From: Yang Yingliang <yangyingliang@huawei.com>

[ Upstream commit fa56f5f1fe31c2050675fa63b84963ebd504a5b3 ]

This driver's remove path calls cancel_delayed_work(). However, that
function does not wait until the work function finishes. This means
that the callback function may still be running after the driver's
remove function has finished, which would result in a use-after-free.

Fix by calling cancel_delayed_work_sync(), which ensures that
the work is properly cancelled, no longer running, and unable
to re-schedule itself.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
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/i2c/adv7604.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 2dedd6ebb236..b887299ac195 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -3606,7 +3606,7 @@ static int adv76xx_remove(struct i2c_client *client)
 	io_write(sd, 0x6e, 0);
 	io_write(sd, 0x73, 0);
 
-	cancel_delayed_work(&state->delayed_work_enable_hotplug);
+	cancel_delayed_work_sync(&state->delayed_work_enable_hotplug);
 	v4l2_async_unregister_subdev(sd);
 	media_entity_cleanup(&sd->entity);
 	adv76xx_unregister_clients(to_state(sd));
-- 
2.30.2


  parent reply	other threads:[~2021-05-03 16:56 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-03 16:38 [PATCH AUTOSEL 5.4 01/57] drm: Added orientation quirk for OneGX1 Pro Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 02/57] drm/qxl: release shadow on shutdown Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 03/57] drm/amd/display: Check for DSC support instead of ASIC revision Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 04/57] drm/amd/display: Don't optimize bandwidth before disabling planes Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 05/57] scsi: lpfc: Fix incorrect dbde assignment when building target abts wqe Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 06/57] scsi: lpfc: Fix pt2pt connection does not recover after LOGO Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 07/57] scsi: target: pscsi: Fix warning in pscsi_complete_cmd() Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 08/57] media: ite-cir: check for receive overflow Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 09/57] media: drivers: media: pci: sta2x11: fix Kconfig dependency on GPIOLIB Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 10/57] media: imx: capture: Return -EPIPE from __capture_legacy_try_fmt() Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 11/57] power: supply: bq27xxx: fix power_avg for newer ICs Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 12/57] extcon: arizona: Fix some issues when HPDET IRQ fires after the jack has been unplugged Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 13/57] extcon: arizona: Fix various races on driver unbind Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 14/57] media: media/saa7164: fix saa7164_encoder_register() memory leak bugs Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 15/57] media: gspca/sq905.c: fix uninitialized variable Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 16/57] media: pci: saa7164: Rudimentary spelling fixes in the file saa7164-types.h Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 17/57] power: supply: Use IRQF_ONESHOT Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 18/57] drm/bridge/analogix/anx78xx: Setup encoder before registering connector Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 19/57] drm/bridge/analogix/anx78xx: Cleanup on error in anx78xx_bridge_attach() Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 20/57] drm/amdgpu: mask the xgmi number of hops reported from psp to kfd Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 21/57] drm/amdkfd: Fix UBSAN shift-out-of-bounds warning Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 22/57] drm/amdgpu : Fix asic reset regression issue introduce by 8f211fe8ac7c4f Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 23/57] drm/amd/display: Fix UBSAN warning for not a valid value for type '_Bool' Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 24/57] drm/amd/display: fix dml prefetch validation Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 25/57] scsi: qla2xxx: Always check the return value of qla24xx_get_isp_stats() Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 26/57] drm/vkms: fix misuse of WARN_ON Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 27/57] scsi: qla2xxx: Fix use after free in bsg Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 28/57] mmc: sdhci-pci: Add PCI IDs for Intel LKF Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 29/57] ata: ahci: Disable SXS for Hisilicon Kunpeng920 Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 30/57] scsi: smartpqi: Correct request leakage during reset operations Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 31/57] scsi: smartpqi: Add new PCI IDs Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 32/57] scsi: scsi_dh_alua: Remove check for ASC 24h in alua_rtpg() Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 33/57] media: em28xx: fix memory leak Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 34/57] media: vivid: update EDID Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 35/57] clk: socfpga: arria10: Fix memory leak of socfpga_clk on error return Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 36/57] power: supply: generic-adc-battery: fix possible use-after-free in gab_remove() Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 37/57] power: supply: s3c_adc_battery: fix possible use-after-free in s3c_adc_bat_remove() Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 38/57] media: tc358743: fix possible use-after-free in tc358743_remove() Sasha Levin
2021-05-03 16:39 ` Sasha Levin [this message]
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 40/57] media: i2c: adv7511-v4l2: fix possible use-after-free in adv7511_remove() Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 41/57] media: i2c: tda1997: Fix possible use-after-free in tda1997x_remove() Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 42/57] media: i2c: adv7842: fix possible use-after-free in adv7842_remove() Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 43/57] media: platform: sti: Fix runtime PM imbalance in regs_show Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 44/57] media: dvb-usb: fix memory leak in dvb_usb_adapter_init Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 45/57] media: gscpa/stv06xx: fix memory leak Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 46/57] sched/fair: Ignore percpu threads for imbalance pulls Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 47/57] drm/msm/mdp5: Configure PP_SYNC_HEIGHT to double the vtotal Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 48/57] drm/msm/mdp5: Do not multiply vclk line count by 100 Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 49/57] drm/amdkfd: Fix cat debugfs hang_hws file causes system crash bug Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 50/57] amdgpu: avoid incorrect %hu format string Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 51/57] drm/amdgpu: fix NULL pointer dereference Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 52/57] scsi: lpfc: Fix crash when a REG_RPI mailbox fails triggering a LOGO response Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 53/57] scsi: lpfc: Fix error handling for mailboxes completed in MBX_POLL mode Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 54/57] scsi: lpfc: Remove unsupported mbox PORT_CAPABILITIES logic Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 55/57] mfd: arizona: Fix rumtime PM imbalance on error Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 56/57] scsi: libfc: Fix a format specifier Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 57/57] s390/archrandom: add parameter check for s390_arch_random_generate 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=20210503163941.2853291-39-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=hulkci@huawei.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab+huawei@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=yangyingliang@huawei.com \
    /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).