Commit d9efd2af461abb7b54c49c1b7e654d496dd1d379

Authored by Sarveshwar Bandi
Committed by David S. Miller
1 parent dba4490d22

be2net: Fix to avoid firmware update when interface is not open.

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>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 6 additions and 0 deletions Side-by-side Diff

drivers/net/benet/be_main.c
... ... @@ -2458,6 +2458,12 @@
2458 2458 int status, i = 0, num_imgs = 0;
2459 2459 const u8 *p;
2460 2460  
  2461 + if (!netif_running(adapter->netdev)) {
  2462 + dev_err(&adapter->pdev->dev,
  2463 + "Firmware load not allowed (interface is down)\n");
  2464 + return -EPERM;
  2465 + }
  2466 +
2461 2467 strcpy(fw_file, func);
2462 2468  
2463 2469 status = request_firmware(&fw, fw_file, &adapter->pdev->dev);