diff options
author | Oliver Neukum <oliver@neukum.org> | 2007-09-17 20:15:53 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-12 14:55:26 -0700 |
commit | ed6590a861a16276db34ee626375fa79f3369ac3 (patch) | |
tree | b8f20b07045e42ba77eea677ac7314a6e8b0d62c /drivers/usb | |
parent | 0e66fb3492442faa17fc7f27a3eba35b3c811e38 (diff) | |
download | kernel-crypto-ed6590a861a16276db34ee626375fa79f3369ac3.tar.gz kernel-crypto-ed6590a861a16276db34ee626375fa79f3369ac3.tar.xz kernel-crypto-ed6590a861a16276db34ee626375fa79f3369ac3.zip |
USB: fix double frees in error code paths of ipaq driver
the error code paths can be enter with buffers to freed buffers.
Serial core would do a kfree() on memory already freed.
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/serial/ipaq.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index 6a3a704b584..c1a6484f652 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c @@ -646,11 +646,13 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) kfree(port->bulk_out_buffer); port->bulk_in_buffer = kmalloc(URBDATA_SIZE, GFP_KERNEL); if (port->bulk_in_buffer == NULL) { + port->bulk_out_buffer = NULL; /* prevent double free */ goto enomem; } port->bulk_out_buffer = kmalloc(URBDATA_SIZE, GFP_KERNEL); if (port->bulk_out_buffer == NULL) { kfree(port->bulk_in_buffer); + port->bulk_in_buffer = NULL; goto enomem; } port->read_urb->transfer_buffer = port->bulk_in_buffer; |