Browse Source

orinoco_usb: fix memory leak in ezusb_access_ltv() when device disconnected

If "device is disconnected" check occurs to be true in ezusb_access_ltv(),
it just return -ENODEV. But that means request_context is leaked since
there are no any references to it anymore.
The patch adds a call to ezusb_request_context_put() before return.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Alexey Khoroshilov 12 years ago
parent
commit
1105a13bb8
1 changed files with 2 additions and 1 deletions
  1. 2 1
      drivers/net/wireless/orinoco/orinoco_usb.c

+ 2 - 1
drivers/net/wireless/orinoco/orinoco_usb.c

@@ -881,7 +881,8 @@ static int ezusb_access_ltv(struct ezusb_priv *upriv,
 
 	if (!upriv->udev) {
 		dbg("Device disconnected");
-		return -ENODEV;
+		retval = -ENODEV;
+		goto exit;
 	}
 
 	if (upriv->read_urb->status != -EINPROGRESS)