Commit 915c5857 authored by Karicheri, Muralidharan's avatar Karicheri, Muralidharan Committed by David S. Miller

net: netcp: check for interface handle in netcp_module_probe()

Currently netcp_module_probe() doesn't check the return value of
of_parse_phandle() that points to the interface data for the
module and then pass the node ptr to the module which is incorrect.
Check for return value and free the intf_modpriv if there is error.
Signed-off-by: default avatarMurali Karicheri <m-karicheri2@ti.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e558b1fb
...@@ -299,6 +299,11 @@ static int netcp_module_probe(struct netcp_device *netcp_device, ...@@ -299,6 +299,11 @@ static int netcp_module_probe(struct netcp_device *netcp_device,
interface = of_parse_phandle(netcp_intf->node_interface, interface = of_parse_phandle(netcp_intf->node_interface,
module->name, 0); module->name, 0);
if (!interface) {
devm_kfree(dev, intf_modpriv);
continue;
}
intf_modpriv->netcp_priv = netcp_intf; intf_modpriv->netcp_priv = netcp_intf;
intf_modpriv->netcp_module = module; intf_modpriv->netcp_module = module;
list_add_tail(&intf_modpriv->intf_list, list_add_tail(&intf_modpriv->intf_list,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment