Patchwork [net-2.6] be2net: Fix to avoid firmware update when interface is not open.

login
register
mail settings
Submitter Sarveshwar Bandi
Date Nov. 19, 2010, 9:44 a.m.
Message ID <20101119094445.GA10165@emulex.com>
Download mbox | patch
Permalink /patch/72229/
State Accepted
Delegated to: David Miller
Headers show

Comments

Sarveshwar Bandi - Nov. 19, 2010, 9:44 a.m.
Since interrupts are enabled only when open is called on the interface,
Attempting a firmware update operation when interface is down could lead to
partial success or failure of operation. This fix fails the request if
netif_running is false.

Signed-off-by: Sarveshwar Bandi <Sarveshwar.Bandi@emulex.com>
---
 drivers/net/benet/be_main.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
David Miller - Nov. 19, 2010, 5:06 p.m.
From: Sarveshwar Bandi <Sarveshwar.Bandi@emulex.com>
Date: Fri, 19 Nov 2010 15:14:45 +0530

> Since interrupts are enabled only when open is called on the interface,
> Attempting a firmware update operation when interface is down could lead to
> partial success or failure of operation. This fix fails the request if
> netif_running is false.
> 
> Signed-off-by: Sarveshwar Bandi <Sarveshwar.Bandi@emulex.com>

Applied, thank you.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index c36cd2f..93354ee 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -2458,6 +2458,12 @@  int be_load_fw(struct be_adapter *adapte
 	int status, i = 0, num_imgs = 0;
 	const u8 *p;
 
+	if (!netif_running(adapter->netdev)) {
+		dev_err(&adapter->pdev->dev,
+			"Firmware load not allowed (interface is down)\n");
+		return -EPERM;
+	}
+
 	strcpy(fw_file, func);
 
 	status = request_firmware(&fw, fw_file, &adapter->pdev->dev);