public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Adam Thomas <adamthomas1111@gmail.com>
To: linux-mtd@lists.infradead.org
Subject: UBIFS: a pair of orphan bugs
Date: Mon, 28 Jan 2013 01:28:31 +0000	[thread overview]
Message-ID: <1359336513-6259-1-git-send-email-adamthomas1111@gmail.com> (raw)

Hello linux-mtd,

I recently encountered some UBIFS inconsistencies and tracked it back
to a pair of bugs in orphan delete. There is an assumption in
ubifs_delete_orphan that if the orphan cnext is NULL then it is not on
the cnext list, but that is incorrect for the last orphan on the cnext
list, which results in modifying freed memory. The same assumption is
made for the dnext list, which results in a double free. I am
including two patches that fix these issues by adding flags to
ubifs_orphan for pending commit and pending delete that are used
instead of checking cnext and dnext.

The cnext bug specifically was the cause of the inconsistencies I
encountered and is easy to reproduce. For example, repeatedly
untarring a root filesystem tarball and then removing those files
almost always results in inconsistencies in around 10 iterations. I do
not have a repro case for the dnext bug, I discovered that one due to
its similarity to the cnext list.

Thanks,
-Adam

             reply	other threads:[~2013-01-28  1:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-28  1:28 Adam Thomas [this message]
2013-01-28  1:28 ` [PATCH 1/2] UBIFS: fix use of freed ubifs_orphan objects Adam Thomas
2013-02-01 13:23   ` Adrian Hunter
2013-02-02 22:32     ` Adam Thomas
2013-02-02 22:32       ` [PATCH v2 " Adam Thomas
2013-02-04 10:31         ` Artem Bityutskiy
2013-01-28  1:28 ` [PATCH 2/2] UBIFS: fix double free of " Adam Thomas
2013-02-01 13:23   ` Adrian Hunter
2013-02-02 22:35     ` [PATCH v2 " Adam Thomas

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=1359336513-6259-1-git-send-email-adamthomas1111@gmail.com \
    --to=adamthomas1111@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    /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