From: Erick Karanja <karanja99erick@gmail.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: perex@perex.cz, tiwai@suse.com, linux-sound@vger.kernel.org,
linux-kernel@vger.kernel.org, julia.lawall@inria.fr
Subject: Re: [PATCH] staging: sound: Adjust mutex unlock order
Date: Wed, 16 Jul 2025 09:39:34 +0300 [thread overview]
Message-ID: <4a7f48ff7c3a93afe4ec3847addaedf75f95ac03.camel@gmail.com> (raw)
In-Reply-To: <87tt3c8wye.wl-tiwai@suse.de>
On Wed, 2025-07-16 at 08:35 +0200, Takashi Iwai wrote:
> On Wed, 16 Jul 2025 08:23:30 +0200,
> Erick Karanja wrote:
> >
> > The mutexes qdev_mutex and chip->mutex are acquired in that order
> > throughout the driver. To preserve proper lock hierarchy and avoid
> > potential deadlocks, they must be released in the reverse order
> > of acquisition.
> >
> > This change reorders the unlock sequence to first release chip-
> > >mutex
> > followed by qdev_mutex, ensuring consistency with the locking
> > pattern.
> >
> > Signed-off-by: Erick Karanja <karanja99erick@gmail.com>
> > ---
> > sound/usb/qcom/qc_audio_offload.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/sound/usb/qcom/qc_audio_offload.c
> > b/sound/usb/qcom/qc_audio_offload.c
> > index 3543b5a53592..ef144d2be7d2 100644
> > --- a/sound/usb/qcom/qc_audio_offload.c
> > +++ b/sound/usb/qcom/qc_audio_offload.c
> > @@ -825,8 +825,8 @@ static int uaudio_sideband_notifier(struct
> > usb_interface *intf,
> > }
> > }
> >
> > - mutex_unlock(&qdev_mutex);
> > mutex_unlock(&chip->mutex);
> > + mutex_unlock(&qdev_mutex);
> >
> > return 0;
> > }
>
> The same pattern is found in qc_usb_audio_offload_disconnect() and
> qc_usb_audio_offload_suspend(), too.
> Care to address there as well?
Yes, working on it.
>
> Maybe it's better to replace with guard stuff, but it should be done
> by another patch in later kernel releases.
>
>
> thanks,
>
> Takashi
next prev parent reply other threads:[~2025-07-16 6:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-16 6:23 Erick Karanja
2025-07-16 6:35 ` Takashi Iwai
2025-07-16 6:39 ` Erick Karanja [this message]
2025-07-29 11:55 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4a7f48ff7c3a93afe4ec3847addaedf75f95ac03.camel@gmail.com \
--to=karanja99erick@gmail.com \
--cc=julia.lawall@inria.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®