From patchwork Sun Sep 11 20:46:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Stefan_Br=C3=BCns?= X-Patchwork-Id: 668513 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3sXNJv2KKFz9sBR for ; Mon, 12 Sep 2016 06:46:39 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 345D44B9F9; Sun, 11 Sep 2016 22:46:32 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XppaS6zWZGok; Sun, 11 Sep 2016 22:46:32 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E0D9D4B77D; Sun, 11 Sep 2016 22:46:26 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B26344B68A for ; Sun, 11 Sep 2016 22:46:22 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eNHPpjrUd2Dl for ; Sun, 11 Sep 2016 22:46:22 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mx-out-2.rwth-aachen.de (mx-out-2.rwth-aachen.de [134.130.5.187]) by theia.denx.de (Postfix) with ESMTPS id 7BC914B656 for ; Sun, 11 Sep 2016 22:46:22 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.30,319,1470693600"; d="scan'208";a="457580383" Received: from rwthex-w2-b.rwth-ad.de ([134.130.26.159]) by mx-2.rz.rwth-aachen.de with ESMTP; 11 Sep 2016 22:46:22 +0200 Received: from pebbles.fritz.box (92.228.151.12) by rwthex-w2-b.rwth-ad.de (2002:8682:1a9f::8682:1a9f) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Sun, 11 Sep 2016 22:46:34 +0200 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= To: Date: Sun, 11 Sep 2016 22:46:05 +0200 X-Mailer: git-send-email 2.10.0 In-Reply-To: <20160911204606.4146-1-stefan.bruens@rwth-aachen.de> References: <20160911204606.4146-1-stefan.bruens@rwth-aachen.de> MIME-Version: 1.0 X-Originating-IP: [92.228.151.12] X-ClientProxiedBy: rwthex-s1-a.rwth-ad.de (2002:8682:1a98::8682:1a98) To rwthex-w2-b.rwth-ad.de (2002:8682:1a9f::8682:1a9f) Message-ID: <05f3981db3c14326ad8dac10c2f500be@rwthex-w2-b.rwth-ad.de> Cc: Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH 2/3] test/fs: Check ext4 behaviour if dirent is first entry in directory block X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This is a regression test for a crash happening if the first dirent in the block matches. Code tried to access a predecessor entry which does not exist. The crash happened for any block, but "." is always the first entry in the first directory block and thus easy to check for. Signed-off-by: Stefan BrĂ¼ns --- test/fs/fs-test.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/fs/fs-test.sh b/test/fs/fs-test.sh index 12450ed..cb2a765 100755 --- a/test/fs/fs-test.sh +++ b/test/fs/fs-test.sh @@ -291,6 +291,12 @@ ${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_WRITE md5sum $addr \$filesize setenv filesize # + +# Next test case checks writing a file whose dirent +# is the first in the block, which is always true for "." +# The write should fail, but the lookup should work +# Test Case 12 - Check directory traversal +${PREFIX}${WRITE} host${SUFFIX} $addr ${FPATH}. 0x10 reset EOF @@ -471,6 +477,11 @@ function check_results() { pass_fail "TC11: 1MB write to $5 - write succeeded" check_md5 "Test Case 11b " "$1" "$2" 1 \ "TC11: 1MB write to $5 - content verified" + + # Check lookup of 'dot' directory + grep -A5 "Test Case 12 " "$1" | \ + egrep -q 'Unable to write file' + pass_fail "TC12: 1MB write to . - write denied" echo "** End $1" }