Skip to contentSkip to conversation

intel_th/stm class: Fixes for v4.14

GIT PULL Alexander Shishkin 2 participants 6 messages Sep 19, 2017 – Sep 22, 2017

Subsystems (5)
lore
Share & tools
lore

Alexander Shishkin

author maintainer
#0 lore raw

Hi Greg,

These are the fixes I have so far for v4.14 window: 2 new PCI IDs and one actual fix. Please consider pulling and/or applying. Thanks!

The following changes since commit 2bd6bf03f4c1c59381d62c61d03f6cc3fe71f66e:

Linux 4.14-rc1 (2017-09-16 15:47:51 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/ash/stm.git tags/stm-fixes-for-greg-20170919

for you to fetch changes up to 4de8301b8cc7287585c93639934426388c6718c6:

intel_th: pci: Add Lewisburg PCH support (2017-09-19 18:32:10 +0300)

----------------------------------------------------------------
intel_th/stm class: Fixes for v4.14

These are:
* 2 new PCI IDs
* fix for stm_source device removal path

----------------------------------------------------------------
Alexander Shishkin (3):
stm class: Fix a use-after-free
intel_th: pci: Add Cedar Fork PCH support
intel_th: pci: Add Lewisburg PCH support

 drivers/hwtracing/intel_th/pci.c | 10 ++++++++++
 drivers/hwtracing/stm/core.c     |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)
Signature · 1 line
2.14.1
author maintainer
#1 lore raw

[GIT PULL 1/3] stm class: Fix a use-after-free

For reasons unknown, the stm_source removal path uses device_destroy() to kill the underlying device object. Because device_destroy() uses devt to look for the device to destroy and the fact that stm_source devices don't have one (or all have the same one), it just picks the first device in the class, which may well be the wrong one.

That is, loading stm_console and stm_heartbeat and then removing both will die in dereferencing a freed object.

Since this should have been device_unregister() in the first place, use it instead of device_destroy().

Fixes 7bd1d4093c2 ("stm class: Introduce an abstraction for System Trace Module devices")
---
 drivers/hwtracing/stm/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/stm/core.c +1 -1
index 9414900575..f129869e05 100644
@@ -1119,7 +1119,7 @@ void stm_source_unregister_device(struct stm_source_data *data)
 
 	stm_source_link_drop(src);
 
-	device_destroy(&stm_source_class, src->dev.devt);
+	device_unregister(&src->dev);
 }
 EXPORT_SYMBOL_GPL(stm_source_unregister_device);
 
Signature · 1 line
2.14.1
author maintainer
#4 lore raw

[GIT PULL 2/3] intel_th: pci: Add Cedar Fork PCH support

In reply to Alexander Shishkin

This adds Intel(R) Trace Hub PCI ID for Cedar Fork PCH.

---
 drivers/hwtracing/intel_th/pci.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
index bc9cebc305..00ee60d978 100644
@@ -158,6 +158,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = {
 		PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x9da6),
 		.driver_data = (kernel_ulong_t)&intel_th_2x,
 	},
+	{
+		/* Cedar Fork PCH */
+		PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x18e1),
+		.driver_data = (kernel_ulong_t)&intel_th_2x,
+	},
 	{ 0 },
 };
 
Signature · 1 line
2.14.1
author maintainer
#5 lore raw

[GIT PULL 3/3] intel_th: pci: Add Lewisburg PCH support

In reply to Alexander Shishkin

This adds Intel(R) Trace Hub PCI ID for Lewisburg PCH.

---
 drivers/hwtracing/intel_th/pci.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
index 00ee60d978..c2a2ce8ee5 100644
@@ -143,6 +143,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = {
 		PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x19e1),
 		.driver_data = (kernel_ulong_t)0,
 	},
+	{
+		/* Lewisburg PCH */
+		PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa1a6),
+		.driver_data = (kernel_ulong_t)0,
+	},
 	{
 		/* Gemini Lake */
 		PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x318e),
Signature · 1 line
2.14.1
#2 lore raw

Re: [GIT PULL 1/3] stm class: Fix a use-after-free

In reply to Alexander Shishkin
Quoted 12 lines · Alexander Shishkin

For reasons unknown, the stm_source removal path uses device_destroy() to kill the underlying device object. Because device_destroy() uses devt to look for the device to destroy and the fact that stm_source devices don't have one (or all have the same one), it just picks the first device in the class, which may well be the wrong one.

That is, loading stm_console and stm_heartbeat and then removing both will die in dereferencing a freed object.

Since this should have been device_unregister() in the first place, use it instead of device_destroy().

Quoted 6 lines
Fixes 7bd1d4093c2 ("stm class: Introduce an abstraction for System Trace Module devices")
---
 drivers/hwtracing/stm/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Ugh, I just applied these as patches, and didn't do the git pull, sorry about that, my fault.

But really, patches for short series are really easy for me to do...

thanks,

greg k-h

author maintainer
#3 lore raw

Re: [GIT PULL 1/3] stm class: Fix a use-after-free

Quoted 20 lines · Greg KH
Quoted 12 lines · Alexander Shishkin

For reasons unknown, the stm_source removal path uses device_destroy() to kill the underlying device object. Because device_destroy() uses devt to look for the device to destroy and the fact that stm_source devices don't have one (or all have the same one), it just picks the first device in the class, which may well be the wrong one.

That is, loading stm_console and stm_heartbeat and then removing both will die in dereferencing a freed object.

Since this should have been device_unregister() in the first place, use it instead of device_destroy().

Quoted 6 lines
Fixes 7bd1d4093c2 ("stm class: Introduce an abstraction for System Trace Module devices")
---
 drivers/hwtracing/stm/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 2 lines

Ugh, I just applied these as patches, and didn't do the git pull, sorry about that, my fault.

No worries, I'm fine either way.

Quoted 1 line

But really, patches for short series are really easy for me to do...

Sure, that's one reason why I sent it like that, so you get to choose.

Thanks,
--
Alex