Skip to content

Commit cae0cf6

Browse files
committed
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>
1 parent 64a06f1 commit cae0cf6

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
@@ -143,8 +143,11 @@ void usb_stream_free(struct usb_stream_kernel *sk)
143143
if (!s)
144144
return;
145145

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

0 commit comments

Comments
 (0)