Skip to content

Commit 7d7f30c

Browse files
tiwaigregkh
authored andcommitted
ALSA: usx2y: Don't call free_pages_exact() with NULL address
[ Upstream commit cae0cf6 ] Unlike some other functions, we can't pass NULL pointer to free_pages_exact(). Add a proper NULL check for avoiding possible Oops. Link: https://lore.kernel.org/r/20210517131545.27252-10-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent f4997bf commit 7d7f30c

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎sound/usb/usx2y/usb_stream.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,11 @@ void usb_stream_free(struct usb_stream_kernel *sk)
142142
if (!s)
143143
return;
144144

145-
free_pages_exact(sk->write_page, s->write_size);
146-
sk->write_page = NULL;
145+
if (sk->write_page) {
146+
free_pages_exact(sk->write_page, s->write_size);
147+
sk->write_page = NULL;
148+
}
149+
147150
free_pages_exact(s, s->read_size);
148151
sk->s = NULL;
149152
}

0 commit comments

Comments
 (0)