Skip to content

Commit e2a05cc

Browse files
Zhihao Chengrichardweinberger
authored andcommitted
ubifs: mount_ubifs: Release authentication resource in error handling path
Release the authentication related resource in some error handling branches in mount_ubifs(). Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Cc: <stable@vger.kernel.org> # 4.20+ Fixes: d8a2277 ("ubifs: Enable authentication support") Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent bb674a4 commit e2a05cc

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

fs/ubifs/super.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,7 @@ static int mount_ubifs(struct ubifs_info *c)
13311331

13321332
err = ubifs_read_superblock(c);
13331333
if (err)
1334-
goto out_free;
1334+
goto out_auth;
13351335

13361336
c->probing = 0;
13371337

@@ -1343,18 +1343,18 @@ static int mount_ubifs(struct ubifs_info *c)
13431343
ubifs_err(c, "'compressor \"%s\" is not compiled in",
13441344
ubifs_compr_name(c, c->default_compr));
13451345
err = -ENOTSUPP;
1346-
goto out_free;
1346+
goto out_auth;
13471347
}
13481348

13491349
err = init_constants_sb(c);
13501350
if (err)
1351-
goto out_free;
1351+
goto out_auth;
13521352

13531353
sz = ALIGN(c->max_idx_node_sz, c->min_io_size) * 2;
13541354
c->cbuf = kmalloc(sz, GFP_NOFS);
13551355
if (!c->cbuf) {
13561356
err = -ENOMEM;
1357-
goto out_free;
1357+
goto out_auth;
13581358
}
13591359

13601360
err = alloc_wbufs(c);
@@ -1629,6 +1629,8 @@ static int mount_ubifs(struct ubifs_info *c)
16291629
free_wbufs(c);
16301630
out_cbuf:
16311631
kfree(c->cbuf);
1632+
out_auth:
1633+
ubifs_exit_authentication(c);
16321634
out_free:
16331635
kfree(c->write_reserve_buf);
16341636
kfree(c->bu.buf);

0 commit comments

Comments
 (0)