summaryrefslogtreecommitdiff
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-01-29 11:07:24 +0100
committerTakashi Iwai <tiwai@suse.de>2019-01-29 11:07:48 +0100
commit286406c2e198b199c348447b3a7c54c6324db147 (patch)
treea193b6e6590e268ba46fe876146c3545d03599c0 /sound/core
parentb2e9e1c8810ee05c95f4d55800b8afae70ab01b4 (diff)
parente190161f96b88ffae870405fd6c3fdd1d2e7f98d (diff)
Merge branch 'for-linus' into for-next
Pull 5.0 branch for further development of USB-audio quirks Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/compress_offload.c3
-rw-r--r--sound/core/pcm_lib.c9
2 files changed, 10 insertions, 2 deletions
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index a5b09e75e787..f7d2b373da0a 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -541,7 +541,8 @@ static int snd_compress_check_input(struct snd_compr_params *params)
{
/* first let's check the buffer parameter's */
if (params->buffer.fragment_size == 0 ||
- params->buffer.fragments > INT_MAX / params->buffer.fragment_size)
+ params->buffer.fragments > INT_MAX / params->buffer.fragment_size ||
+ params->buffer.fragments == 0)
return -EINVAL;
/* now codec parameters */
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index f48efce937ad..5957aeb1099e 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -2112,6 +2112,13 @@ int pcm_lib_apply_appl_ptr(struct snd_pcm_substream *substream,
return 0;
}
+/* allow waiting for a capture stream that hasn't been started */
+#if IS_ENABLED(CONFIG_SND_PCM_OSS)
+#define wait_capture_start(substream) ((substream)->oss.oss)
+#else
+#define wait_capture_start(substream) false
+#endif
+
/* the common loop for read/write data */
snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
void *data, bool interleaved,
@@ -2182,7 +2189,7 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
err = snd_pcm_start(substream);
if (err < 0)
goto _end_unlock;
- } else {
+ } else if (!wait_capture_start(substream)) {
/* nothing to do */
err = 0;
goto _end_unlock;