diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-08-20 08:16:24 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-08-21 08:25:24 -0400 |
commit | 11e3be0be2a1314e0861304857e7efcaed5d3e54 (patch) | |
tree | 7d6590ea687c8cc0f22246bcdc3f2cb3de57174f /fs/ubifs | |
parent | 73e8712aa02d924844fbd5bd84a2445a1c3f68d7 (diff) |
UBIFS: fix crash on error path
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>
Diffstat (limited to 'fs/ubifs')
-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 ce33b2beb151..8640920766ed 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) | |||
1749 | return 0; | 1749 | return 0; |
1750 | 1750 | ||
1751 | out_err: | 1751 | out_err: |
1752 | ubifs_lpt_free(c, 0); | 1752 | if (wr) |
1753 | ubifs_lpt_free(c, 1); | ||
1754 | if (rd) | ||
1755 | ubifs_lpt_free(c, 0); | ||
1753 | return err; | 1756 | return err; |
1754 | } | 1757 | } |
1755 | 1758 | ||