提交 038c35a8 编写于 作者: G Ganesh Goudar 提交者: David S. Miller

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: NGanesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 738b35cc
......@@ -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 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
err = -ENOMEM;
goto free_adapter;
}
spin_lock_init(&adapter->mbox_lock);
INIT_LIST_HEAD(&adapter->mlist.list);
pci_set_drvdata(pdev, adapter);
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册