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

Configure Feed

Select the types of activity you want to include in your feed.

JFFS2: add missing verify buffer allocation/deallocation

The function jffs2_nor_wbuf_flash_setup() doesn't allocate the verify buffer
if CONFIG_JFFS2_FS_WBUF_VERIFY is defined, so causing a kernel panic when
that macro is enabled and the verify function is called. Similarly the
jffs2_nor_wbuf_flash_cleanup() must free the buffer if
CONFIG_JFFS2_FS_WBUF_VERIFY is enabled.
The following patch fixes the problem.
The following patch applies to 2.6.30 kernel.

Signed-off-by: Massimo Cirillo <maxcir@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Cc: stable@kernel.org

authored by

Massimo Cirillo and committed by
David Woodhouse
bc8cec0d 16f05c2b

+10
+10
fs/jffs2/wbuf.c
··· 1268 1268 if (!c->wbuf) 1269 1269 return -ENOMEM; 1270 1270 1271 + #ifdef CONFIG_JFFS2_FS_WBUF_VERIFY 1272 + c->wbuf_verify = kmalloc(c->wbuf_pagesize, GFP_KERNEL); 1273 + if (!c->wbuf_verify) { 1274 + kfree(c->wbuf); 1275 + return -ENOMEM; 1276 + } 1277 + #endif 1271 1278 return 0; 1272 1279 } 1273 1280 1274 1281 void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c) { 1282 + #ifdef CONFIG_JFFS2_FS_WBUF_VERIFY 1283 + kfree(c->wbuf_verify); 1284 + #endif 1275 1285 kfree(c->wbuf); 1276 1286 } 1277 1287