cip-dev.lists.cip-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4.4 0/3] ALSA: control: Fix locking around snd_ctl_elem_read/write
@ 2023-03-24 17:18 Alexander Grund
  2023-03-24 17:18 ` [PATCH 4.4 1/3] ALSA: control: code refactoring for ELEM_READ/ELEM_WRITE operations Alexander Grund
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Alexander Grund @ 2023-03-24 17:18 UTC (permalink / raw)
  To: cip-dev; +Cc: uli+cip

I found a bug in v4.4-st38 caused by e8064dec769e6 "ALSA: pcm: Move rwsem lock inside snd_ctl_elem_read to prevent UAF"
The most serious part is a `down_write` call before calling `snd_ctl_elem_write` which will do a `down_read` on the same mutex causing a deadlock.
I fix this by taking missing commits from 4.14.y, especially "ALSA: control: code refactoring for ELEM_READ/ELEM_WRITE operations"
which moves the locking out of those 2 functions such that the bug fixed
by the above commit is actually introduced so that it can be fixed
avoiding the deadlock.
This also requires a follow-up commit to fix a bug introduced in a
condition by that commit.
The final commit replaces `down_read` by `down_write` in `snd_ctl_elem_write_user`
similar to what e8064dec769e6 does in control_compat.c so that this use
is uniform (and correct).


Richard Fitzgerald (1):
  ALSA: control: Fix memory corruption risk in snd_ctl_elem_read

Takashi Sakamoto (2):
  ALSA: control: code refactoring for ELEM_READ/ELEM_WRITE operations
  ALSA: control: use counting semaphore as write lock for ELEM_WRITE
    operation

 sound/core/control.c | 78 +++++++++++++++++++++-----------------------
 1 file changed, 38 insertions(+), 40 deletions(-)

-- 
2.40.0



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-04-03 17:13 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-24 17:18 [PATCH 4.4 0/3] ALSA: control: Fix locking around snd_ctl_elem_read/write Alexander Grund
2023-03-24 17:18 ` [PATCH 4.4 1/3] ALSA: control: code refactoring for ELEM_READ/ELEM_WRITE operations Alexander Grund
2023-03-29 22:29   ` [cip-dev] " nobuhiro1.iwamatsu
2023-03-31 15:45     ` Alexander Grund
2023-03-24 17:18 ` [PATCH 4.4 2/3] ALSA: control: Fix memory corruption risk in snd_ctl_elem_read Alexander Grund
2023-03-29 22:33   ` [cip-dev] " nobuhiro1.iwamatsu
2023-03-31 15:52     ` Alexander Grund
2023-03-24 17:18 ` [PATCH 4.4 3/3] ALSA: control: use counting semaphore as write lock for ELEM_WRITE operation Alexander Grund
2023-03-29 22:39   ` [cip-dev] " nobuhiro1.iwamatsu
2023-03-31 15:51     ` Alexander Grund
2023-04-03  8:56       ` [cip-dev] " Ulrich Hecht
2023-04-03 17:13         ` Alexander Grund
2023-04-02 16:30 ` [cip-dev] [PATCH 4.4 0/3] ALSA: control: Fix locking around snd_ctl_elem_read/write Pavel Machek
2023-04-02 18:34   ` Alexander Grund
2023-04-03  8:56   ` [cip-dev] " Ulrich Hecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).