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

Commit 10c9ab15 authored by Steven Hardy's avatar Steven Hardy Committed by Greg Kroah-Hartman
Browse files

usb: Fix qcserial memory leak on rmmod



qcprobe function allocates serial->private but this is never freed, this
patch adds a new function qc_release() which frees serial->private, after
calling usb_wwan_release

Signed-off-by: default avatarSteven Hardy <shardy@redhat.com>
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent c53c2fab
Loading
Loading
Loading
Loading
+13 −1
Original line number Original line Diff line number Diff line
@@ -205,6 +205,18 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
	return retval;
	return retval;
}
}


static void qc_release(struct usb_serial *serial)
{
	struct usb_wwan_intf_private *priv = usb_get_serial_data(serial);

	dbg("%s", __func__);

	/* Call usb_wwan release & free the private data allocated in qcprobe */
	usb_wwan_release(serial);
	usb_set_serial_data(serial, NULL);
	kfree(priv);
}

static struct usb_serial_driver qcdevice = {
static struct usb_serial_driver qcdevice = {
	.driver = {
	.driver = {
		.owner     = THIS_MODULE,
		.owner     = THIS_MODULE,
@@ -222,7 +234,7 @@ static struct usb_serial_driver qcdevice = {
	.chars_in_buffer     = usb_wwan_chars_in_buffer,
	.chars_in_buffer     = usb_wwan_chars_in_buffer,
	.attach		     = usb_wwan_startup,
	.attach		     = usb_wwan_startup,
	.disconnect	     = usb_wwan_disconnect,
	.disconnect	     = usb_wwan_disconnect,
	.release	     = usb_wwan_release,
	.release	     = qc_release,
#ifdef CONFIG_PM
#ifdef CONFIG_PM
	.suspend	     = usb_wwan_suspend,
	.suspend	     = usb_wwan_suspend,
	.resume		     = usb_wwan_resume,
	.resume		     = usb_wwan_resume,