mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 21:45:45 +02:00
ALSA: pcm: Check for null pointer of pointer substream before dereferencing it
[ Upstream commit011b559be8] Pointer substream is being dereferenced on the assignment of pointer card before substream is being null checked with the macro PCM_RUNTIME_CHECK. Although PCM_RUNTIME_CHECK calls BUG_ON, it still is useful to perform the the pointer check before card is assigned. Fixes:d4cfb30fce("ALSA: pcm: Set per-card upper limit of PCM buffer allocations") Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20220424205945.1372247-1-colin.i.king@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
d764a7d647
commit
f2c68c5289
|
|
@ -434,7 +434,6 @@ EXPORT_SYMBOL(snd_pcm_lib_malloc_pages);
|
||||||
*/
|
*/
|
||||||
int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream)
|
int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream)
|
||||||
{
|
{
|
||||||
struct snd_card *card = substream->pcm->card;
|
|
||||||
struct snd_pcm_runtime *runtime;
|
struct snd_pcm_runtime *runtime;
|
||||||
|
|
||||||
if (PCM_RUNTIME_CHECK(substream))
|
if (PCM_RUNTIME_CHECK(substream))
|
||||||
|
|
@ -443,6 +442,8 @@ int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream)
|
||||||
if (runtime->dma_area == NULL)
|
if (runtime->dma_area == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
if (runtime->dma_buffer_p != &substream->dma_buffer) {
|
if (runtime->dma_buffer_p != &substream->dma_buffer) {
|
||||||
|
struct snd_card *card = substream->pcm->card;
|
||||||
|
|
||||||
/* it's a newly allocated buffer. release it now. */
|
/* it's a newly allocated buffer. release it now. */
|
||||||
do_free_pages(card, runtime->dma_buffer_p);
|
do_free_pages(card, runtime->dma_buffer_p);
|
||||||
kfree(runtime->dma_buffer_p);
|
kfree(runtime->dma_buffer_p);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user