From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] ext4: Avoid corruption of directories with hash tree indexes
Date: Fri, 19 Aug 2016 17:11:22 +0200 [thread overview]
Message-ID: <20160819171122.5d489084@amdc2363> (raw)
In-Reply-To: <8d736e068afd46e0b538d092571c6c2f@rwthex-w2-b.rwth-ad.de>
Hi Stefan,
> While directories can be read using the old linear scan method,
> adding a new file would require updating the index tree
> (alternatively, the whole tree could be removed).
>
> Signed-off-by: Stefan Br?ns <stefan.bruens@rwth-aachen.de>
> ---
> fs/ext4/ext4_write.c | 5 +++++
> include/ext4fs.h | 1 +
> 2 files changed, 6 insertions(+)
>
> diff --git a/fs/ext4/ext4_write.c b/fs/ext4/ext4_write.c
> index 4235b95..ccc8a9c 100644
> --- a/fs/ext4/ext4_write.c
> +++ b/fs/ext4/ext4_write.c
> @@ -864,6 +864,11 @@ int ext4fs_write(const char *fname, unsigned
> char *buffer, goto fail;
> if (ext4fs_iget(parent_inodeno, g_parent_inode))
> goto fail;
> + /* do not mess up a directory using hash trees */
> + if (le32_to_cpu(g_parent_inode->flags) & EXT4_INDEX_FL) {
> + printf("hash tree directory\n");
> + goto fail;
> + }
> /* check if the filename is already present in root */
> existing_file_inodeno = ext4fs_filename_unlink(filename);
> if (existing_file_inodeno != -1) {
> diff --git a/include/ext4fs.h b/include/ext4fs.h
> index e3f6216..6e31c73 100644
> --- a/include/ext4fs.h
> +++ b/include/ext4fs.h
> @@ -28,6 +28,7 @@
> #define __EXT4__
> #include <ext_common.h>
>
> +#define EXT4_INDEX_FL 0x00001000 /* Inode uses hash
> tree index */ #define EXT4_EXTENTS_FL 0x00080000 /*
> Inode uses extents */ #define EXT4_EXT_MAGIC
> 0xf30a #define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
--
Best regards,
Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
next prev parent reply other threads:[~2016-08-19 15:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20160819000526.14827-1-stefan.bruens@rwth-aachen.de>
2016-08-19 0:05 ` [U-Boot] [PATCH 1/2] ext4: Avoid corruption of directories with hash tree indexes Stefan Brüns
2016-08-19 15:11 ` Lukasz Majewski [this message]
2016-08-19 0:05 ` [U-Boot] [PATCH 2/2] ext4: scan all directory blocks when looking up an entry Stefan Brüns
2016-08-19 15:17 ` Lukasz Majewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160819171122.5d489084@amdc2363 \
--to=l.majewski@samsung.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox