From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753929AbZIKAeZ (ORCPT ); Thu, 10 Sep 2009 20:34:25 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752570AbZIKAeW (ORCPT ); Thu, 10 Sep 2009 20:34:22 -0400 Received: from kroah.org ([198.145.64.141]:33163 "EHLO coco.kroah.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753799AbZIKAdv (ORCPT ); Thu, 10 Sep 2009 20:33:51 -0400 X-Mailbox-Line: From gregkh@mini.kroah.org Thu Sep 10 17:30:39 2009 Message-Id: <20090911003039.046646116@mini.kroah.org> User-Agent: quilt/0.48-1 Date: Thu, 10 Sep 2009 17:29:26 -0700 From: Greg KH To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: stable-review@kernel.org, torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, Massimo Cirillo , Artem Bityutskiy , David Woodhouse Subject: [patch 3/4] JFFS2: add missing verify buffer allocation/deallocation References: <20090911002923.745284267@mini.kroah.org> Content-Disposition: inline; filename=jffs2-add-missing-verify-buffer-allocation-deallocation.patch In-Reply-To: <20090911003124.GA12842@kroah.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2.6.27-stable review patch. If anyone has any objections, please let us know. ------------------ From: Massimo Cirillo commit bc8cec0dff072f1a45ce7f6b2c5234bb3411ac51 upstream. 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 Signed-off-by: Artem Bityutskiy Signed-off-by: David Woodhouse Signed-off-by: Greg Kroah-Hartman --- fs/jffs2/wbuf.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/fs/jffs2/wbuf.c +++ b/fs/jffs2/wbuf.c @@ -1271,10 +1271,20 @@ int jffs2_nor_wbuf_flash_setup(struct jf if (!c->wbuf) return -ENOMEM; +#ifdef CONFIG_JFFS2_FS_WBUF_VERIFY + c->wbuf_verify = kmalloc(c->wbuf_pagesize, GFP_KERNEL); + if (!c->wbuf_verify) { + kfree(c->wbuf); + return -ENOMEM; + } +#endif return 0; } void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c) { +#ifdef CONFIG_JFFS2_FS_WBUF_VERIFY + kfree(c->wbuf_verify); +#endif kfree(c->wbuf); }