Skip to content

Commit

Permalink
UBIFS: fix crash on error path
Browse files Browse the repository at this point in the history
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.

Cc: stable@vger.kernel.org [v3.5+]
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
  • Loading branch information
Artem Bityutskiy committed Aug 21, 2012
1 parent 73e8712 commit 11e3be0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/ubifs/lpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 11e3be0

Please sign in to comment.