提交 5d8c61bc 编写于 作者: J Johan Hovold 提交者: Greg Kroah-Hartman

USB: io_ti: fix sysfs-attribute creation

Make sure port data is initialised before creating sysfs attributes to
avoid a race.

A recent patch ("USB: io_ti: fix port-data memory leak") got the
sysfs-attribute creation and port-data initialisation ordering wrong.

Cc: <stable@vger.kernel.org>
Signed-off-by: NJohan Hovold <jhovold@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 0978c949
......@@ -2578,13 +2578,6 @@ static int edge_port_probe(struct usb_serial_port *port)
return -ENOMEM;
}
ret = edge_create_sysfs_attrs(port);
if (ret) {
kfifo_free(&edge_port->write_fifo);
kfree(edge_port);
return ret;
}
spin_lock_init(&edge_port->ep_lock);
edge_port->port = port;
edge_port->edge_serial = usb_get_serial_data(port->serial);
......@@ -2592,6 +2585,13 @@ static int edge_port_probe(struct usb_serial_port *port)
usb_set_serial_port_data(port, edge_port);
ret = edge_create_sysfs_attrs(port);
if (ret) {
kfifo_free(&edge_port->write_fifo);
kfree(edge_port);
return ret;
}
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册