Commit 11e3be0b authored by Artem Bityutskiy's avatar Artem Bityutskiy

UBIFS: fix crash on error path

This patch fixes a regression introduced by
"49942976 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.

Cc: stable@vger.kernel.org [v3.5+]
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
parent 73e8712a
...@@ -1749,6 +1749,9 @@ int ubifs_lpt_init(struct ubifs_info *c, int rd, int wr) ...@@ -1749,6 +1749,9 @@ int ubifs_lpt_init(struct ubifs_info *c, int rd, int wr)
return 0; return 0;
out_err: out_err:
if (wr)
ubifs_lpt_free(c, 1);
if (rd)
ubifs_lpt_free(c, 0); ubifs_lpt_free(c, 0);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment