From fc5d49394835d8c7cc76b3ffd31520f854311b5b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 12 Mar 2021 15:09:48 +0100 Subject: [PATCH] 4.4-stable patches added patches: media-usbtv-fix-deadlock-on-suspend.patch --- .../media-usbtv-fix-deadlock-on-suspend.patch | 42 +++++++++++++++++++ queue-4.4/series | 1 + 2 files changed, 43 insertions(+) create mode 100644 queue-4.4/media-usbtv-fix-deadlock-on-suspend.patch diff --git a/queue-4.4/media-usbtv-fix-deadlock-on-suspend.patch b/queue-4.4/media-usbtv-fix-deadlock-on-suspend.patch new file mode 100644 index 00000000000..10e845ba708 --- /dev/null +++ b/queue-4.4/media-usbtv-fix-deadlock-on-suspend.patch @@ -0,0 +1,42 @@ +From 8a7e27fd5cd696ba564a3f62cedef7269cfd0723 Mon Sep 17 00:00:00 2001 +From: Maxim Mikityanskiy +Date: Fri, 5 Feb 2021 23:51:39 +0100 +Subject: media: usbtv: Fix deadlock on suspend + +From: Maxim Mikityanskiy + +commit 8a7e27fd5cd696ba564a3f62cedef7269cfd0723 upstream. + +usbtv doesn't support power management, so on system suspend the +.disconnect callback of the driver is called. The teardown sequence +includes a call to snd_card_free. Its implementation waits until the +refcount of the sound card device drops to zero, however, if its file is +open, snd_card_file_add takes a reference, which can't be dropped during +the suspend, because the userspace processes are already frozen at this +point. snd_card_free waits for completion forever, leading to a hang on +suspend. + +This commit fixes this deadlock condition by replacing snd_card_free +with snd_card_free_when_closed, that doesn't wait until all references +are released, allowing suspend to progress. + +Fixes: 63ddf68de52e ("[media] usbtv: add audio support") +Signed-off-by: Maxim Mikityanskiy +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/usb/usbtv/usbtv-audio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/media/usb/usbtv/usbtv-audio.c ++++ b/drivers/media/usb/usbtv/usbtv-audio.c +@@ -384,7 +384,7 @@ void usbtv_audio_free(struct usbtv *usbt + cancel_work_sync(&usbtv->snd_trigger); + + if (usbtv->snd && usbtv->udev) { +- snd_card_free(usbtv->snd); ++ snd_card_free_when_closed(usbtv->snd); + usbtv->snd = NULL; + } + } diff --git a/queue-4.4/series b/queue-4.4/series index d828ef8cd8d..6383436dcec 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -15,3 +15,4 @@ net-mlx4_en-update-moderation-when-config-reset.patch net-lapbether-remove-netif_start_queue-netif_stop_queue.patch net-davicom-fix-regulator-not-turned-off-on-failed-probe.patch net-davicom-fix-regulator-not-turned-off-on-driver-removal.patch +media-usbtv-fix-deadlock-on-suspend.patch -- 2.47.3