diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-08-20 15:16:24 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-14 09:59:26 -0700 |
commit | 75a8ac4c5552f71f5a1db27a3232e6e389a1274c (patch) | |
tree | 1ebc9d2e5fb981841491d02d7ebdc433d0897595 /fs | |
parent | 9abbc5a9d54be7dbcc920d079ae790db3520f337 (diff) |
UBIFS: fix crash on error path
commit 11e3be0be2a1314e0861304857e7efcaed5d3e54 upstream.
This patch fixes a regression introduced by
"4994297 UBIFS: make ubifs_lpt_init clean-up in case of failure" which
I've hit while running the 'integck -p' test. When remount the file-system
from R/O mode to R/W mode and 'lpt_init_wr()' fails, we free _all_ LPT
resources by calling 'ubifs_lpt_free(c, 0)', even those needed for R/O
mode. This leads to subsequent crashes, e.g., if we try to unmount
the file-system.
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ubifs/lpt.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c index ce33b2beb15..8640920766e 100644 --- a/fs/ubifs/lpt.c +++ b/fs/ubifs/lpt.c @@ -1749,7 +1749,10 @@ int ubifs_lpt_init(struct ubifs_info *c, int rd, int wr) return 0; out_err: - ubifs_lpt_free(c, 0); + if (wr) + ubifs_lpt_free(c, 1); + if (rd) + ubifs_lpt_free(c, 0); return err; } |