aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorKaricheri, Muralidharan <m-karicheri2@ti.com>2015-09-23 13:37:09 -0400
committerDavid S. Miller <davem@davemloft.net>2015-09-23 14:37:37 -0700
commit915c5857874fc211874de1363e88f902e581e6eb (patch)
tree24fde088492a71703e6ce56da55409d2afe45ef6 /drivers/net
parentnet: netcp: add error check to netcp_allocate_rx_buf() (diff)
downloadlinux-dev-915c5857874fc211874de1363e88f902e581e6eb.tar.xz
linux-dev-915c5857874fc211874de1363e88f902e581e6eb.zip
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: Murali Karicheri <m-karicheri2@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/ti/netcp_core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
index 97e2629c10b9..d39dce3b37a7 100644
--- a/drivers/net/ethernet/ti/netcp_core.c
+++ b/drivers/net/ethernet/ti/netcp_core.c
@@ -299,6 +299,11 @@ static int netcp_module_probe(struct netcp_device *netcp_device,
interface = of_parse_phandle(netcp_intf->node_interface,
module->name, 0);
+ if (!interface) {
+ devm_kfree(dev, intf_modpriv);
+ continue;
+ }
+
intf_modpriv->netcp_priv = netcp_intf;
intf_modpriv->netcp_module = module;
list_add_tail(&intf_modpriv->intf_list,