diff options
author | Johan Hovold <johan@kernel.org> | 2015-12-29 13:36:11 +0100 |
---|---|---|
committer | Johan Hovold <johan@kernel.org> | 2015-12-29 13:43:13 +0100 |
commit | 924eccc73db2f64a24865d21ff11be8043b24375 (patch) | |
tree | f66de8ecad9723221b5c7ca5ac3bbcf5374e349c /drivers | |
parent | 0b2b093ad405b56a9e6f4f20a25da77ebfa9549c (diff) | |
download | blackbird-obmc-linux-924eccc73db2f64a24865d21ff11be8043b24375.tar.gz blackbird-obmc-linux-924eccc73db2f64a24865d21ff11be8043b24375.zip |
USB: mxu11x0: fix memory leak in port-probe error path
Fix memory leak in port-probe error path by verifying the interrupt-in
urb before allocating the private data.
Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/serial/mxu11x0.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/usb/serial/mxu11x0.c b/drivers/usb/serial/mxu11x0.c index 8884ca276e67..89426c3eba98 100644 --- a/drivers/usb/serial/mxu11x0.c +++ b/drivers/usb/serial/mxu11x0.c @@ -333,7 +333,11 @@ static int mxu1_port_probe(struct usb_serial_port *port) { struct mxu1_port *mxport; struct mxu1_device *mxdev; - struct urb *urb; + + if (!port->interrupt_in_urb) { + dev_err(&port->dev, "no interrupt urb\n"); + return -ENODEV; + } mxport = kzalloc(sizeof(struct mxu1_port), GFP_KERNEL); if (!mxport) @@ -344,12 +348,6 @@ static int mxu1_port_probe(struct usb_serial_port *port) mxdev = usb_get_serial_data(port->serial); - urb = port->interrupt_in_urb; - if (!urb) { - dev_err(&port->dev, "%s - no interrupt urb\n", __func__); - return -EINVAL; - } - switch (mxdev->mxd_model) { case MXU1_1110_PRODUCT_ID: case MXU1_1150_PRODUCT_ID: |