Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

starfire: clean up properly if firmware loading fails

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=15091>, 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

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Reported-by: Michael Moffatt <michael@moffatt.org.nz>
Tested-by: Michael Moffatt <michael@moffatt.org.nz>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ben Hutchings and committed by
David S. Miller
c928febf c92b544b

+4 -1
+4 -1
drivers/net/starfire.c
··· 1063 1063 if (retval) { 1064 1064 printk(KERN_ERR "starfire: Failed to load firmware \"%s\"\n", 1065 1065 FIRMWARE_RX); 1066 - return retval; 1066 + goto out_init; 1067 1067 } 1068 1068 if (fw_rx->size % 4) { 1069 1069 printk(KERN_ERR "starfire: bogus length %zu in \"%s\"\n", ··· 1108 1108 release_firmware(fw_tx); 1109 1109 out_rx: 1110 1110 release_firmware(fw_rx); 1111 + out_init: 1112 + if (retval) 1113 + netdev_close(dev); 1111 1114 return retval; 1112 1115 } 1113 1116