commit: 2f338c8a1904e2e7aa5a8bd12fb0cf2422d17da4
From: Oliver Neukum <[email protected]>
Date: Fri, 27 Apr 2012 14:36:37 +0200
Subject: USB: cdc-wdm: fix memory leak

cleanup() is not called if the last close() comes after
disconnect(). That leads to a memory leak. Rectified
by checking for an earlier disconnect() in release()

Signed-off-by: Oliver Neukum <[email protected]>
Cc: stable <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
 drivers/usb/class/cdc-wdm.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index b29a981..650e1da 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -622,6 +622,8 @@ static int wdm_release(struct inode *inode, struct file 
*file)
                kill_urbs(desc);
                if (!test_bit(WDM_DISCONNECTING, &desc->flags))
                        desc->manage_power(desc->intf, 0);
+               else
+                       cleanup(desc);
        }
        mutex_unlock(&wdm_mutex);
        return 0;
-- 
1.7.3.4
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to