From: Quentin Deslandes Date: Mon, 20 May 2019 16:39:01 +0000 (+0000) Subject: staging: vt6656: fix potential NULL pointer dereference X-Git-Tag: v5.15~5977^2~439 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3fd14ebc2d5233e0fd6a90486cb88f5592875a6b;p=platform%2Fkernel%2Flinux-starfive.git 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index ccafcc2..bfe952f 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -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);