* [PATCH net-next] cxgb4: Initialize mbox lock and list for mgmt dev
@ 2017-01-12 6:53 Ganesh Goudar
2017-01-12 14:24 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Ganesh Goudar @ 2017-01-12 6:53 UTC (permalink / raw)
To: netdev, davem; +Cc: nirranjan, hariprasad, Ganesh Goudar
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>
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 3349e1f..e95bb6a 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 @@ 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;
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] cxgb4: Initialize mbox lock and list for mgmt dev
2017-01-12 6:53 [PATCH net-next] cxgb4: Initialize mbox lock and list for mgmt dev Ganesh Goudar
@ 2017-01-12 14:24 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-01-12 14:24 UTC (permalink / raw)
To: ganeshgr; +Cc: netdev, nirranjan, hariprasad
From: Ganesh Goudar <ganeshgr@chelsio.com>
Date: Thu, 12 Jan 2017 12:23:21 +0530
> 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>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-12 14:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-12 6:53 [PATCH net-next] cxgb4: Initialize mbox lock and list for mgmt dev Ganesh Goudar
2017-01-12 14:24 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.