starfire: clean up properly if firmware loading fails
Subsystems (2)
PATCH 1/1 starfire: clean up properly if firmware loading fails
From: Ben Hutchings <[email protected]>
netdev_open() will return without cleaning up net device or hardware state if firmware loading fails. This results in a BUG() on a second attempt to bring the interface up, reported in
<http://bugzilla.kernel.org/show_bug.cgi?id=15117>, and probably has even worse effects if the driver is removed afterwards.
Call netdev_close() to clean up on failure.
Addresses http://bugzilla.kernel.org/show_bug.cgi?id=15091
---
drivers/net/starfire.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/starfire.c renamed from drivers/net/starfire.c~starfire-clean-up-properly-if-firmware-loading-fails +4 -1
@@ -1063,7 +1063,7 @@ static int netdev_open(struct net_deviceif (retval) {printk (KERN_ERR "starfire: Failed to load firmware \"%s\"\n" ,FIRMWARE_RX ); -return retval; + goto out_init; }if (fw_rx->size %4 ) { printk(KERN_ERR "starfire: bogus length %zu in \"%s\"\n",
@@ -1108,6 +1108,9 @@ out_tx:release_firmware (fw_tx); out_rx:release_firmware (fw_rx); +out_init: +if (retval) +netdev_close (dev);return retval; }
_
From: [email protected]
Date: Tue, 26 Jan 2010 20:27:09 -0800
Quoted 10 lines
From: Ben Hutchings <[email protected]>
netdev_open()will return without cleaning up net device or hardware state if firmware loading fails. This results in aBUG()on a second attempt to bring the interface up, reported in
<http://bugzilla.kernel.org/show_bug.cgi?id=15117>, and probably has even worse effects if the driver is removed afterwards.Call
netdev_close()to clean up on failure.
Quoted 8 lines
Addresses http://bugzilla.kernel.org/show_bug.cgi?id=15091
Signed-off-by Ben Hutchings <[email protected]>Reported-by Michael Moffatt <[email protected]>Tested-by Michael Moffatt <[email protected]>Cc "David S. Miller" <[email protected]>Cc <[email protected]>Signed-off-by Andrew Morton <[email protected]>
Applied, thanks everyone!
Quoted 7 lines · On Tue, 2010-01-26 at 20:27 -0800, [email protected] wrote:
From: Ben Hutchings <[email protected]>
netdev_open()will return without cleaning up net device or hardware state if firmware loading fails. This results in aBUG()on a second attempt to bring the interface up, reported in
<http://bugzilla.kernel.org/show_bug.cgi?id=15117>, and probably has even worse effects if the driver is removed afterwards.
David, please correct the URL above before applying the patch so I don't continue to look like an idiot. :-) It should be
<http://bugzilla.kernel.org/show_bug.cgi?id=15091> as added by Andrew below.
Ben.
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
David Miller
maintainerFrom: Ben Hutchings <[email protected]>
Date: Wed, 27 Jan 2010 04:58:17 +0000
Quoted 9 lines · On Tue, 2010-01-26 at 20:27 -0800, [email protected] wrote:
Quoted 7 lines
From: Ben Hutchings <[email protected]>
netdev_open()will return without cleaning up net device or hardware state if firmware loading fails. This results in aBUG()on a second attempt to bring the interface up, reported in
<http://bugzilla.kernel.org/show_bug.cgi?id=15117>, and probably has even worse effects if the driver is removed afterwards.
Quoted 4 lines
David, please correct the URL above before applying the patch so I don't continue to look like an idiot. :-) It should be
<http://bugzilla.kernel.org/show_bug.cgi?id=15091> as added by Andrew below.
Done.