broadcom-wl: fix memory corruption and leakage on remove (patch from #9576 by George...
[openwrt/svn-archive/archive.git] / package / broadcom-wl / patches / 006-fix-mem-leak-on-unload.patch
1 From: George Kashperko <george@znau.edu.ua>
2
3 Release nvram variables buffer.
4 Prevent block reserved by alloc_etherdev from being freed.
5 Signed-off-by: George Kashperko <george@znau.edu.ua>
6 ---
7 ---
8 --- a/driver/siutils.c
9 +++ b/driver/siutils.c
10 @@ -647,7 +647,10 @@ si_detach(si_t *sih)
11 #if !defined(BCMBUSTYPE) || (BCMBUSTYPE == SI_BUS)
12 if (sii != &ksii)
13 #endif /* !BCMBUSTYPE || (BCMBUSTYPE == SI_BUS) */
14 - MFREE(sii->osh, sii, sizeof(si_info_t));
15 + do {
16 + MFREE(sii->osh, sii, sizeof(si_info_t));
17 + nvram_exit((void *)&(sii->pub));
18 + } while (0);
19 }
20
21 void *
22 --- a/driver/wl_linux.c
23 +++ b/driver/wl_linux.c
24 @@ -1477,7 +1477,6 @@ wl_free_if(wl_info_t *wl, wl_if_t *wlif)
25 free_netdev(wlif->dev);
26 #endif
27 }
28 - MFREE(wl->osh, wlif, sizeof(wl_if_t));
29 }
30
31 #ifdef AP