From: Sasha Levin <sashal@kernel.org> To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>, Bard Liao <yung-chuan.liao@linux.intel.com>, Kai Vehmanen <kai.vehmanen@linux.intel.com>, Mark Brown <broonie@kernel.org>, Sasha Levin <sashal@kernel.org>, alsa-devel@alsa-project.org Subject: [PATCH AUTOSEL 5.8 45/62] ASoC: Intel: sof_sdw_rt711: remove properties in card remove Date: Fri, 21 Aug 2020 12:14:06 -0400 [thread overview] Message-ID: <20200821161423.347071-45-sashal@kernel.org> (raw) In-Reply-To: <20200821161423.347071-1-sashal@kernel.org> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> [ Upstream commit cf0418cd06ce42fcf35beb33e315b5a77e596926 ] The rt711 jack detection properties are set from the machine drivers during the card probe, as done in other ASoC examples. KASAN reports a use-after-free error when unbinding drivers due to a confusing sequence between the ACPI core, the device core and the SoundWire device cleanups. Rather than fixing this sequence, follow the recommendation to have the same caller add and remove properties, add an explicit device_remove_properties() in the card .remove() callback. In future patches the use of device_add/remove_properties will be replaced by a direct handling of a swnode, but the sequence will remain the same. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/20200717211337.31956-3-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> --- sound/soc/intel/boards/sof_sdw.c | 1 + sound/soc/intel/boards/sof_sdw_common.h | 1 + sound/soc/intel/boards/sof_sdw_rt711.c | 15 +++++++++++++++ 3 files changed, 17 insertions(+) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 1bfd9613449e9..95a119a2d354e 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -184,6 +184,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { .direction = {true, true}, .dai_name = "rt711-aif1", .init = sof_sdw_rt711_init, + .exit = sof_sdw_rt711_exit, }, { .id = 0x1308, diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h index 69b363b8a6869..fdd2385049e1e 100644 --- a/sound/soc/intel/boards/sof_sdw_common.h +++ b/sound/soc/intel/boards/sof_sdw_common.h @@ -84,6 +84,7 @@ int sof_sdw_rt711_init(const struct snd_soc_acpi_link_adr *link, struct snd_soc_dai_link *dai_links, struct sof_sdw_codec_info *info, bool playback); +int sof_sdw_rt711_exit(struct device *dev, struct snd_soc_dai_link *dai_link); /* RT700 support */ int sof_sdw_rt700_init(const struct snd_soc_acpi_link_adr *link, diff --git a/sound/soc/intel/boards/sof_sdw_rt711.c b/sound/soc/intel/boards/sof_sdw_rt711.c index d4d75c8dc6b78..0cb9f1c1f8676 100644 --- a/sound/soc/intel/boards/sof_sdw_rt711.c +++ b/sound/soc/intel/boards/sof_sdw_rt711.c @@ -133,6 +133,21 @@ static int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd) return ret; } +int sof_sdw_rt711_exit(struct device *dev, struct snd_soc_dai_link *dai_link) +{ + struct device *sdw_dev; + + sdw_dev = bus_find_device_by_name(&sdw_bus_type, NULL, + dai_link->codecs[0].name); + if (!sdw_dev) + return -EINVAL; + + device_remove_properties(sdw_dev); + put_device(sdw_dev); + + return 0; +} + int sof_sdw_rt711_init(const struct snd_soc_acpi_link_adr *link, struct snd_soc_dai_link *dai_links, struct sof_sdw_codec_info *info, -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Sasha Levin <sashal@kernel.org> To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sasha Levin <sashal@kernel.org>, alsa-devel@alsa-project.org, Kai Vehmanen <kai.vehmanen@linux.intel.com>, Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>, Mark Brown <broonie@kernel.org>, Bard Liao <yung-chuan.liao@linux.intel.com> Subject: [PATCH AUTOSEL 5.8 45/62] ASoC: Intel: sof_sdw_rt711: remove properties in card remove Date: Fri, 21 Aug 2020 12:14:06 -0400 [thread overview] Message-ID: <20200821161423.347071-45-sashal@kernel.org> (raw) In-Reply-To: <20200821161423.347071-1-sashal@kernel.org> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> [ Upstream commit cf0418cd06ce42fcf35beb33e315b5a77e596926 ] The rt711 jack detection properties are set from the machine drivers during the card probe, as done in other ASoC examples. KASAN reports a use-after-free error when unbinding drivers due to a confusing sequence between the ACPI core, the device core and the SoundWire device cleanups. Rather than fixing this sequence, follow the recommendation to have the same caller add and remove properties, add an explicit device_remove_properties() in the card .remove() callback. In future patches the use of device_add/remove_properties will be replaced by a direct handling of a swnode, but the sequence will remain the same. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/20200717211337.31956-3-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> --- sound/soc/intel/boards/sof_sdw.c | 1 + sound/soc/intel/boards/sof_sdw_common.h | 1 + sound/soc/intel/boards/sof_sdw_rt711.c | 15 +++++++++++++++ 3 files changed, 17 insertions(+) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 1bfd9613449e9..95a119a2d354e 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -184,6 +184,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { .direction = {true, true}, .dai_name = "rt711-aif1", .init = sof_sdw_rt711_init, + .exit = sof_sdw_rt711_exit, }, { .id = 0x1308, diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h index 69b363b8a6869..fdd2385049e1e 100644 --- a/sound/soc/intel/boards/sof_sdw_common.h +++ b/sound/soc/intel/boards/sof_sdw_common.h @@ -84,6 +84,7 @@ int sof_sdw_rt711_init(const struct snd_soc_acpi_link_adr *link, struct snd_soc_dai_link *dai_links, struct sof_sdw_codec_info *info, bool playback); +int sof_sdw_rt711_exit(struct device *dev, struct snd_soc_dai_link *dai_link); /* RT700 support */ int sof_sdw_rt700_init(const struct snd_soc_acpi_link_adr *link, diff --git a/sound/soc/intel/boards/sof_sdw_rt711.c b/sound/soc/intel/boards/sof_sdw_rt711.c index d4d75c8dc6b78..0cb9f1c1f8676 100644 --- a/sound/soc/intel/boards/sof_sdw_rt711.c +++ b/sound/soc/intel/boards/sof_sdw_rt711.c @@ -133,6 +133,21 @@ static int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd) return ret; } +int sof_sdw_rt711_exit(struct device *dev, struct snd_soc_dai_link *dai_link) +{ + struct device *sdw_dev; + + sdw_dev = bus_find_device_by_name(&sdw_bus_type, NULL, + dai_link->codecs[0].name); + if (!sdw_dev) + return -EINVAL; + + device_remove_properties(sdw_dev); + put_device(sdw_dev); + + return 0; +} + int sof_sdw_rt711_init(const struct snd_soc_acpi_link_adr *link, struct snd_soc_dai_link *dai_links, struct sof_sdw_codec_info *info, -- 2.25.1
next prev parent reply other threads:[~2020-08-21 17:25 UTC|newest] Thread overview: 115+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-21 16:13 [PATCH AUTOSEL 5.8 01/62] ALSA: hda/hdmi: Add quirk to force connectivity Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 02/62] ALSA: pci: delete repeated words in comments Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 03/62] ALSA: hda/realtek: Fix pin default on Intel NUC 8 Rugged Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 04/62] ALSA: hda/hdmi: Use force connectivity quirk on another HP desktop Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 05/62] drm/amdgpu: fix RAS memory leak in error case Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 06/62] EDAC/mc: Call edac_inc_ue_error() before panic Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 07/62] ASoC: img: Fix a reference count leak in img_i2s_in_set_fmt Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 08/62] ASoC: img-parallel-out: Fix a reference count leak Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 09/62] ASoC: tegra: Fix reference count leaks Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 10/62] mfd: intel-lpss: Add Intel Emmitsburg PCH PCI IDs Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 11/62] arm64: dts: qcom: msm8916: Pull down PDM GPIOs during sleep Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 12/62] powerpc/xive: Ignore kmemleak false positives Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 13/62] media: pci: ttpci: av7110: fix possible buffer overflow caused by bad DMA value in debiirq() Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 14/62] gcc-plugins/stackleak: Don't instrument itself Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 15/62] blktrace: ensure our debugfs dir exists Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 16/62] staging: rts5208: fix memleaks on error handling paths in probe Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 17/62] scsi: target: tcmu: Fix crash on ARM during cmd completion Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 18/62] mfd: intel-lpss: Add Intel Tiger Lake PCH-H PCI IDs Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 19/62] iommu/iova: Don't BUG on invalid PFNs Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 20/62] platform/chrome: cros_ec_sensorhub: Fix EC timestamp overflow Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 21/62] drm/amdkfd: Fix reference count leaks Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 22/62] drm/radeon: fix multiple reference count leak Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 23/62] drm/amdgpu: fix ref count leak in amdgpu_driver_open_kms Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 24/62] drm/amd/display: fix ref count leak in amdgpu_drm_ioctl Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 25/62] drm/amdgpu: fix ref count leak in amdgpu_display_crtc_set_config Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 26/62] drm/amdgpu/display: fix ref count leak when pm_runtime_get_sync fails Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 27/62] drm/amdgpu/fence: " Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 28/62] drm/amdkfd: " Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 29/62] drm/amdgpu/pm: " Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 30/62] scsi: lpfc: Fix shost refcount mismatch when deleting vport Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 31/62] xfs: Don't allow logging of XFS_ISTALE inodes Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 32/62] scsi: target: Fix xcopy sess release leak Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 33/62] selftests/powerpc: Purge extra count_pmc() calls of ebb selftests Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 34/62] f2fs: remove write attribute of main_blkaddr sysfs node Sasha Levin 2020-08-21 16:13 ` [f2fs-dev] " Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 35/62] f2fs: fix error path in do_recover_data() Sasha Levin 2020-08-21 16:13 ` [f2fs-dev] " Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 36/62] MIPS: KVM: Limit Trap-and-Emulate to MIPS32R2 only Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 37/62] omapfb: fix multiple reference count leaks due to pm_runtime_get_sync Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` Sasha Levin 2020-08-21 16:13 ` [PATCH AUTOSEL 5.8 38/62] PCI: Fix pci_create_slot() reference count leak Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 39/62] ARM: dts: ls1021a: output PPS signal on FIPER2 Sasha Levin 2020-08-21 16:14 ` Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 40/62] rtlwifi: rtl8192cu: Prevent leaking urb Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 41/62] mips/vdso: Fix resource leaks in genvdso.c Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 42/62] ALSA: hda: Add support for Loongson 7A1000 controller Sasha Levin 2020-08-21 16:14 ` Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 43/62] gpu: host1x: Put gather's BO on pinning error Sasha Levin 2020-08-21 16:14 ` Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 44/62] cec-api: prevent leaking memory through hole in structure Sasha Levin 2020-08-21 16:14 ` Sasha Levin [this message] 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 45/62] ASoC: Intel: sof_sdw_rt711: remove properties in card remove Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 46/62] HID: quirks: add NOGET quirk for Logitech GROUP Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 47/62] f2fs: fix use-after-free issue Sasha Levin 2020-08-21 16:14 ` [f2fs-dev] " Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 48/62] drm/nouveau/drm/noveau: fix reference count leak in nouveau_fbcon_open Sasha Levin 2020-08-21 16:14 ` Sasha Levin 2020-08-21 16:14 ` Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 49/62] drm/nouveau: fix reference count leak in nv50_disp_atomic_commit Sasha Levin 2020-08-21 16:14 ` Sasha Levin 2020-08-21 16:14 ` Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 50/62] drm/nouveau: Fix reference count leak in nouveau_connector_detect Sasha Levin 2020-08-21 16:14 ` Sasha Levin 2020-08-21 16:14 ` Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 51/62] locking/lockdep: Fix overflow in presentation of average lock-time Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 52/62] btrfs: file: reserve qgroup space after the hole punch range is locked Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 53/62] btrfs: make btrfs_qgroup_check_reserved_leak take btrfs_inode Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 54/62] scsi: iscsi: Do not put host in iscsi_set_flashnode_param() Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 55/62] RDMA/efa: Add EFA 0xefa1 PCI ID Sasha Levin 2020-08-21 19:40 ` Jason Gunthorpe 2020-08-21 19:53 ` Sasha Levin 2020-08-21 20:19 ` Jason Gunthorpe 2020-08-21 20:34 ` Sasha Levin 2020-08-23 6:43 ` Gal Pressman 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 56/62] netfilter: nf_tables: report EEXIST on overlaps Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 57/62] ceph: fix potential mdsc use-after-free crash Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 58/62] ceph: do not access the kiocb after aio requests Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 59/62] scsi: fcoe: Memory leak fix in fcoe_sysfs_fcf_del() Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 60/62] i2c: i801: Add support for Intel Tiger Lake PCH-H Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 61/62] EDAC/ie31200: Fallback if host bridge device is already initialized Sasha Levin 2020-08-21 16:14 ` [PATCH AUTOSEL 5.8 62/62] hugetlbfs: prevent filesystem stacking of hugetlbfs 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=20200821161423.347071-45-sashal@kernel.org \ --to=sashal@kernel.org \ --cc=alsa-devel@alsa-project.org \ --cc=broonie@kernel.org \ --cc=kai.vehmanen@linux.intel.com \ --cc=linux-kernel@vger.kernel.org \ --cc=pierre-louis.bossart@linux.intel.com \ --cc=stable@vger.kernel.org \ --cc=yung-chuan.liao@linux.intel.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: linkBe 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.