usb: typec: tcpci: fix of node refcount leak in tcpci_register_port()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 5e85a04c8c0d271d7561a770b85741f186398868 · < 0384e87e3fec735e47f1c133c796f32ef7a72a9b| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
usb: typec: tcpci: fix of node refcount leak in tcpci_register_port()
I got the following report while doing device(mt6370-tcpc) load test with CONFIG_OF_UNITTEST and CONFIG_OF_DYNAMIC enabled:
OF: ERROR: memory leak, expected refcount 1 instead of 2, of_node_get()/of_node_put() unbalanced - destroy cset entry: attach overlay node /i2c/pmic@34/tcpc/connector
The 'fwnode' set in tcpci_parse_config() which is called in tcpci_register_port(), its node refcount is increased in device_get_named_child_node(). It needs be put while exiting, so call fwnode_handle_put() in the error path of tcpci_register_port() and in tcpci_unregister_port() to avoid leak.
From the CVE record · Linux
The Linux kernel’s USB Type-C TCPCI code can leak a firmware-node reference when registering or unregistering a port. The issue was observed during device load testing with CONFIG_OF_UNITTEST and CONFIG_OF_DYNAMIC enabled. The input does not describe an attacker action, access requirement, or user interaction.
Engineers running Linux kernels with USB Type-C TCPCI support should check their kernel version; affected versions are not specified.