summaryrefslogtreecommitdiff
path: root/sound/usb
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2021-05-17 16:15:43 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-20 17:05:39 +0300
commit7d7f30cf182e55023fa8fde4c084b2d37c6be69d (patch)
tree7ae20e8e2fd6857034f0017ca31cc2c780884d52 /sound/usb
parentf4997bf6c4486ace3eb9d3a7d1658d82136bb409 (diff)
downloadlinux-7d7f30cf182e55023fa8fde4c084b2d37c6be69d.tar.xz
ALSA: usx2y: Don't call free_pages_exact() with NULL address
[ Upstream commit cae0cf651adccee2c3f376e78f30fbd788d0829f ] 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>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/usx2y/usb_stream.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sound/usb/usx2y/usb_stream.c b/sound/usb/usx2y/usb_stream.c
index 091c071b270a..cff684942c4f 100644
--- a/sound/usb/usx2y/usb_stream.c
+++ b/sound/usb/usx2y/usb_stream.c
@@ -142,8 +142,11 @@ void usb_stream_free(struct usb_stream_kernel *sk)
if (!s)
return;
- free_pages_exact(sk->write_page, s->write_size);
- sk->write_page = NULL;
+ if (sk->write_page) {
+ free_pages_exact(sk->write_page, s->write_size);
+ sk->write_page = NULL;
+ }
+
free_pages_exact(s, s->read_size);
sk->s = NULL;
}