Commit 48d5548f authored by Dan Carpenter's avatar Dan Carpenter Committed by John W. Linville

orinoco_usb: potential null dereference

Smatch complains that "upriv->read_urb" gets dereferenced before
checking for NULL.  It turns out that it's possible for
"upriv->read_urb" to be NULL so I added checks around the dereferences.

Also I remove an "if (upriv->bap_buf != NULL)" check because
"kfree(NULL) is OK.
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 9171acc7
...@@ -1502,16 +1502,16 @@ static inline void ezusb_delete(struct ezusb_priv *upriv) ...@@ -1502,16 +1502,16 @@ static inline void ezusb_delete(struct ezusb_priv *upriv)
ezusb_ctx_complete(list_entry(item, ezusb_ctx_complete(list_entry(item,
struct request_context, list)); struct request_context, list));
if (upriv->read_urb->status == -EINPROGRESS) if (upriv->read_urb && upriv->read_urb->status == -EINPROGRESS)
printk(KERN_ERR PFX "Some URB in progress\n"); printk(KERN_ERR PFX "Some URB in progress\n");
mutex_unlock(&upriv->mtx); mutex_unlock(&upriv->mtx);
kfree(upriv->read_urb->transfer_buffer); if (upriv->read_urb) {
if (upriv->bap_buf != NULL) kfree(upriv->read_urb->transfer_buffer);
kfree(upriv->bap_buf);
if (upriv->read_urb != NULL)
usb_free_urb(upriv->read_urb); usb_free_urb(upriv->read_urb);
}
kfree(upriv->bap_buf);
if (upriv->dev) { if (upriv->dev) {
struct orinoco_private *priv = ndev_priv(upriv->dev); struct orinoco_private *priv = ndev_priv(upriv->dev);
orinoco_if_del(priv); orinoco_if_del(priv);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment