summaryrefslogtreecommitdiff
path: root/scripts/mod/empty.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2023-03-24 18:18:10 +0100
committerMichael Bestas <mkbestas@lineageos.org>2023-05-02 21:08:13 +0300
commit76cf3b5e53df0f36ae69a3bda559bb4fb7a878f7 (patch)
treef415b2d8c2073d22076787bb7c9b99bfcb72aa8b /scripts/mod/empty.c
parente9af212f968520b3c1e0f79dd12865a68acde2c3 (diff)
ALSA: control: code refactoring for ELEM_READ/ELEM_WRITE operations
commit becf9e5d553c2389d857a3c178ce80fdb34a02e1 upstream. ALSA control core handles ELEM_READ/ELEM_WRITE requests within lock acquisition of a counting semaphore. The lock is acquired in helper functions in the end of call path before calling implementations of each driver. ioctl(2) with SNDRV_CTL_ELEM_READ ... ->snd_ctl_ioctl() ->snd_ctl_elem_read_user() ->snd_ctl_elem_read() ->down_read(controls_rwsem) ->snd_ctl_find_id() ->struct snd_kcontrol.get() ->up_read(controls_rwsem) ioctl(2) with SNDRV_CTL_ELEM_WRITE ... ->snd_ctl_ioctl() ->snd_ctl_elem_write_user() ->snd_ctl_elem_write() ->down_read(controls_rwsem) ->snd_ctl_find_id() ->struct snd_kcontrol.put() ->up_read(controls_rwsem) This commit moves the lock acquisition to middle of the call graph to simplify the helper functions. As a result: ioctl(2) with SNDRV_CTL_ELEM_READ ... ->snd_ctl_ioctl() ->snd_ctl_elem_read_user() ->down_read(controls_rwsem) ->snd_ctl_elem_read() ->snd_ctl_find_id() ->struct snd_kcontrol.get() ->up_read(controls_rwsem) ioctl(2) with SNDRV_CTL_ELEM_WRITE ... ->snd_ctl_ioctl() ->snd_ctl_elem_write_user() ->down_read(controls_rwsem) ->snd_ctl_elem_write() ->snd_ctl_find_id() ->struct snd_kcontrol.put() ->up_read(controls_rwsem) Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de> Fixes: e8064dec769e6 "ALSA: pcm: Move rwsem lock inside snd_ctl_elem_read to prevent UAF" Signed-off-by: Alexander Grund <theflamefire89@gmail.com> [uli: added upstream commit id] Signed-off-by: Ulrich Hecht <uli+cip@fpond.eu> Change-Id: I72ea6a8b828938b56935fc4ce08021e5e91135a1
Diffstat (limited to 'scripts/mod/empty.c')
0 files changed, 0 insertions, 0 deletions