aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-07-15 04:23:10 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-07-16 14:03:42 -0400
commit48d5548fc5e5ad79ca98a287b67f403834929739 (patch)
tree728303cb63471478d6bb0c0a11ac62b6ed15ec69 /drivers
parent9171acc7e094b3ca88e624f39891a4f3bf9d083c (diff)
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: Dan Carpenter <error27@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/orinoco/orinoco_usb.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/net/wireless/orinoco/orinoco_usb.c b/drivers/net/wireless/orinoco/orinoco_usb.c
index 020da76c9558..b7864001e7e1 100644
--- a/drivers/net/wireless/orinoco/orinoco_usb.c
+++ b/drivers/net/wireless/orinoco/orinoco_usb.c
@@ -1502,16 +1502,16 @@ static inline void ezusb_delete(struct ezusb_priv *upriv)
1502 ezusb_ctx_complete(list_entry(item, 1502 ezusb_ctx_complete(list_entry(item,
1503 struct request_context, list)); 1503 struct request_context, list));
1504 1504
1505 if (upriv->read_urb->status == -EINPROGRESS) 1505 if (upriv->read_urb && upriv->read_urb->status == -EINPROGRESS)
1506 printk(KERN_ERR PFX "Some URB in progress\n"); 1506 printk(KERN_ERR PFX "Some URB in progress\n");
1507 1507
1508 mutex_unlock(&upriv->mtx); 1508 mutex_unlock(&upriv->mtx);
1509 1509
1510 kfree(upriv->read_urb->transfer_buffer); 1510 if (upriv->read_urb) {
1511 if (upriv->bap_buf != NULL) 1511 kfree(upriv->read_urb->transfer_buffer);
1512 kfree(upriv->bap_buf);
1513 if (upriv->read_urb != NULL)
1514 usb_free_urb(upriv->read_urb); 1512 usb_free_urb(upriv->read_urb);
1513 }
1514 kfree(upriv->bap_buf);
1515 if (upriv->dev) { 1515 if (upriv->dev) {
1516 struct orinoco_private *priv = ndev_priv(upriv->dev); 1516 struct orinoco_private *priv = ndev_priv(upriv->dev);
1517 orinoco_if_del(priv); 1517 orinoco_if_del(priv);