Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1749,6 +1749,9 @@ int ubifs_lpt_init(struct ubifs_info *c, int rd, int wr)
	return 0;

out_err:
	if (wr)
		ubifs_lpt_free(c, 1);
	if (rd)
		ubifs_lpt_free(c, 0);
	return err;
}