From patchwork Thu Nov 15 08:13:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Liu X-Patchwork-Id: 199206 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 C70312C007D for ; Thu, 15 Nov 2012 19:01:12 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933330Ab2KOIBK (ORCPT ); Thu, 15 Nov 2012 03:01:10 -0500 Received: from mail-pb0-f46.google.com ([209.85.160.46]:51088 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933227Ab2KOIBJ (ORCPT ); Thu, 15 Nov 2012 03:01:09 -0500 Received: by mail-pb0-f46.google.com with SMTP id wy7so979542pbc.19 for ; Thu, 15 Nov 2012 00:01:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=mQochYEkVE0TlLmkPXoahU1y9AHIoyaYNzBUkAkzD8I=; b=b/EjL23gtQjbEHNwhssnM6jbcbBnGcplK8ADhVkLDxUgUs/7aI7lCtgYQzQxoX73Qa +9vCbRzXXFpMpDUhvxhWIEJvkEEoq6Jy1o2rYWz5N7UsQQ3GqjgCBsOdEXhAblSTtdrI KAldM+Am90Aim5YClpln0o7syU/6Tp1i4HwvjKeb81U0In2XfqPtFKJYR5hIBabaeNZ4 EEfLT1F+C+0ABNhwZoi8/FFelQfdobU1oyFc8bkGBvHDGUc5/m7VjB63W2ftIRy2bny2 JLmJAy/bzza19ct8X+307KfShc1C6KJahhLOwoUIkutAkkz27eof19zC8HA25CjP9qFT kZ0w== Received: by 10.66.86.101 with SMTP id o5mr1073055paz.15.1352966468751; Thu, 15 Nov 2012 00:01:08 -0800 (PST) Received: from lz-desktop.taobao.ali.com ([182.92.247.2]) by mx.google.com with ESMTPS id os5sm9136355pbc.15.2012.11.15.00.01.06 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Nov 2012 00:01:08 -0800 (PST) From: Zheng Liu To: linux-ext4@vger.kernel.org, tytso@mit.edu Cc: Zheng Liu Subject: [PATCH 1/7] libext2fs: rec_len is set incorrect in ext2fs_process_dir_inline_data Date: Thu, 15 Nov 2012 16:13:23 +0800 Message-Id: <1352967209-29616-2-git-send-email-wenqing.lz@taobao.com> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: <1352967209-29616-1-git-send-email-wenqing.lz@taobao.com> References: <1352967209-29616-1-git-send-email-wenqing.lz@taobao.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Zheng Liu A new dir doesn't be created in the parent dir with inline data due to this bug because rec_len is set incorrect. It will cause a wrong offset, and no free room can be found. Signed-off-by: Zheng Liu --- lib/ext2fs/dir_iterate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ext2fs/dir_iterate.c b/lib/ext2fs/dir_iterate.c index 3f94ad4..198c5aa 100644 --- a/lib/ext2fs/dir_iterate.c +++ b/lib/ext2fs/dir_iterate.c @@ -335,7 +335,8 @@ int ext2fs_process_dir_inline_data(ext2_filsys fs, entry++; if (ret & DIRENT_CHANGED) { - dirent->rec_len = rec_len; + if (ext2fs_get_rec_len(fs, dirent, &rec_len)) + return BLOCK_ABORT; changed++; } if (ret & DIRENT_ABORT) {