Skip to contentSkip to conversation

usb: dwc3: of-simple: fix use-after-free on remove

DISCUSSION Felipe Balbi 1 participant 1 message Jun 18, 2018 USB

lore
Share & tools
lore
#0 lore raw

Hi,

Quoted 23 lines · Johan Hovold
Quoted 12 lines · Felipe Balbi
Quoted 10 lines · Roger Quadros

I'm still trying to get my head around this.

in probe() we do

{
	enable all clocks;
        pm_runtime_set_active(dev);
        pm_runtime_enable(dev);
        pm_runtime_get_sync(dev);
}
Quoted 4 lines
Quoted 2 lines

How will runtime suspend work at all?
We're holding a positive RPM count in probe().

echo auto > /path/to/dwc3/power/control

That makes no difference, user space cannot modify the always-active behaviour given that probe returns with a positive usage count.

Quoted 1 line

Granted, that get_sync() would've been better as a pm_runtime_forbid()

Quoted 7 lines

Yeah, that would allow user space some control, albeit in a way that may override a user space configuration (as the platform device would already have been registered).

Why are you trying to prevent runtime pm in the first place? Shouldn't the device be allowed to suspend when it has no active child by default?

I don't use this glue layer, actually. As long as there are no regressions, you can change it to your heart's content. I still it's best to start with pm runtime blocked and let userspace decide what and when should have pm runtime enabled.