Skip to content

Commit 7d01cb2

Browse files
Zhihao Chengrichardweinberger
authored andcommitted
Revert "ubifs: dirty_cow_znode: Fix memleak in error handling path"
This reverts commit 122deab (ubifs: dirty_cow_znode: Fix memleak in error handling path). After commit 122deab applied, if insert_old_idx() failed, old index neither exists in TNC nor in old-index tree. Which means that old index node could be overwritten in layout_leb_in_gaps(), then ubifs image will be corrupted in power-cut. Fixes: 122deab (ubifs: dirty_cow_znode: Fix memleak ... path) Cc: stable@vger.kernel.org Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent 3a36d20 commit 7d01cb2

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

fs/ubifs/tnc.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,18 +267,11 @@ static struct ubifs_znode *dirty_cow_znode(struct ubifs_info *c,
267267
if (zbr->len) {
268268
err = insert_old_idx(c, zbr->lnum, zbr->offs);
269269
if (unlikely(err))
270-
/*
271-
* Obsolete znodes will be freed by tnc_destroy_cnext()
272-
* or free_obsolete_znodes(), copied up znodes should
273-
* be added back to tnc and freed by
274-
* ubifs_destroy_tnc_subtree().
275-
*/
276-
goto out;
270+
return ERR_PTR(err);
277271
err = add_idx_dirt(c, zbr->lnum, zbr->len);
278272
} else
279273
err = 0;
280274

281-
out:
282275
zbr->znode = zn;
283276
zbr->lnum = 0;
284277
zbr->offs = 0;

0 commit comments

Comments
 (0)