netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v3 1/4] e1000e: Fix a null deference in e1000_open
@ 2014-12-25  1:57 Jia-Ju Bai
  2014-12-25  1:57 ` [PATCH net v3 2/4] e1000e: Add pm_qos_remove_request in error handling Jia-Ju Bai
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jia-Ju Bai @ 2014-12-25  1:57 UTC (permalink / raw)
  To: jeffrey.t.kirsher, jesse.brandeburg, bruce.w.allan,
	carolyn.wyborny, donald.c.skidmore, gregory.v.rose, matthew.vick,
	john.ronciak, mitch.a.williams
  Cc: e1000-devel, netdev, Jia-Ju Bai, linux.nics

The function vzalloc is called by e1000e_setup_rx_resources (in
e1000_open) when initializing the ethernet card driver. But when vzalloc is
failed, "err" segment in e1000e_setup_rx_resources is executed to return,
and then e1000e_free_tx_resources in "err_setup_rx" segment is executed to 
halt e1000_open. However, "writel(0, tx_ring->head)" statement in
e1000_clean_tx_ring in e1000e_free_tx_resources will cause system crash,
because "tx_ring->head" is not assigned the value. In the code,
"tx_ring->head" is initialized in e1000_configure_tx in e1000_configure
after the e1000e_setup_rx_resources.
This patch fixes this problem, and it has been tested on the hardware.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
---
 drivers/net/ethernet/intel/e1000e/netdev.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 247335d..728328b 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -1737,6 +1737,8 @@ static void e1000_clean_rx_ring(struct e1000_ring *rx_ring)
 	rx_ring->next_to_use = 0;
 	adapter->flags2 &= ~FLAG2_IS_DISCARDING;
 
+	if (!rx_ring->head)
+		return;
 	writel(0, rx_ring->head);
 	if (adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA)
 		e1000e_update_rdt_wa(rx_ring, 0);
@@ -2444,6 +2446,8 @@ static void e1000_clean_tx_ring(struct e1000_ring *tx_ring)
 	tx_ring->next_to_use = 0;
 	tx_ring->next_to_clean = 0;
 
+	if (!tx_ring->head)
+		return;
 	writel(0, tx_ring->head);
 	if (adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA)
 		e1000e_update_tdt_wa(tx_ring, 0);
@@ -4357,6 +4361,9 @@ static int e1000_open(struct net_device *netdev)
 
 	netif_carrier_off(netdev);
 
+	adapter->tx_ring->head = NULL;
+	adapter->rx_ring->head = NULL;
+
 	/* allocate transmit descriptors */
 	err = e1000e_setup_tx_resources(adapter->tx_ring);
 	if (err)
-- 
1.7.9.5



------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net v3 2/4] e1000e: Add pm_qos_remove_request in error handling
  2014-12-25  1:57 [PATCH net v3 1/4] e1000e: Fix a null deference in e1000_open Jia-Ju Bai
@ 2014-12-25  1:57 ` Jia-Ju Bai
  2014-12-25  1:57 ` [PATCH net v3 3/4] e1000e: Add netif_napi_del in the driver Jia-Ju Bai
  2014-12-25  1:57 ` [PATCH net v3 4/4] e1000e: Add pci_disable_pcie_error_reporting in error handling Jia-Ju Bai
  2 siblings, 0 replies; 5+ messages in thread
From: Jia-Ju Bai @ 2014-12-25  1:57 UTC (permalink / raw)
  To: jeffrey.t.kirsher, jesse.brandeburg, bruce.w.allan,
	carolyn.wyborny, donald.c.skidmore, gregory.v.rose, matthew.vick,
	john.ronciak, mitch.a.williams
  Cc: e1000-devel, netdev, Jia-Ju Bai, linux.nics

The driver lacks pm_qos_remove_request in error handling,
which should match pm_qos_add_request in e1000_open.
This patch fixes this problem, and it has been tested on the hardware.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
---
 drivers/net/ethernet/intel/e1000e/netdev.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 247335d..71bc244 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -4430,6 +4430,7 @@ static int e1000_open(struct net_device *netdev)
 	return 0;
 
 err_req_irq:
+	pm_qos_remove_request(&adapter->netdev->pm_qos_req);
 	e1000e_release_hw_control(adapter);
 	e1000_power_down_phy(adapter);
 	e1000e_free_rx_resources(adapter->rx_ring);
-- 
1.7.9.5



------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net v3 3/4] e1000e: Add netif_napi_del in the driver
  2014-12-25  1:57 [PATCH net v3 1/4] e1000e: Fix a null deference in e1000_open Jia-Ju Bai
  2014-12-25  1:57 ` [PATCH net v3 2/4] e1000e: Add pm_qos_remove_request in error handling Jia-Ju Bai
@ 2014-12-25  1:57 ` Jia-Ju Bai
  2014-12-26 21:42   ` [E1000-devel] " Stephen Hemminger
  2014-12-25  1:57 ` [PATCH net v3 4/4] e1000e: Add pci_disable_pcie_error_reporting in error handling Jia-Ju Bai
  2 siblings, 1 reply; 5+ messages in thread
From: Jia-Ju Bai @ 2014-12-25  1:57 UTC (permalink / raw)
  To: jeffrey.t.kirsher, jesse.brandeburg, bruce.w.allan,
	carolyn.wyborny, donald.c.skidmore, gregory.v.rose, matthew.vick,
	john.ronciak, mitch.a.williams
  Cc: e1000-devel, netdev, Jia-Ju Bai, linux.nics

The driver lacks netif_napi_del in the normal path
and error path to match the call of netif_napi_add in e1000_probe.
This patch fixes this problem, and it has been tested on the hardware.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
---
 drivers/net/ethernet/intel/e1000e/netdev.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 247335d..c5f0afc 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -7045,6 +7045,7 @@ err_hw_init:
 	kfree(adapter->tx_ring);
 	kfree(adapter->rx_ring);
 err_sw_init:
+	netif_napi_del(&adapter->napi);
 	if (adapter->hw.flash_address)
 		iounmap(adapter->hw.flash_address);
 	e1000e_reset_interrupt_capability(adapter);
@@ -7103,6 +7104,7 @@ static void e1000_remove(struct pci_dev *pdev)
 	/* Don't lie to e1000_close() down the road. */
 	if (!down)
 		clear_bit(__E1000_DOWN, &adapter->state);
+	netif_napi_del(&adapter->napi);
 	unregister_netdev(netdev);
 
 	if (pci_dev_run_wake(pdev))
-- 
1.7.9.5



------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net v3 4/4] e1000e: Add pci_disable_pcie_error_reporting in error handling
  2014-12-25  1:57 [PATCH net v3 1/4] e1000e: Fix a null deference in e1000_open Jia-Ju Bai
  2014-12-25  1:57 ` [PATCH net v3 2/4] e1000e: Add pm_qos_remove_request in error handling Jia-Ju Bai
  2014-12-25  1:57 ` [PATCH net v3 3/4] e1000e: Add netif_napi_del in the driver Jia-Ju Bai
@ 2014-12-25  1:57 ` Jia-Ju Bai
  2 siblings, 0 replies; 5+ messages in thread
From: Jia-Ju Bai @ 2014-12-25  1:57 UTC (permalink / raw)
  To: jeffrey.t.kirsher, jesse.brandeburg, bruce.w.allan,
	carolyn.wyborny, donald.c.skidmore, gregory.v.rose, matthew.vick,
	john.ronciak, mitch.a.williams
  Cc: e1000-devel, netdev, Jia-Ju Bai, linux.nics

The driver lacks pci_disable_pcie_error_reporting in error handling,
which should match pci_enable_pcie_error_reporting in e1000_probe.
This patch fixes this problem, and it has been tested on the hardware.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
---
 drivers/net/ethernet/intel/e1000e/netdev.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 247335d..098c3c2 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -7053,6 +7053,7 @@ err_flashmap:
 err_ioremap:
 	free_netdev(netdev);
 err_alloc_etherdev:
+	pci_disable_pcie_error_reporting(pdev);
 	pci_release_selected_regions(pdev,
 				     pci_select_bars(pdev, IORESOURCE_MEM));
 err_pci_reg:
-- 
1.7.9.5



------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [E1000-devel] [PATCH net v3 3/4] e1000e: Add netif_napi_del in the driver
  2014-12-25  1:57 ` [PATCH net v3 3/4] e1000e: Add netif_napi_del in the driver Jia-Ju Bai
@ 2014-12-26 21:42   ` Stephen Hemminger
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2014-12-26 21:42 UTC (permalink / raw)
  To: Jia-Ju Bai
  Cc: jeffrey.t.kirsher, jesse.brandeburg, bruce.w.allan,
	carolyn.wyborny, donald.c.skidmore, gregory.v.rose, matthew.vick,
	john.ronciak, mitch.a.williams, e1000-devel, netdev, linux.nics

On Thu, 25 Dec 2014 09:57:02 +0800
Jia-Ju Bai <baijiaju1990@163.com> wrote:

> The driver lacks netif_napi_del in the normal path
> and error path to match the call of netif_napi_add in e1000_probe.
> This patch fixes this problem, and it has been tested on the hardware.
> 
> Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>

Another case where netif_napi_del is not needed since already
handled by free_netdev

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-12-26 21:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-25  1:57 [PATCH net v3 1/4] e1000e: Fix a null deference in e1000_open Jia-Ju Bai
2014-12-25  1:57 ` [PATCH net v3 2/4] e1000e: Add pm_qos_remove_request in error handling Jia-Ju Bai
2014-12-25  1:57 ` [PATCH net v3 3/4] e1000e: Add netif_napi_del in the driver Jia-Ju Bai
2014-12-26 21:42   ` [E1000-devel] " Stephen Hemminger
2014-12-25  1:57 ` [PATCH net v3 4/4] e1000e: Add pci_disable_pcie_error_reporting in error handling Jia-Ju Bai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).