diff options
author | Ganesh Goudar <ganeshgr@chelsio.com> | 2017-01-12 12:23:21 +0530 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-01-12 09:23:53 -0500 |
commit | 038c35a86d213c69faf7aa9500ab9001c3774e15 (patch) | |
tree | fd0744d252300aea243f2d963525b9db3092af12 | |
parent | 738b35ccee1bcd7cf4af147edd76e7880533ad9f (diff) |
cxgb4: Initialize mbox lock and list for mgmt dev
Initialize mbox lock and list for mgmt dev to avoid NULL pointer
dereference when cxgb_set_vf_mac is called.
And also allocate memory for private data while allocating mgmt
netdev.
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 3349e1f376c3..e95bb6a0eca8 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -4516,7 +4516,8 @@ static int config_mgmt_dev(struct pci_dev *pdev) int err; snprintf(name, IFNAMSIZ, "mgmtpf%d%d", adap->adap_idx, adap->pf); - netdev = alloc_netdev(0, name, NET_NAME_UNKNOWN, dummy_setup); + netdev = alloc_netdev(sizeof(struct port_info), name, NET_NAME_UNKNOWN, + dummy_setup); if (!netdev) return -ENOMEM; @@ -4990,6 +4991,8 @@ sriov: err = -ENOMEM; goto free_adapter; } + spin_lock_init(&adapter->mbox_lock); + INIT_LIST_HEAD(&adapter->mlist.list); pci_set_drvdata(pdev, adapter); return 0; |