diff options
author | Steven Hardy <shardy@redhat.com> | 2011-04-04 12:57:37 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-04-13 18:53:16 -0400 |
commit | 10c9ab15d6aee153968d150c05b3ee3df89673de (patch) | |
tree | 810082bf8abfbc7daa43f6368aff0714a58fad91 | |
parent | c53c2fab40cf16e13af66f40bfd27200cda98d2f (diff) |
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: Steven Hardy <shardy@redhat.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/serial/qcserial.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index 8858201eb1d3..6e3b933457f4 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
@@ -205,6 +205,18 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
205 | return retval; | 205 | return retval; |
206 | } | 206 | } |
207 | 207 | ||
208 | static void qc_release(struct usb_serial *serial) | ||
209 | { | ||
210 | struct usb_wwan_intf_private *priv = usb_get_serial_data(serial); | ||
211 | |||
212 | dbg("%s", __func__); | ||
213 | |||
214 | /* Call usb_wwan release & free the private data allocated in qcprobe */ | ||
215 | usb_wwan_release(serial); | ||
216 | usb_set_serial_data(serial, NULL); | ||
217 | kfree(priv); | ||
218 | } | ||
219 | |||
208 | static struct usb_serial_driver qcdevice = { | 220 | static struct usb_serial_driver qcdevice = { |
209 | .driver = { | 221 | .driver = { |
210 | .owner = THIS_MODULE, | 222 | .owner = THIS_MODULE, |
@@ -222,7 +234,7 @@ static struct usb_serial_driver qcdevice = { | |||
222 | .chars_in_buffer = usb_wwan_chars_in_buffer, | 234 | .chars_in_buffer = usb_wwan_chars_in_buffer, |
223 | .attach = usb_wwan_startup, | 235 | .attach = usb_wwan_startup, |
224 | .disconnect = usb_wwan_disconnect, | 236 | .disconnect = usb_wwan_disconnect, |
225 | .release = usb_wwan_release, | 237 | .release = qc_release, |
226 | #ifdef CONFIG_PM | 238 | #ifdef CONFIG_PM |
227 | .suspend = usb_wwan_suspend, | 239 | .suspend = usb_wwan_suspend, |
228 | .resume = usb_wwan_resume, | 240 | .resume = usb_wwan_resume, |