* [net-2.6 PATCH] be2net: Fix to avoid firmware update when interface is not open.
@ 2010-11-18 14:07 Sarveshwar Bandi
2010-11-18 17:26 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Sarveshwar Bandi @ 2010-11-18 14:07 UTC (permalink / raw)
To: netdev; +Cc: davem
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(-)
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index c36cd2f..cc85cf2 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 -1;
+ }
+
strcpy(fw_file, func);
status = request_firmware(&fw, fw_file, &adapter->pdev->dev);
--
1.4.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [net-2.6 PATCH] be2net: Fix to avoid firmware update when interface is not open.
2010-11-18 14:07 [net-2.6 PATCH] be2net: Fix to avoid firmware update when interface is not open Sarveshwar Bandi
@ 2010-11-18 17:26 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-11-18 17:26 UTC (permalink / raw)
To: Sarveshwar.Bandi; +Cc: netdev
From: Sarveshwar Bandi <Sarveshwar.Bandi@emulex.com>
Date: Thu, 18 Nov 2010 19:37:56 +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>
These status values you are returning from be_load_fw() go all
the way back to userspace.
Therefore "-1" is not appropriate, and instead you should return
real negative errno error values such as -EINVAL, -ENODEV, and
the like.
Please fix this up and resubmit your patch.
Thank you.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [net-2.6 PATCH] be2net: Fix to avoid firmware update when interface is not open.
@ 2010-11-19 9:44 Sarveshwar Bandi
2010-11-19 17:06 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Sarveshwar Bandi @ 2010-11-19 9:44 UTC (permalink / raw)
To: netdev; +Cc: davem
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(-)
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);
--
1.4.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [net-2.6 PATCH] be2net: Fix to avoid firmware update when interface is not open.
2010-11-19 9:44 Sarveshwar Bandi
@ 2010-11-19 17:06 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-11-19 17:06 UTC (permalink / raw)
To: Sarveshwar.Bandi; +Cc: netdev
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-11-19 17:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-18 14:07 [net-2.6 PATCH] be2net: Fix to avoid firmware update when interface is not open Sarveshwar Bandi
2010-11-18 17:26 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2010-11-19 9:44 Sarveshwar Bandi
2010-11-19 17:06 ` David Miller
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).