From 584d11ee5406d624485e1ac801fd9264a210c609 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Fri, 5 Aug 2005 04:56:14 +0000 Subject: [PATCH] When the MAC address is reported all zeros, then error is necessarily 0. This means that we 'succeed' the attach, even after we've freed the internal data bits. This leads to a panic when you eject the card with this problem. Set error = ENXIO in the mac read zeros case. --- sys/dev/wi/if_wi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c index 72f5eca74bd7..c80c93901cc5 100644 --- a/sys/dev/wi/if_wi.c +++ b/sys/dev/wi/if_wi.c @@ -294,8 +294,10 @@ wi_attach(device_t dev) if (error || IEEE80211_ADDR_EQ(ic->ic_myaddr, empty_macaddr)) { if (error != 0) device_printf(dev, "mac read failed %d\n", error); - else + else { device_printf(dev, "mac read failed (all zeros)\n"); + error = ENXIO; + } wi_free(dev); return (error); }