提交 ed6590a8 编写于 作者: O Oliver Neukum 提交者: Greg Kroah-Hartman

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: NOliver Neukum <oneukum@suse.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 0e66fb34
...@@ -646,11 +646,13 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) ...@@ -646,11 +646,13 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
kfree(port->bulk_out_buffer); kfree(port->bulk_out_buffer);
port->bulk_in_buffer = kmalloc(URBDATA_SIZE, GFP_KERNEL); port->bulk_in_buffer = kmalloc(URBDATA_SIZE, GFP_KERNEL);
if (port->bulk_in_buffer == NULL) { if (port->bulk_in_buffer == NULL) {
port->bulk_out_buffer = NULL; /* prevent double free */
goto enomem; goto enomem;
} }
port->bulk_out_buffer = kmalloc(URBDATA_SIZE, GFP_KERNEL); port->bulk_out_buffer = kmalloc(URBDATA_SIZE, GFP_KERNEL);
if (port->bulk_out_buffer == NULL) { if (port->bulk_out_buffer == NULL) {
kfree(port->bulk_in_buffer); kfree(port->bulk_in_buffer);
port->bulk_in_buffer = NULL;
goto enomem; goto enomem;
} }
port->read_urb->transfer_buffer = port->bulk_in_buffer; port->read_urb->transfer_buffer = port->bulk_in_buffer;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册