diff options
author | Takashi Iwai <tiwai@suse.de> | 2021-05-17 15:15:43 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2021-05-17 16:05:20 +0200 |
commit | cae0cf651adccee2c3f376e78f30fbd788d0829f (patch) | |
tree | 175eda138fcd37e95977a1207bb7c16433b8c85b | |
parent | ALSA: usx2y: Fix shmem initialization (diff) | |
download | linux-cae0cf651adccee2c3f376e78f30fbd788d0829f.tar.xz linux-cae0cf651adccee2c3f376e78f30fbd788d0829f.zip |
ALSA: usx2y: Don't call free_pages_exact() with NULL address
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>
-rw-r--r-- | sound/usb/usx2y/usb_stream.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sound/usb/usx2y/usb_stream.c b/sound/usb/usx2y/usb_stream.c index 820647331aba..9d0e44793896 100644 --- a/sound/usb/usx2y/usb_stream.c +++ b/sound/usb/usx2y/usb_stream.c @@ -143,8 +143,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; } |