[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <s5hsfzrvuv1.wl-tiwai@suse.de>
Date: Tue, 03 Aug 2021 09:40:50 +0200
From: Takashi Iwai <tiwai@...e.de>
To: Salah Triki <salah.triki@...il.com>
Cc: Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
Pavel Skripkin <paskripkin@...il.com>,
Kai-Heng Feng <kai.heng.feng@...onical.com>,
Mark Brown <broonie@...nel.org>, Joe Perches <joe@...ches.com>,
alsa-devel@...a-project.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sound: usb: get lock before calling usb_enable_autosuspend()
On Tue, 03 Aug 2021 00:53:39 +0200,
Salah Triki wrote:
>
> Based on the documentation of usb_enable_autosuspend(), the
> caller must hold udev's device lock.
The device lock is already held in the caller side (in the driver
core), hence this change will lead to a deadlock.
thanks,
Takashi
>
> Signed-off-by: Salah Triki <salah.triki@...il.com>
> ---
> sound/usb/card.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/sound/usb/card.c b/sound/usb/card.c
> index 2f6a62416c05..9290ba0acd5f 100644
> --- a/sound/usb/card.c
> +++ b/sound/usb/card.c
> @@ -907,8 +907,13 @@ static void usb_audio_disconnect(struct usb_interface *intf)
> }
> }
>
> - if (chip->quirk_type & QUIRK_SETUP_DISABLE_AUTOSUSPEND)
> - usb_enable_autosuspend(interface_to_usbdev(intf));
> + if (chip->quirk_type & QUIRK_SETUP_DISABLE_AUTOSUSPEND) {
> + struct usb_device *udev = interface_to_usbdev(intf);
> +
> + usb_lock_device(udev);
> + usb_enable_autosuspend(udev);
> + usb_unlock_device(udev);
> + }
>
> chip->num_interfaces--;
> if (chip->num_interfaces <= 0) {
> --
> 2.25.1
>
Powered by blists - more mailing lists