Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f338c8a authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman
Browse files

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: default avatarOliver Neukum <oneukum@suse.de>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 24a85bae
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -622,6 +622,8 @@ static int wdm_release(struct inode *inode, struct file *file)
		kill_urbs(desc);
		kill_urbs(desc);
		if (!test_bit(WDM_DISCONNECTING, &desc->flags))
		if (!test_bit(WDM_DISCONNECTING, &desc->flags))
			desc->manage_power(desc->intf, 0);
			desc->manage_power(desc->intf, 0);
		else
			cleanup(desc);
	}
	}
	mutex_unlock(&wdm_mutex);
	mutex_unlock(&wdm_mutex);
	return 0;
	return 0;