ubi: Error freeing ubi->vtbl while unloading

Vinit Agnihotri vinit.agnihotri at gmail.com
Fri Jun 15 06:01:22 EDT 2007


I downloaded latest git & backported ubi to make it work in linux
kernel 2.6.18.3.

Machine details
 AMD opteron 64bit SMP, linux kernel version 2.6.18.3

However while unloading ubi I discovered slab corruption. Ths problem
is as follows.

ubi->vtbl is allocated using vmalloc() in vtbl.c empty_create_lvol(),
but it is freed in build.c with kfree()

Heres a patch that makes a fix

--- build.c	2007-06-07 14:54:49.000000000 +0530
+++ build.c	2007-06-15 15:22:32.000000000 +0530
@@ -369,7 +369,7 @@
 out_wl:
 	ubi_wl_close(ubi);
 out_vtbl:
-	kfree(ubi->vtbl);
+	vfree(ubi->vtbl);
 out_si:
 	ubi_scan_destroy_si(si);
 	return err;
@@ -629,7 +629,7 @@
 out_detach:
 	ubi_eba_close(ubi);
 	ubi_wl_close(ubi);
-	kfree(ubi->vtbl);
+	vfree(ubi->vtbl);
 out_free:
 	kfree(ubi);
 out_mtd:


-- I feel free now



More information about the linux-mtd mailing list