staging: vt6656: fix potential NULL pointer dereference

vnt_free_tx_bufs() relies on priv->tx_context elements to be NULL if
they are not initialized (as vnt_free_rx_bufs() does). Add a check to
these elements in order to avoid NULL pointer dereference.

Signed-off-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Quentin Deslandes 2019-05-20 16:39:01 +00:00 committed by Greg Kroah-Hartman
parent a7bfc177d8
commit 3fd14ebc2d
1 changed files with 3 additions and 0 deletions

View File

@ -363,6 +363,9 @@ static void vnt_free_tx_bufs(struct vnt_private *priv)
for (ii = 0; ii < priv->num_tx_context; ii++) {
tx_context = priv->tx_context[ii];
if (!tx_context)
continue;
/* deallocate URBs */
if (tx_context->urb) {
usb_kill_urb(tx_context->urb);