Em Sat, 18 Dec 2021 02:09:46 +0100 Maximilian Böhm <maximilian.boehm@xxxxxxxxxx> escreveu: > Hello Paul and the other people involved, > > I’m a user of a Hauppauge WinTV dualHD DVB-T2 USB card and experiencing a bug since Linux 5.15.3 of which kernel bisecting brought me to a commit by you from Juli 29: "media: em28xx: add missing em28xx_close_extension". So, basically this changeset: 2c98b8a3458d ("media: em28xx: add missing em28xx_close_extension") > My problem: This TV stick doesn’t work for me after a wake up from a system standby, so I have to use the little helper tool usbreset to reset its USB connection. What such patch should be doing is to ensure that the drivers will do the right thing when the device is removed (or unbound). It shouldn't have been called during suspend/resume. While this bug should be fixed, the issue with suspend/resume callbacks also seem to require additional work. Now, I dunno what a "usbreset" tool would be doing, but I'm assuming that it will be doing a unbind/bind sequence. > But if I try this after Linux 5.15.3, I get a severe kernel error in dmesg, system hangs and I’m unable to proper reboot or shutdown. I have reported this on the kernel Bugzilla, including a dmesg log: https://bugzilla.kernel.org/show_bug.cgi?id=215241 Such patch should actually be fixing a use-after-free on disconnect. Anyway, could you please try the enclosed patch? > I hope you have an idea about how to stop this problem from occurring and I‘m willing to help testing a fix. > Another thinkable fix would be to directly fix this TV stick’s standby-wake-up problem but I’m not savvy enough to determine if this would be the better option than to fix this hanging issue. Yeah, that would be the best. Unfortunately, right now, I don't have any dual DVB-T em28xx-based board to test. Thanks, Mauro [PATCH] media: em28xx: close exension first at dev_next Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index b451ce3cb169..08f34a8aab5e 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -4148,13 +4148,12 @@ static void em28xx_usb_disconnect(struct usb_interface *intf) flush_request_modules(dev); - em28xx_close_extension(dev); - if (dev->dev_next) { em28xx_close_extension(dev->dev_next); em28xx_release_resources(dev->dev_next); } + em28xx_close_extension(dev); em28xx_release_resources(dev); if (dev->dev_next) {