diff options
author | Takashi Iwai <tiwai@suse.de> | 2017-06-02 18:16:59 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-06-07 11:25:51 +0300 |
commit | 890e2cb5d184629702a2c1a1e9631f9f64523c65 (patch) | |
tree | eb3192675a5da8226d56dc6f832a3482741b56af /crypto/algif_skcipher.c | |
parent | 4c7aba46c9e82aa236502760a677e666589afead (diff) | |
download | linux-890e2cb5d184629702a2c1a1e9631f9f64523c65.tar.xz |
ALSA: timer: Improve user queue reallocation
ALSA timer may reallocate the user queue upon request, and it happens
at three places for now: at opening, at SNDRV_TIMER_IOCTL_PARAMS, and
at SNDRV_TIMER_IOCTL_SELECT. However, the last one,
snd_timer_user_tselect(), doesn't need to reallocate the buffer since
it doesn't change the queue size. It does just because tu->tread
might have been changed before starting the timer.
Instead of *_SELECT ioctl, we should reallocate the queue at
SNDRV_TIMER_IOCTL_TREAD; then the timer is guaranteed to be stopped,
thus we can reassign the buffer more safely.
This patch implements that with a slight code refactoring.
Essentially, the patch achieves:
- Introduce realloc_user_queue() for (re-)allocating the ring buffer,
and call it from all places. Also, realloc_user_queue() uses
kcalloc() for avoiding possible leaks.
- Add the buffer reallocation at SNDRV_TIMER_IOCTL_TREAD. When it
fails, tu->tread is restored to the old value, too.
- Drop the buffer reallocation at snd_timer_user_tselect().
Tested-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'crypto/algif_skcipher.c')
0 files changed, 0 insertions, 0 deletions