From patchwork Fri Jun 10 07:33:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dilger X-Patchwork-Id: 99853 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A23C7B6F86 for ; Fri, 10 Jun 2011 17:33:14 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751803Ab1FJHdI (ORCPT ); Fri, 10 Jun 2011 03:33:08 -0400 Received: from idcmail-mo1so.shaw.ca ([24.71.223.10]:3961 "EHLO idcmail-mo1so.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752211Ab1FJHdI (ORCPT ); Fri, 10 Jun 2011 03:33:08 -0400 Received: from pd4ml1so-ssvc.prod.shaw.ca ([10.0.141.141]) by pd3mo1so-svcs.prod.shaw.ca with ESMTP; 10 Jun 2011 01:33:07 -0600 X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=sOeZmqKXo9QeAvPHcA4bYEQFU2ce9l+aXDqfA8Y5Yr0= c=1 sm=1 a=181Yqepm-84A:10 a=CYDyCxVgLFAA:10 a=BLceEmwcHowA:10 a=c23vf5CSMVc0QQz9B4a6RA==:17 a=ySfo2T4IAAAA:8 a=IBvgpIMz5uxGQgCxapAA:9 a=LZimyCkFPcyEXEZ6DBgA:7 a=axWQYnUQhmgA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Received: from unknown (HELO sookie.dilger.int) ([68.147.195.121]) by pd4ml1so-dmz.prod.shaw.ca with ESMTP; 10 Jun 2011 01:33:07 -0600 From: Andreas Dilger To: tytso@mit.edu, linux-ext4@vger.kernel.org Cc: Andreas Dilger Subject: [PATCH] ext2fs: fix error handling in ext2fs_add_dir_block Date: Fri, 10 Jun 2011 01:33:07 -0600 Message-Id: <1307691187-12854-1-git-send-email-adilger@whamcloud.com> X-Mailer: git-send-email 1.7.3.4 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org In ext2fs_add_dir_block() the dblist allocation size was changed to grow as the number of items in the dblist increases. However, the error handling in case of allocation failure wasn't changed to match. Fix the error case to revert to the old allocation size on failure. Signed-off-by: Andreas Dilger --- lib/ext2fs/dblist.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/ext2fs/dblist.c b/lib/ext2fs/dblist.c index 8ee61b4..c0a3dfe 100644 --- a/lib/ext2fs/dblist.c +++ b/lib/ext2fs/dblist.c @@ -172,7 +172,7 @@ errcode_t ext2fs_add_dir_block2(ext2_dblist dblist, ext2_ino_t ino, sizeof(struct ext2_db_entry2), &dblist->list); if (retval) { - dblist->size -= 100; + dblist->size = old_size / sizeof(struct ext2_db_entry2); return retval; } }