All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [U-Boot, v2, 2/2] fs:ext4:write:fix: Reinitialize global variables after updating a file
Date: Mon, 12 May 2014 21:54:24 -0400	[thread overview]
Message-ID: <20140513015424.GJ22182@bill-the-cat> (raw)
In-Reply-To: <1399361765-31410-3-git-send-email-l.majewski@samsung.com>

On Tue, May 06, 2014 at 09:36:05AM +0200, ?ukasz Majewski wrote:

> This bug shows up when file stored on the ext4 file system is updated.
> 
> The ext4fs_delete_file() is responsible for deleting file's (e.g. uImage)
> data.
> However some global data (especially ext4fs_indir2_block), which is used
> during file deletion are left unchanged.
> 
> The ext4fs_indir2_block pointer stores reference to old ext4 double
> indirect allocated blocks. When it is unchanged, after file deletion,
> ext4fs_write_file() uses the same pointer (since it is already initialized
> - i.e. not NULL) to return number of blocks to write. This trunks larger
> file when previous one was smaller.
> 
> Lets consider following scenario:
> 
> 1. Flash target with ext4 formatted boot.img (which has uImage [*] on itself)
> 2. Developer wants to upload their custom uImage [**]
> 	- When new uImage [**] is smaller than the [*] - everything works
> 	correctly - we are able to store the whole smaller file with corrupted
> 	ext4fs_indir2_block pointer
> 	- When new uImage [**] is larger than the [*] - theCRC is corrupted,
> 	since truncation on data stored at eMMC was done.
> 3. When uImage CRC error appears, then reboot and LTHOR/DFU reflashing causes
> 	proper setting of ext4fs_indir2_block() and after that uImage[**]
> 	is successfully stored (correct uImage [*] metadata is stored at an
> 	eMMC on the first flashing).
> 
> Due to above the bug was very difficult to reproduce.
> This patch sets default values for all ext4fs_indir* pointers/variables.
> 
> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140512/83b32b6e/attachment.pgp>

      reply	other threads:[~2014-05-13  1:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-30 10:39 [U-Boot] [PATCH 0/2] fs:ext4: Fixes and code cleanup Lukasz Majewski
2014-04-30 10:39 ` [U-Boot] [PATCH 1/2] fs:ext4:cleanup: Remove superfluous code Lukasz Majewski
2014-04-30 19:15   ` Simon Glass
2014-05-05  5:20     ` Lukasz Majewski
2014-05-05 14:24       ` Simon Glass
2014-05-05 21:10         ` Lukasz Majewski
2014-05-05 21:12           ` Simon Glass
2014-04-30 10:39 ` [U-Boot] [PATCH 2/2] fs:ext4:write:fix: Reinitialize global variables after updating a file Lukasz Majewski
2014-04-30 19:21   ` Simon Glass
2014-05-05  5:52     ` Lukasz Majewski
2014-05-06  7:36 ` [U-Boot] [PATCH v2 0/2] fs:ext4: Fixes and code cleanup Lukasz Majewski
2014-05-06  7:36   ` [U-Boot] [PATCH v2 1/2] fs:ext4:cleanup: Remove superfluous code Lukasz Majewski
2014-05-13  1:54     ` [U-Boot] [U-Boot, v2, " Tom Rini
2014-05-06  7:36   ` [U-Boot] [PATCH v2 2/2] fs:ext4:write:fix: Reinitialize global variables after updating a file Lukasz Majewski
2014-05-13  1:54     ` Tom Rini [this message]

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=20140513015424.GJ22182@bill-the-cat \
    --to=trini@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.